From 5ea1e45eb29adf37fa4e3bec32e57395ceaf00bf Mon Sep 17 00:00:00 2001 From: Maurice ONeal Date: Mon, 27 Apr 2020 13:08:56 -0400 Subject: [PATCH] Some minor bug fixes Fixed the shebang for the python build/install scripts to properly point to the correct python executable in linux. Fixed a bug that caused the host session to return false "command not found errors" after running any command shortly after successfully connecting. --- build.py | 2 +- install.py | 2 +- src/db.h | 2 +- src/session.cpp | 12 ++++++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build.py b/build.py index c4223e5..a935348 100644 --- a/build.py +++ b/build.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/usr/bin/python3 import os import re diff --git a/install.py b/install.py index a95b45e..8290bc4 100644 --- a/install.py +++ b/install.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/usr/bin/python3 import os import subprocess diff --git a/src/db.h b/src/db.h index cb846ad..e3f0db2 100644 --- a/src/db.h +++ b/src/db.h @@ -37,7 +37,7 @@ #include "shell.h" #define APP_NAME "MRCI" -#define APP_VER "3.3.1.0" +#define APP_VER "3.4.1.0" #define APP_TARGET "mrci" #ifdef Q_OS_WIN diff --git a/src/session.cpp b/src/session.cpp index 7b06eef..9339c06 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -334,9 +334,17 @@ void Session::dataFromClient() { if (tcpSocket->bytesAvailable() >= CLIENT_HEADER_LEN) { - if (tcpSocket->read(4) == QByteArray(SERVER_HEADER_TAG)) + auto clientHeader = tcpSocket->read(CLIENT_HEADER_LEN); + + // client header format: [4bytes(tag)][134bytes(appName)][272bytes(padding)] + + // tag = 0x4D, 0x52, 0x43, 0x49 (MRCI) + // appName = UTF16LE string (padded with 0x00) + // padding = just a string of 0x00 (reserved for future expansion) + + if (clientHeader.startsWith(SERVER_HEADER_TAG)) { - wrStringToBlock(fromTEXT(tcpSocket->read(BLKSIZE_APP_NAME)).trimmed(), appName, BLKSIZE_APP_NAME); + wrToBlock(clientHeader.mid(4, BLKSIZE_APP_NAME), appName, BLKSIZE_APP_NAME); auto ver = QCoreApplication::applicationVersion().split('.');