diff --git a/AISCommon.c b/AISCommon.c index 300e888..a193d2f 100644 --- a/AISCommon.c +++ b/AISCommon.c @@ -3201,6 +3201,19 @@ static VOID ADSBConnect(void * unused) destaddr.sin_family = AF_INET; destaddr.sin_port = htons(ADSBPort); + if (destaddr.sin_addr.s_addr == INADDR_NONE) + { + // Resolve name to address + + struct hostent * HostEnt = gethostbyname(ADSBHost); + + if (!HostEnt) + return; // Resolve failed + + memcpy(&destaddr.sin_addr.s_addr,HostEnt->h_addr,4); + } + + TCPSock = socket(AF_INET,SOCK_STREAM,0); if (TCPSock == INVALID_SOCKET) diff --git a/APRSCode.c b/APRSCode.c index d3fe994..76b0140 100644 --- a/APRSCode.c +++ b/APRSCode.c @@ -4273,6 +4273,18 @@ static VOID TCPConnect(void * unused) destaddr.sin_family = AF_INET; destaddr.sin_port = htons(HostPort); + if (destaddr.sin_addr.s_addr == INADDR_NONE) + { + // Resolve name to address + + struct hostent * HostEnt = gethostbyname(HostName); + + if (!HostEnt) + return; // Resolve failed + + memcpy(&destaddr.sin_addr.s_addr,HostEnt->h_addr,4); + } + TCPSock = socket(AF_INET,SOCK_STREAM,0); if (TCPSock == INVALID_SOCKET) diff --git a/ARDOP.c b/ARDOP.c index ced421c..1e1c9be 100644 --- a/ARDOP.c +++ b/ARDOP.c @@ -3522,7 +3522,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) if (_memicmp(Buffer, "PINGACK ", 8) == 0) { WritetoTrace(TNC, Buffer, MsgLen - 1); - // Drop through to return touser + // Drop through to return to user } if (_memicmp(Buffer, "CQ ", 3) == 0 && MsgLen > 10) diff --git a/Bpq32.c b/Bpq32.c index 26d4ef3..63903d4 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1133,6 +1133,12 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Fix SESSIONTIMELIMIT processing // Add STOPPORT/STARTPORT for UZ7HO driver // Fix processing of extended QtSM 'g' frame (36) +// Allow setting just freq on Yaseu rigs (37) +// Enable KISSHF driver on Linux (40) +// Allow AISHOST and ADSBHOST to be a name as well as an address (41) +// Fix Interlock of incoming UZ7HO connections (41) +// Disable VARA Actions menu if not sysop (41) +// Fix Port CTEXT on UZ7HO B C or D channels (42) #define CKernel diff --git a/ChatUtilities.c b/ChatUtilities.c index 50b6b8b..a255faf 100644 --- a/ChatUtilities.c +++ b/ChatUtilities.c @@ -14,7 +14,7 @@ int SEMCLASHES = 0; VOID __cdecl Debugprintf(const char * format, ...) { - char Mess[1000]; + char Mess[65536]; va_list(arglist);int Len; va_start(arglist, format); @@ -29,7 +29,7 @@ VOID __cdecl Debugprintf(const char * format, ...) VOID __cdecl Logprintf(int LogMode, ChatCIRCUIT * conn, int InOut, const char * format, ...) { - char Mess[1000]; + char Mess[65536]; va_list(arglist);int Len; va_start(arglist, format); @@ -85,7 +85,7 @@ void FreeSemaphore(struct SEM * Semaphore) VOID __cdecl nodeprintf(ChatCIRCUIT * conn, const char * format, ...) { - char Mess[1000]; + char Mess[65536]; int len; va_list(arglist); diff --git a/Cmd.c b/Cmd.c index 19e3af4..f6c3fc1 100644 --- a/Cmd.c +++ b/Cmd.c @@ -3975,11 +3975,16 @@ VOID ATTACHCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX if (rxInterlock == OtherTNC->RXRadio || txInterlock == OtherTNC->TXRadio) // Same Group { - if (OtherTNC->PortRecord->ATTACHEDSESSIONS[0]) - { - Bufferptr = Cmdprintf(Session, Bufferptr, "Sorry, interlocked port %d is in use\r", i); - SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); - return; + int n; + + for (n = 0; n <= 26; n++) + { + if (OtherTNC->PortRecord->ATTACHEDSESSIONS[n]) + { + Bufferptr = Cmdprintf(Session, Bufferptr, "Sorry, interlocked port %d is in use\r", i); + SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); + return; + } } } } diff --git a/HTTPcode.c b/HTTPcode.c index 6ea9e76..488b366 100644 --- a/HTTPcode.c +++ b/HTTPcode.c @@ -2307,6 +2307,9 @@ doHeader: if (TNC == 0) return 1; + if (LOCAL == FALSE && COOKIE == FALSE) + return 1; + if (strcmp(input, "Abort") == 0) { if (TNC->ForcedCloseProc) diff --git a/HanksRT.c b/HanksRT.c index 0a8eca5..a65b38e 100644 --- a/HanksRT.c +++ b/HanksRT.c @@ -130,7 +130,7 @@ int AddtoHistory(struct user_t * user, char * text) struct HistoryRec * Rec; struct HistoryRec * ptr; int n = 1; - char buf[512]; + char buf[2048]; char Stamp[16]; struct tm * tm; time_t Now = time(NULL); @@ -150,6 +150,9 @@ int AddtoHistory(struct user_t * user, char * text) tm = gmtime(&Now); + if (strlen(text) + strlen(user->name) + strlen(user->call) > 2000) + return 0; // Shouldn't be that long, but protect buffer + sprintf(Stamp,"%02d:%02d ", tm->tm_hour, tm->tm_min); sprintf(buf, "%s%-6.6s %s %c %s\r", Stamp, user->call, user->name, ':', text); @@ -290,11 +293,11 @@ VOID __cdecl nprintf(ChatCIRCUIT * conn, const char * format, ...) { // seems to be printf to a socket - char buff[600]; + char buff[65536]; va_list(arglist); va_start(arglist, format); - vsprintf(buff, format, arglist); + vsnprintf(buff, sizeof(buff), format, arglist); nputs(conn, buff); } @@ -517,6 +520,11 @@ VOID ProcessChatLine(ChatCIRCUIT * conn, struct UserInfo * user, char* OrigBuffe WCHAR BufferW[65536]; UCHAR BufferB[65536]; + // Sanity Check + + if (len > 32768) + return; + // Convert to UTF8 if not already in UTF-8 if (len == 73 && memcmp(&OrigBuffer[40], " ", 20) == 0) diff --git a/LinBPQ.c b/LinBPQ.c index cd1dd3d..8c1e940 100644 --- a/LinBPQ.c +++ b/LinBPQ.c @@ -1379,6 +1379,7 @@ void * SerialExtInit(EXTPORTDATA * PortEntry); void * WinRPRExtInit(EXTPORTDATA * PortEntry); void * HSMODEMExtInit(EXTPORTDATA * PortEntry); void * FreeDataExtInit(EXTPORTDATA * PortEntry); +void * KISSHFExtInit(EXTPORTDATA * PortEntry); void * InitializeExtDriver(PEXTPORTDATA PORTVEC) { @@ -1455,6 +1456,9 @@ void * InitializeExtDriver(PEXTPORTDATA PORTVEC) if (strstr(Value, "VARA")) return VARAExtInit; + if (strstr(Value, "KISSHF")) + return KISSHFExtInit; + if (strstr(Value, "SERIAL")) return SerialExtInit; diff --git a/RigControl.c b/RigControl.c index aa38953..e0d38be 100644 --- a/RigControl.c +++ b/RigControl.c @@ -820,36 +820,6 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session, return FALSE; } - if (RIG->RIGOK == 0) - { - if (Session != -1) - { - if (PORT->Closed) - sprintf(Command, "Sorry - Radio port closed\r"); - else - sprintf(Command, "Sorry - Radio not responding\r"); - } - return FALSE; - } - - if (n == 2 && _stricmp(FreqString, "FREQ") == 0) - { - if (RIG->Valchar[0]) - sprintf(Command, "Frequency is %s MHz\r", RIG->Valchar); - else - sprintf(Command, "Frequency not known\r"); - - return FALSE; - } - - if (n == 2 && _stricmp(FreqString, "PTT") == 0) - { - Rig_PTTEx(RIG, TRUE, NULL); - RIG->PTTTimer = 10; // 1 sec - sprintf(Command, "Ok\r"); - return FALSE; - } - if (n > 1) { if (_stricmp(FreqString, "SCANSTART") == 0) @@ -905,6 +875,38 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session, } } + + + if (RIG->RIGOK == 0) + { + if (Session != -1) + { + if (PORT->Closed) + sprintf(Command, "Sorry - Radio port closed\r"); + else + sprintf(Command, "Sorry - Radio not responding\r"); + } + return FALSE; + } + + if (n == 2 && _stricmp(FreqString, "FREQ") == 0) + { + if (RIG->Valchar[0]) + sprintf(Command, "Frequency is %s MHz\r", RIG->Valchar); + else + sprintf(Command, "Frequency not known\r"); + + return FALSE; + } + + if (n == 2 && _stricmp(FreqString, "PTT") == 0) + { + Rig_PTTEx(RIG, TRUE, NULL); + RIG->PTTTimer = 10; // 1 sec + sprintf(Command, "Ok\r"); + return FALSE; + } + RIG->Session = Session; // BPQ Stream RIG->PollCounter = 50; // Dont read freq for 5 secs in case clash with Poll diff --git a/UZ7HODrv.c b/UZ7HODrv.c index 94088a5..d17e409 100644 --- a/UZ7HODrv.c +++ b/UZ7HODrv.c @@ -2179,15 +2179,17 @@ VOID ProcessAGWPacket(struct TNCINFO * TNC, UCHAR * Message) if (TNC == NULL) return; + PORT = &TNC->PortRecord->PORTCONTROL; + if (strstr(Message, " To Station")) { char noStreams[] = "No free sessions - disconnecting\r"; // Incoming. Look for a free Stream - Stream = 1; + Stream = 0; - while(Stream <= AGW->MaxSessions) + while(Stream < AGW->MaxSessions) { if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] == 0) goto GotStream; diff --git a/VARA.c b/VARA.c index 271fcdd..5dddeca 100644 --- a/VARA.c +++ b/VARA.c @@ -918,8 +918,9 @@ char WebProcTemplate[] = "" "{location.reload()}\n" "\r\n" "%s\r\n" - "

%s

" - "" + "

%s

"; + +char Menubit[] = "" "\r\n" "" "Abort Session" @@ -942,6 +943,9 @@ static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "VARA Status", "VARA Status"); + if (LOCAL) + Len += sprintf(&Buff[Len], Menubit, TNC->TXOffset, TNC->TXOffset); + if (TNC->TXFreq) Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset); @@ -2285,17 +2289,11 @@ VOID VARAProcessReceivedControl(struct TNCINFO * TNC) if (TNC->InputLen > 8000) // Shouldnt have packets longer than this TNC->InputLen=0; - - // I don't think it likely we will get packets this long, but be aware... - - // We can get pretty big ones in the faster InputLen=recv(TNC->TCPSock, &TNC->ARDOPBuffer[TNC->InputLen], 8192 - TNC->InputLen, 0); if (InputLen == 0 || InputLen == SOCKET_ERROR) - { - // Does this mean closed? - + { closesocket(TNC->TCPSock); TNC->TCPSock = 0; @@ -2324,7 +2322,7 @@ loop: if ((ptr2 - ptr) == 1) // CR { - // Usual Case - single meg in buffer + // Usual Case - single msg in buffer VARAProcessResponse(TNC, TNC->ARDOPBuffer, TNC->InputLen); TNC->InputLen=0; diff --git a/Versions.h b/Versions.h index 187a879..abe445f 100644 --- a/Versions.h +++ b/Versions.h @@ -10,16 +10,16 @@ #endif -#define KVers 6,0,23,36 -#define KVerstring "6.0.23.36\0" +#define KVers 6,0,23,42 +#define KVerstring "6.0.23.42\0" #ifdef CKernel #define Vers KVers #define Verstring KVerstring -#define Datestring "December 2022" +#define Datestring "January 2023" #define VerComments "G8BPQ Packet Switch (C Version)" KVerstring -#define VerCopyright "Copyright © 2001-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0" #define VerDesc "BPQ32 Switch\0" #define VerProduct "BPQ32" @@ -30,7 +30,7 @@ #define Vers 1,0,16,1 #define Verstring "1.0.16.1\0" #define VerComments "Internet Terminal for G8BPQ Packet Switch\0" -#define VerCopyright "Copyright © 2011-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 2011-2023 John Wiseman G8BPQ\0" #define VerDesc "Simple TCP Terminal Program for G8BPQ Switch\0" #define VerProduct "BPQTermTCP" @@ -41,7 +41,7 @@ #define Vers 2,2,5,1 #define Verstring "2.2.5.1\0" #define VerComments "Simple Terminal for G8BPQ Packet Switch\0" -#define VerCopyright "Copyright © 1999-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 1999-2023 John Wiseman G8BPQ\0" #define VerDesc "Simple Terminal Program for G8BPQ Switch\0" #define VerProduct "BPQTerminal" @@ -52,7 +52,7 @@ #define Vers 2,2,0,3 #define Verstring "2.2.0.3\0" #define VerComments "MDI Terminal for G8BPQ Packet Switch\0" -#define VerCopyright "Copyright © 1999-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 1999-2023 John Wiseman G8BPQ\0" #define VerDesc "MDI Terminal Program for G8BPQ Switch\0" #endif @@ -62,7 +62,7 @@ #define Vers KVers #define Verstring KVerstring #define VerComments "Mail server for G8BPQ Packet Switch\0" -#define VerCopyright "Copyright © 2009-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 2009-2023 John Wiseman G8BPQ\0" #define VerDesc "Mail server for G8BPQ's 32 Bit Switch\0" #define VerProduct "BPQMail" @@ -97,7 +97,7 @@ #define Vers 0,1,0,0 #define Verstring "0.1.0.0\0" #define VerComments "Password Generation Utility for G8BPQ Packet Switch\0" -#define VerCopyright "Copyright © 2011-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 2011-2023 John Wiseman G8BPQ\0" #define VerDesc "Password Generation Utility for G8BPQ Switch\0" #endif @@ -107,7 +107,7 @@ #define Vers KVers #define Verstring KVerstring #define VerComments "APRS Client for G8BPQ Switch\0" -#define VerCopyright "Copyright © 2012-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 2012-2023 John Wiseman G8BPQ\0" #define VerDesc "APRS Client for G8BPQ Switch\0" #define VerProduct "BPQAPRS" @@ -118,7 +118,7 @@ #define Vers KVers #define Verstring KVerstring #define VerComments "Chat server for G8BPQ Packet Switch\0" -#define VerCopyright "Copyright © 2009-2022 John Wiseman G8BPQ\0" +#define VerCopyright "Copyright © 2009-2023 John Wiseman G8BPQ\0" #define VerDesc "Chat server for G8BPQ's 32 Bit Switch\0" #define VerProduct "BPQChat" diff --git a/bpqchat.c b/bpqchat.c index 6a28e7d..f2be464 100644 --- a/bpqchat.c +++ b/bpqchat.c @@ -66,6 +66,7 @@ // Add History (28) // Add connect scripts to config page text (31) // Fix History (31) +// Stop buffer overflow in History ( #include "BPQChat.h" #include "Dbghelp.h" diff --git a/debug/bpq32.pdb b/debug/bpq32.pdb new file mode 100644 index 0000000..0af0ae0 Binary files /dev/null and b/debug/bpq32.pdb differ diff --git a/makefile b/makefile index d5c3f5e..6abbbdc 100644 --- a/makefile +++ b/makefile @@ -28,7 +28,7 @@ noi2c: linbpq linbpq: $(OBJS) - gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lcrypto -lrt -lm -lz -lpthread -lconfig -lpcap -lasound -o linbpq + gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lcrypto -lrt -lm -lz -lpthread -lconfig -lpcap -o linbpq sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq -include *.d diff --git a/makefile~ b/makefile~ index 6abbbdc..d5c3f5e 100644 --- a/makefile~ +++ b/makefile~ @@ -28,7 +28,7 @@ noi2c: linbpq linbpq: $(OBJS) - gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lcrypto -lrt -lm -lz -lpthread -lconfig -lpcap -o linbpq + gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lcrypto -lrt -lm -lz -lpthread -lconfig -lpcap -lasound -o linbpq sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq -include *.d