6.0.23.51

This commit is contained in:
John Wiseman 2023-03-02 09:33:47 +00:00
parent c32ef4ee1e
commit 39da8ffc52
15 changed files with 644 additions and 257 deletions

View File

@ -4431,7 +4431,7 @@ static VOID GPSDConnect(void * unused)
// Request data // Request data
send(TCPSock, "?WATCH={\"enable\":true,\"nmea\":true}", 34, 0); send(TCPSock, "?WATCH={\"enable\":true,\"nmea\":true}\r\n", 36, 0);
} }
else else
{ {
@ -4472,6 +4472,10 @@ static VOID GPSDConnect(void * unused)
{ {
char Buffer[65536]; char Buffer[65536];
int len = recv(TCPSock, Buffer, 65500, 0); int len = recv(TCPSock, Buffer, 65500, 0);
char TCPMsg[8192];
char * ptr;
char * Lastptr;
if (len == 0) if (len == 0)
{ {
@ -4484,10 +4488,40 @@ static VOID GPSDConnect(void * unused)
{ {
Buffer[len] = 0; Buffer[len] = 0;
if (Buffer[0] == '$' && memcmp(&Buffer[3], "RMC", 3) == 0) ptr = Lastptr = Buffer;
if (Check0183CheckSum(Buffer, len)) Buffer[len] = 0;
DecodeRMC(Buffer, len);
while (len > 0)
{
ptr = strchr(Lastptr, 10);
if (ptr)
{
size_t Len = ptr - Lastptr -1;
if (Len > 8100)
return;
memcpy(TCPMsg, Lastptr, Len);
TCPMsg[Len++] = 13;
TCPMsg[Len++] = 10;
TCPMsg[Len] = 0;
if (!Check0183CheckSum(TCPMsg, Len))
{
Debugprintf("Checksum Error %s", TCPMsg);
}
else
{
if (memcmp(&TCPMsg[3], "RMC", 3) == 0)
DecodeRMC(TCPMsg, Len);
}
Lastptr = ptr + 1;
len -= (int)Len;
}
else
return;
}
} }
} }

View File

@ -121,6 +121,7 @@ char * FormatSYNCMessage(CIRCUIT * conn, struct MsgInfo * Msg);
int decode_quoted_printable(char *ptr, int len); int decode_quoted_printable(char *ptr, int len);
void decodeblock( unsigned char in[4], unsigned char out[3]); void decodeblock( unsigned char in[4], unsigned char out[3]);
int encode_quoted_printable(char *s, char * out, int Len); int encode_quoted_printable(char *s, char * out, int Len);
int32_t Encode(char * in, char * out, int32_t inlen, BOOL B1Protocol, int Compress);
config_t cfg; config_t cfg;
@ -2108,7 +2109,7 @@ BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type
} }
else else
{ {
if (_stricmp(BID, Calls[0])) if (_stricmp(BID, Calls[0]) == 0)
return TRUE; return TRUE;
} }
@ -2201,7 +2202,7 @@ BOOL CheckHoldFilters(char * From, char * To, char * ATBBS, char * BID)
} }
else else
{ {
if (_stricmp(BID, Calls[0])) if (_stricmp(BID, Calls[0]) == 0)
return TRUE; return TRUE;
} }
@ -6627,7 +6628,7 @@ BOOL FindMessagestoForwardLoop(CIRCUIT * conn, char Type, int MaxLen)
Forwardit: Forwardit:
if (Msg->Defered) // = response received if (Msg->Defered > 0) // = response received
{ {
Msg->Defered--; Msg->Defered--;
Debugprintf("Message %d deferred", Msg->number); Debugprintf("Message %d deferred", Msg->number);
@ -8131,8 +8132,25 @@ InBand:
if (strstr(Buffer, " CONNECTED") || strstr(Buffer, "PACLEN") || strstr(Buffer, "IDLETIME") || if (strstr(Buffer, " CONNECTED") || strstr(Buffer, "PACLEN") || strstr(Buffer, "IDLETIME") ||
strstr(Buffer, "OK") || strstr(Buffer, "###LINK MADE") || strstr(Buffer, "VIRTUAL CIRCUIT ESTABLISHED")) strstr(Buffer, "OK") || strstr(Buffer, "###LINK MADE") || strstr(Buffer, "VIRTUAL CIRCUIT ESTABLISHED"))
{ {
// If connected to SYNC, save IP address and port
char * Cmd; char * Cmd;
if (strcmp(Buffer, "*** CONNECTED TO SYNC ") != 0)
{
char * IPAddr = &Buffer[22];
char * Port = strlop(IPAddr, ':');
if (Port)
{
if (conn->SyncHost)
free(conn->SyncHost);
conn->SyncHost = _strdup(IPAddr);
conn->SyncPort = atoi(Port);
}
}
if (conn->SkipConn) if (conn->SkipConn)
{ {
conn->SkipConn = FALSE; conn->SkipConn = FALSE;
@ -8484,6 +8502,10 @@ CheckForSID:
if (strstr(Buffer, "POSYNCHELLO")) // RMS RELAY Sync process if (strstr(Buffer, "POSYNCHELLO")) // RMS RELAY Sync process
{ {
conn->BBSFlags &= ~RunningConnectScript; // so it doesn't get reentered conn->BBSFlags &= ~RunningConnectScript; // so it doesn't get reentered
conn->NextMessagetoForward = FirstMessageIndextoForward;
conn->UserPointer->Total.ConnectsOut++;
ForwardingInfo->LastReverseForward = time(NULL);
ProcessLine(conn, 0, Buffer, len); ProcessLine(conn, 0, Buffer, len);
return FALSE; return FALSE;
} }
@ -9091,7 +9113,6 @@ VOID * _zalloc_dbg(size_t len, int type, char * file, int line)
return ptr; return ptr;
} }
struct MsgInfo * FindMessageByNumber(int msgno) struct MsgInfo * FindMessageByNumber(int msgno)
{ {
int m=NumberofMessages; int m=NumberofMessages;
@ -9115,6 +9136,25 @@ struct MsgInfo * FindMessageByNumber(int msgno)
return NULL; return NULL;
} }
struct MsgInfo * FindMessageByBID(char * BID)
{
int m = NumberofMessages;
struct MsgInfo * Msg;
while (m > 0)
{
Msg = MsgHddrPtr[m];
if (strcmp(Msg->bid, BID) == 0)
return Msg;
m--;
}
return NULL;
}
VOID DecryptPass(char * Encrypt, unsigned char * Pass, unsigned int len) VOID DecryptPass(char * Encrypt, unsigned char * Pass, unsigned int len)
{ {
unsigned char hash[50]; unsigned char hash[50];
@ -10357,7 +10397,7 @@ int Connected(int Stream)
else else
n=sprintf_s(Msg, sizeof(Msg), "Incoming Connect from %s", user->Call); n=sprintf_s(Msg, sizeof(Msg), "Incoming Connect from %s", user->Call);
// Send SID and Prompt // Send SID and Prompt (Unless Sync)
if (user->ForwardingInfo && user->ForwardingInfo->ConTimeout) if (user->ForwardingInfo && user->ForwardingInfo->ConTimeout)
conn->SIDResponseTimer = user->ForwardingInfo->ConTimeout / 10; // 10 sec ticks conn->SIDResponseTimer = user->ForwardingInfo->ConTimeout / 10; // 10 sec ticks
@ -10422,6 +10462,9 @@ int Connected(int Stream)
if (conn->RadioOnlyMode) if (conn->RadioOnlyMode)
nodeprintf(conn,";WL2K-Radio/Internet_Network\r"); nodeprintf(conn,";WL2K-Radio/Internet_Network\r");
if (!(conn->BBSFlags & SYNCMODE))
{
nodeprintf(conn, BBSSID, "BPQ-", nodeprintf(conn, BBSSID, "BPQ-",
Ver[0], Ver[1], Ver[2], Ver[3], Ver[0], Ver[1], Ver[2], Ver[3],
BIN ? "B" : "", B1 ? "1" : "", B2 ? "2" : "", BIN ? "B" : "", B1 ? "1" : "", B2 ? "2" : "",
@ -10432,10 +10475,13 @@ int Connected(int Stream)
// nodeprintf(conn,"[WL2K-BPQ.1.0.4.39-B2FWIHJM$]\r"); // nodeprintf(conn,"[WL2K-BPQ.1.0.4.39-B2FWIHJM$]\r");
} }
}
if ((user->Name[0] == 0) & AllowAnon) if ((user->Name[0] == 0) & AllowAnon)
strcpy(user->Name, user->Call); strcpy(user->Name, user->Call);
if (!(conn->BBSFlags & SYNCMODE))
{
if (user->Name[0] == 0) if (user->Name[0] == 0)
{ {
conn->Flags |= GETTINGUSER; conn->Flags |= GETTINGUSER;
@ -10443,6 +10489,13 @@ int Connected(int Stream)
} }
else else
SendWelcomeMsg(Stream, conn, user); SendWelcomeMsg(Stream, conn, user);
}
else
{
// Seems to be a timing problem - see if this fixes it
Sleep(500);
}
RefreshMainWindow(); RefreshMainWindow();
@ -11379,7 +11432,10 @@ VOID ProcessLine(CIRCUIT * conn, struct UserInfo * user, char* Buffer, int len)
conn->BBSFlags |= SYNCMODE; conn->BBSFlags |= SYNCMODE;
conn->FBBHeaders = zalloc(5 * sizeof(struct FBBHeaderLine)); conn->FBBHeaders = zalloc(5 * sizeof(struct FBBHeaderLine));
Sleep(500);
BBSputs(conn, "OK\r"); BBSputs(conn, "OK\r");
Flush(conn);
return; return;
} }
@ -13556,11 +13612,72 @@ BOOL ProcessReqDir(struct MsgInfo * Msg)
return TRUE; return TRUE;
} }
/*
' Augment Message ID with the Message Pickup Station we're directing this message to.
'
Dim strAugmentedMessageID As String
If GetMidRMS(MessageId) <> "" Then
' The MPS RMS is already set on the message ID
strAugmentedMessageID = MessageId
strMPS = GetMidRMS(MessageId)
' "@R" at the end of the MID means route message only via radio
If GetMidForwarding(MessageId) = "" And (blnRadioOnly Or UploadThroughInternet()) Then
strAugmentedMessageID &= "@" & strHFOnlyFlag
End If
ElseIf strMPS <> "" Then
' Add MPS to the message ID
strAugmentedMessageID = MessageId & "@" & strMPS
' "@R" at the end of the MID means route message only via radio
If blnRadioOnly Or UploadThroughInternet() Then
strAugmentedMessageID &= "@" & strHFOnlyFlag
End If
Else
strAugmentedMessageID = MessageId
End If
*/
void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer, int len) void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer, int len)
{ {
Buffer[len] = 0; Buffer[len] = 0;
if (conn->Flags & GETTINGSYNCMESSAGE)
{
// Data
if ((conn->TempMsg->length + len) > conn->MailBufferSize)
{
conn->MailBufferSize += 10000;
conn->MailBuffer = realloc(conn->MailBuffer, conn->MailBufferSize);
if (conn->MailBuffer == NULL)
{
BBSputs(conn, "*** Failed to extend Message Buffer\r");
conn->CloseAfterFlush = 20; // 2 Secs
return;
}
}
memcpy(&conn->MailBuffer[conn->TempMsg->length], Buffer, len);
conn->TempMsg->length += len;
if (conn->TempMsg->length >= conn->SyncCompressedLen)
{
// Complete - decompress it
conn->BBSFlags |= FBBCompressed;
Decode(conn, 1);
conn->Flags &= !GETTINGSYNCMESSAGE;
BBSputs(conn, "OK\r");
return;
}
return;
}
if (conn->Flags & PROPOSINGSYNCMSG) if (conn->Flags & PROPOSINGSYNCMSG)
{ {
// Waiting for response to TR AddMessage // Waiting for response to TR AddMessage
@ -13695,7 +13812,7 @@ void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer
conn->SyncCompressedLen = Encode(Message, conn->SyncMessage, conn->SyncXMLLen + conn->SyncMsgLen, 0, 1); conn->SyncCompressedLen = Encode(Message, conn->SyncMessage, conn->SyncXMLLen + conn->SyncMsgLen, 0, 1);
sprintf(Buffer, "TR AddMessage_%s %d %d %d True\r", sprintf(Buffer, "TR AddMessage_%s %d %d %d True\r", // The True on end indicates compressed
Msg->bid, conn->SyncCompressedLen, conn->SyncXMLLen, conn->SyncMsgLen); Msg->bid, conn->SyncCompressedLen, conn->SyncXMLLen, conn->SyncMsgLen);
free(Message); free(Message);
@ -13713,55 +13830,22 @@ void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer
return; return;
} }
if (memcmp(Buffer, "TR RMS_Location_", 16) == 0) if (memcmp(Buffer, "TR ", 2) == 0)
{ {
// I think this is an xml message giving location of station // Messages have TR_COMMAND_BID Compressed Len XML Len Bosy Len
BIDRec * BID; char * Command;
char *ptr1, *ptr2, *context; char * BIDptr;
// TR RMS_Location_OH6IJ3_YIBB50HCCQUS 200 367 0 True
WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
ptr1 = strtok_s(&Buffer[16], " ", &context); // MID
// What to do with call bit??
ptr1 = strlop(ptr1, '_');
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncCompressedLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncXMLLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncMsgLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
BID = LookupBID(ptr1);
if (BID)
{
BBSputs(conn, "Rejected - Duplicate BID\r");
return;
}
conn->TempMsg = zalloc(sizeof(struct MsgInfo));
BBSputs(conn, "OK\r");
return;
}
if (memcmp(Buffer, "TR AddMessage_", 14) == 0)
{
BIDRec * BID; BIDRec * BID;
char *ptr1, *ptr2, *context; char *ptr1, *ptr2, *context;
// TR AddMessage_1145_G8BPQ 727 1202 440 True // TR AddMessage_1145_G8BPQ 727 1202 440 True
WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS); WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
ptr1 = strtok_s(&Buffer[14], " ", &context); // MID
Command = strtok_s(&Buffer[3], "_", &context);
BIDptr = strtok_s(NULL, " ", &context);
ptr2 = strtok_s(NULL, " ", &context); ptr2 = strtok_s(NULL, " ", &context);
conn->SyncCompressedLen = atoi(ptr2); conn->SyncCompressedLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context); ptr2 = strtok_s(NULL, " ", &context);
@ -13770,89 +13854,35 @@ void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer
conn->SyncMsgLen = atoi(ptr2); conn->SyncMsgLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context); ptr2 = strtok_s(NULL, " ", &context);
BID = LookupBID(ptr1); // If addmessage need to check bid doesn't exist
if (strcmp(Command, "AddMessage") == 0)
{
strlop(BIDptr, '@'); // sometimes has @CALL@R
if (strlen(BIDptr) > 12)
BIDptr[12] = 0;
BID = LookupBID(BIDptr);
if (BID) if (BID)
{ {
BBSputs(conn, "Rejected - Duplicate BID\r"); BBSputs(conn, "Rejected - Duplicate BID\r");
return; return;
} }
}
conn->TempMsg = zalloc(sizeof(struct MsgInfo)); conn->TempMsg = zalloc(sizeof(struct MsgInfo));
conn->Flags |= GETTINGSYNCMESSAGE;
BBSputs(conn, "OK\r"); BBSputs(conn, "OK\r");
return; return;
} }
if (memcmp(Buffer, "TR RequestSync_", 15) == 0) if (memcmp(Buffer, "BYE\r", 4) == 0)
{
char *ptr1, *ptr2, *context;
// TR RequestSync_G8BPQ_14 224 417 0 True
WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
ptr1 = strtok_s(&Buffer[15], " ", &context); // MID
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncCompressedLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncXMLLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncMsgLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->TempMsg = zalloc(sizeof(struct MsgInfo));
BBSputs(conn, "OK\r");
return;
}
if (memcmp(Buffer, "TR Delivered_", 13) == 0)
{
char *ptr1, *ptr2, *context;
// TR RequestSync_G8BPQ_14 224 417 0 True
WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
ptr1 = strtok_s(&Buffer[13], " ", &context); // MID
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncCompressedLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncXMLLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncMsgLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->TempMsg = zalloc(sizeof(struct MsgInfo));
BBSputs(conn, "OK\r");
return;
}
if (memcmp(Buffer, "TR Remove_", 10) == 0)
{
char *ptr1, *ptr2, *context;
// TR RequestSync_G8BPQ_14 224 417 0 True
WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
ptr1 = strtok_s(&Buffer[10], " ", &context); // MID
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncCompressedLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncXMLLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->SyncMsgLen = atoi(ptr2);
ptr2 = strtok_s(NULL, " ", &context);
conn->TempMsg = zalloc(sizeof(struct MsgInfo));
BBSputs(conn, "OK\r");
return;
}
if (strcmp(Buffer, "BYE\r") == 0)
{ {
WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS); WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
conn->CloseAfterFlush = 20; // 2 Secs
conn->BBSFlags &= ~SYNCMODE; conn->BBSFlags &= ~SYNCMODE;
return; return;
} }
@ -13866,41 +13896,14 @@ void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer
return; return;
} }
// Data WriteLogLine(conn, '<', Buffer, len-1, LOG_BBS);
WriteLogLine(conn, '<', "Unexpected SYNC Message", 23, LOG_BBS);
if ((conn->TempMsg->length + len) > conn->MailBufferSize) BBSputs(conn, "BYE\r");
{
conn->MailBufferSize += 10000;
conn->MailBuffer = realloc(conn->MailBuffer, conn->MailBufferSize);
if (conn->MailBuffer == NULL)
{
BBSputs(conn, "*** Failed to extend Message Buffer\r");
conn->CloseAfterFlush = 20; // 2 Secs conn->CloseAfterFlush = 20; // 2 Secs
conn->BBSFlags &= ~SYNCMODE;
return; return;
} }
}
memcpy(&conn->MailBuffer[conn->TempMsg->length], Buffer, len);
conn->TempMsg->length += len;
if (conn->TempMsg->length >= conn->SyncCompressedLen)
{
// Complete - decompress it
conn->BBSFlags |= FBBCompressed;
Decode(conn, 1);
BBSputs(conn, "OK\r");
return;
}
return;
}
BOOL ProcessReqFile(struct MsgInfo * Msg) BOOL ProcessReqFile(struct MsgInfo * Msg)
{ {
char FN[128]; char FN[128];
@ -14059,6 +14062,232 @@ VOID SendServerReply(char * Title, char * MailBuffer, int Length, char * To)
free(MailBuffer); free(MailBuffer);
} }
void SendRequestSync(CIRCUIT * conn)
{
// Only need XML Header
char * Buffer = malloc(4096);
int Len = 0;
struct tm *tm;
char Date[32];
char MsgTime[32];
time_t Time = time(NULL);
char * Encoded;
tm = gmtime(&Time);
sprintf_s(Date, sizeof(Date), "%04d%02d%02d%02d%02d%02d",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
sprintf_s(MsgTime, sizeof(Date), "%04d/%02d/%02d %02d:%02d",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);
Len += sprintf(&Buffer[Len], "<?xml version=\"1.0\"?>\r\n");
Len += sprintf(&Buffer[Len], "<sync_record>\r\n");
Len += sprintf(&Buffer[Len], " <po_sync>\r\n");
Len += sprintf(&Buffer[Len], " <transaction_type>request_sync</transaction_type>\r\n");
Len += sprintf(&Buffer[Len], " <timestamp>%s</timestamp>\r\n", Date);
Len += sprintf(&Buffer[Len], " <originating_station>%s</originating_station>\r\n", BBSName);
Len += sprintf(&Buffer[Len], " </po_sync>\r\n");
Len += sprintf(&Buffer[Len], " <request_sync>\r\n");
Len += sprintf(&Buffer[Len], " <callsign>BBSName</callsign>\r\n");
Len += sprintf(&Buffer[Len], " <password></password>\r\n");
Len += sprintf(&Buffer[Len], " <ip_address>%s</ip_address>\r\n", conn->SyncHost);
Len += sprintf(&Buffer[Len], " <ip_port>%d</ip_port>\r\n", conn->SyncPort);
Len += sprintf(&Buffer[Len], " <note></note>\r\n");
Len += sprintf(&Buffer[Len], " </request_sync>\r\n");
Len += sprintf(&Buffer[Len], "</sync_record>\r\n");
/*
<?xml version="1.0"?>
<sync_record>
<po_sync>
<transaction_type>request_sync</transaction_type>
<timestamp>20230205100652</timestamp>
<originating_station>GI8BPQ</originating_station>
</po_sync>
<request_sync>
<callsign>GI8BPQ</callsign>
<password></password>
<ip_address>127.0.0.1</ip_address>
<ip_port>8780</ip_port>
<note></note>
</request_sync>
</sync_record>
*/
// Need to compress it
conn->SyncXMLLen = Len;
conn->SyncMsgLen = 0;
conn->SyncMessage = malloc(conn->SyncXMLLen + 4096);
conn->SyncCompressedLen = Encode(Buffer, conn->SyncMessage, conn->SyncXMLLen, 0, 1);
sprintf(Buffer, "TR RequestSync_%s_%d %d %d 0 True\r", // The True on end indicates compressed
50, conn->SyncCompressedLen, conn->SyncXMLLen);
free(Buffer);
conn->Flags |= REQUESTINGSYNC;
BBSputs(conn, Buffer);
return;
}
void ProcessSyncXML(CIRCUIT * conn, char * XML)
{
// Process XML from RMS Relay Sync
// All seem to start
//<?xml version="1.0"?>
//<sync_record>
// <po_sync>
// <transaction_type>
char * Type = strstr(XML, "<transaction_type>");
if (Type == NULL)
return;
Type += strlen("<transaction_type>");
if (memcmp(Type, "rms_location", 12) == 0)
{
return;
}
if (memcmp(Type, "request_sync", 12) == 0)
{
char * Call;
struct UserInfo * BBSREC;
// This isn't requesting a poll, it is asking to be added as a sync partner
Call = strstr(Type, "<callsign>");
if (Call == NULL)
return;
Call += 10;
strlop(Call, '<');
BBSREC = FindBBS(Call);
if (BBSREC == NULL)
return;
if (BBSREC->ForwardingInfo->Forwarding == 0)
StartForwarding(BBSREC->BBSNumber, NULL);
return;
}
if (memcmp(Type, "remove_message", 14) == 0)
{
char * MID = strstr(Type, "<MessageId>");
struct MsgInfo * Msg;
if (MID == NULL)
return;
MID += 11;
strlop(MID, '<');
strlop(MID, '@'); // sometimes has @CALL@R
if (strlen(MID) > 12)
MID[12] = 0;
Msg = FindMessageByBID(MID);
if (Msg == NULL)
return;
Logprintf(LOG_BBS, conn, '|', "Killing Msg %d %s", Msg->number, Msg->bid);
FlagAsKilled(Msg, TRUE);
return;
}
if (memcmp(Type, "delivered", 9) == 0)
{
char * MID = strstr(Type, "<MessageId>");
struct MsgInfo * Msg;
if (MID == NULL)
return;
MID += 11;
strlop(MID, '<');
strlop(MID, '@'); // sometimes has @CALL@R
if (strlen(MID) > 12)
MID[12] = 0;
Msg = FindMessageByBID(MID);
if (Msg == NULL)
return;
Logprintf(LOG_BBS, conn, '|', "Message Msg %d %s Delivered", Msg->number, Msg->bid);
return;
}
Debugprintf(Type);
return;
/*
<?xml version="1.0"?>
<sync_record>
<po_sync>
<transaction_type>request_sync</transaction_type>
<timestamp>20230205100652</timestamp>
<originating_station>GI8BPQ</originating_station>
</po_sync>
<request_sync>
<callsign>GI8BPQ</callsign>
<password></password>
<ip_address>127.0.0.1</ip_address>
<ip_port>8780</ip_port>
<note></note>
</request_sync>
</sync_record>
}
<sync_record>
<po_sync>
<transaction_type>delivered</transaction_type>
<timestamp>20230205093113</timestamp>
<originating_station>G8BPQ</originating_station>
</po_sync>
<delivered>
<MessageId>10845_GM8BPB</MessageId>
<Destination>G8BPQ</Destination>
<ForwardedTo>G8BPQ</ForwardedTo>
<DeliveredVia>3</DeliveredVia>
</delivered>
</sync_record>
Public Enum MessageDeliveryMethod
'
' Method used to deliver a message. None if the message hasn't been delivered.
'
Unspecified = -1
None = 0
Telnet = 1
CMS = 2
Radio = 3
Email = 4
End Enum
*/
}
int ReformatSyncMessage(CIRCUIT * conn) int ReformatSyncMessage(CIRCUIT * conn)
{ {
// Message has been decompressed - reformat to look like a WLE message // Message has been decompressed - reformat to look like a WLE message
@ -14090,7 +14319,6 @@ int ReformatSyncMessage(CIRCUIT * conn)
// The XML may have control info, so examine it. // The XML may have control info, so examine it.
/* /*
Date: Mon, 25 Oct 2021 10:22:00 -0000 Date: Mon, 25 Oct 2021 10:22:00 -0000
From: GM8BPQ From: GM8BPQ
@ -14117,17 +14345,19 @@ int ReformatSyncMessage(CIRCUIT * conn)
// WriteLogLine(conn, '<', conn->MailBuffer, conn->TempMsg->length, LOG_BBS); // WriteLogLine(conn, '<', conn->MailBuffer, conn->TempMsg->length, LOG_BBS);
// display the xml for testing // display the message for testing
conn->MailBuffer[conn->TempMsg->length] = 0;
// OutputDebugString(conn->MailBuffer);
memcpy(xml, conn->MailBuffer, conn->SyncXMLLen); memcpy(xml, conn->MailBuffer, conn->SyncXMLLen);
xml[conn->SyncXMLLen] = 0; xml[conn->SyncXMLLen] = 0;
Debugprintf(xml);
if (conn->SyncMsgLen == 0) if (conn->SyncMsgLen == 0)
{ {
// No message, Just xml. Looks like a status report // No message, Just xml. Looks like a status report
ProcessSyncXML(conn, xml);
return 0; return 0;
} }
@ -14251,8 +14481,6 @@ Loop:
else else
Input = ptr + 2; Input = ptr + 2;
// Part Starts with header (content-type, etc), but skip for now
// Will check for quoted printable // Will check for quoted printable
p1 = Msgptr; p1 = Msgptr;
@ -14341,15 +14569,13 @@ Loop2:
} }
Msgptr = ptr = Input; Msgptr = ptr = Input;
i++; i++;
} continue; }
// See if more parts // See if more parts
} }
else
ptr++; ptr++;
} }
ptr++;
} }
@ -14549,7 +14775,6 @@ char * FormatSYNCMessage(CIRCUIT * conn, struct MsgInfo * Msg)
// Len += sprintf(&Buffer[Len], "X-RMS-Path: G8BPQ@2023-02-04-11:19:29\r\n"); // Len += sprintf(&Buffer[Len], "X-RMS-Path: G8BPQ@2023-02-04-11:19:29\r\n");
Len += sprintf(&Buffer[Len], "X-Relay: %s\r\n", BBSName); Len += sprintf(&Buffer[Len], "X-Relay: %s\r\n", BBSName);
Len += sprintf(&Buffer[Len], "MIME-Version: 1.0\r\n"); Len += sprintf(&Buffer[Len], "MIME-Version: 1.0\r\n");
Len += sprintf(&Buffer[Len], "Content-Type: multipart/mixed; boundary=\"%s\"\r\n", Separator); Len += sprintf(&Buffer[Len], "Content-Type: multipart/mixed; boundary=\"%s\"\r\n", Separator);
@ -14567,52 +14792,6 @@ char * FormatSYNCMessage(CIRCUIT * conn, struct MsgInfo * Msg)
free(Encoded); free(Encoded);
free(MailBuffer); free(MailBuffer);
/*
Date: Sat, 04 Feb 2023 11:19:00 +0000
From: G8BPQ
Subject: Sync Test 5
To: GM8BPQ
Message-ID: E4P6YIYGQ347
X-Source: G8BPQ
X-Location: 52.979167N, 1.125000W (GRID SQUARE)
X-RMS-Originator: G8BPQ
X-RMS-Path: G8BPQ@2023-02-04-11:19:29
X-Relay: G8BPQ
MIME-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="boundaryHjgswg=="
--boundaryHjgswg==
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message 5 with attachments
--boundaryHjgswg==
Content-Disposition: attachment; name="new1.html";
filename="new1.html"
Content-Type: attachment; name="new1.html"
Content-Transfer-Encoding: base64
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCg0KDQogIDxoZWFkPg0KICAgIDx0aXRsZT4NCiAgICAg
IENvbnNwaXJhY3kgVGhlb3JpZXMNCiAgICA8L3RpdGxlPg0KICA8L2hlYWQ+DQogIDxib2R5Pg0K
ICAgIDxkaXYgc3R5bGU9J3RleHQtYWxpZ246IGNlbnRlcjsnPjxkaXYgc3R5bGU9J2Rpc3BsYXk6
IGlubGluZS1ibG9jazsnPjxzcGFuIHN0eWxlPSdkaXNwbGF5OmJsb2NrOyB0ZXh0LWFsaWduOiBs
ZWZ0Oyc+DQoJICBhYWFhYWE8YnI+DQogICAgICBiYjxicj4NCiAgICAgIGNjY2NjY2NjYyBjY2Nj
Y2NjY2NjY2NjPGJyPg0KCSAgPC9zcGFuPg0KICAgICAgPC9kaXY+DQogICAgPC9kaXY+DQogIDwv
Ym9keT4NCjwvaHRtbD4=
--boundaryHjgswg==--
*/
return Buffer; return Buffer;
} }

View File

@ -1105,7 +1105,9 @@
// Fix displaying help and info files with crlf line endings on Linux (28) // Fix displaying help and info files with crlf line endings on Linux (28)
// Improve validation of extended FC message (32) // Improve validation of extended FC message (32)
// Improve WP check for SYSTEM as a callsihn (33) // Improve WP check for SYSTEM as a callsihn (33)
// Improvements to RMS Relay SYNC mode ( // Improvements to RMS Relay SYNC mode (47)
// Fix BID Hold and Reject filters
#include "bpqmail.h" #include "bpqmail.h"

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="HPLAPTOP"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="HPLAPTOP"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -1144,6 +1144,10 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Add PHG to APRS beacons (45) // Add PHG to APRS beacons (45)
// Dont send DM to stations in exclude list(45) // Dont send DM to stations in exclude list(45)
// Improvements to RMS Relay SYNC Mode (46) // Improvements to RMS Relay SYNC Mode (46)
// Check L4 connects against EXCLUDE list (47)
// Add vaidation of LOC in WL2K Session Reports (49)
// Change gpsd support for compatibility with Share Gps (50)
#define CKernel #define CKernel

View File

@ -61,7 +61,7 @@ int RestartTNC(struct TNCINFO * TNC);
char * GetChallengeResponse(char * Call, char * ChallengeString); char * GetChallengeResponse(char * Call, char * ChallengeString);
VOID __cdecl Debugprintf(const char * format, ...); VOID __cdecl Debugprintf(const char * format, ...);
VOID FromLOC(char * Locator, double * pLat, double * pLon); int FromLOC(char * Locator, double * pLat, double * pLon);
BOOL ToLOC(double Lat, double Lon , char * Locator); BOOL ToLOC(double Lat, double Lon , char * Locator);
int GetPosnFromAPRS(char * Call, double * Lat, double * Lon); int GetPosnFromAPRS(char * Call, double * Lat, double * Lon);
@ -780,8 +780,10 @@ IdTag (random alphanumeric, 12 chars)
if (LOC[0] && ADIF->LOC[0]) if (LOC[0] && ADIF->LOC[0])
{ {
FromLOC(LOC, &myLat, &myLon); if (FromLOC(LOC, &myLat, &myLon) == 0) // Basic checks on LOCs
FromLOC(ADIF->LOC, &Lat, &Lon); return TRUE;
if (FromLOC(ADIF->LOC, &Lat, &Lon) == 0)
return TRUE;
Dist = (int)Distance(myLat, myLon, Lat, Lon, TRUE); Dist = (int)Distance(myLat, myLon, Lat, Lon, TRUE);
intBearing = (int)Bearing(Lat, Lon, myLat, myLon); intBearing = (int)Bearing(Lat, Lon, myLat, myLon);

View File

@ -2623,7 +2623,7 @@ doHeader:
else else
Compressed = _REPLYBUFFER; Compressed = _REPLYBUFFER;
HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nContent-Type: Text\r\n%s\r\n", ReplyLen, Encoding); HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %d\r\nContent-Type: Text\r\n%s\r\n", ReplyLen, Encoding);
sendandcheck(sock, Header, HeaderLen); sendandcheck(sock, Header, HeaderLen);
sendandcheck(sock, Compressed, ReplyLen); sendandcheck(sock, Compressed, ReplyLen);
@ -4359,7 +4359,7 @@ void ProcessWebmailWebSockThread(void * conn)
{ {
if (Sent > 0) // something sent if (Sent > 0) // something sent
{ {
InputLen -= Sent; ReplyLen -= Sent;
memmove(_REPLYBUFFER, &_REPLYBUFFER[Sent], ReplyLen); memmove(_REPLYBUFFER, &_REPLYBUFFER[Sent], ReplyLen);
} }

View File

@ -1295,11 +1295,20 @@ VOID CONNECTREQUEST(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, UINT Appl
char BPQPARAMS[10]; // Extended Connect Params from BPQ Node char BPQPARAMS[10]; // Extended Connect Params from BPQ Node
int CONERROR; int CONERROR;
int Index; int Index;
char xxx[16] = "";
memcpy(BPQPARAMS, &L4T1, 2); // SET DEFAULT T1 IN CASE NOT FROM ANOTHER BPQ NODE memcpy(BPQPARAMS, &L4T1, 2); // SET DEFAULT T1 IN CASE NOT FROM ANOTHER BPQ NODE
BPQPARAMS[2] = 0; // 'SPY' NOT SET BPQPARAMS[2] = 0; // 'SPY' NOT SET
ConvFromAX25(&L3MSG->L4DATA[1], xxx);
if (CheckExcludeList(&L3MSG->L4DATA[1]) == 0)
{
SendConNAK(LINK, L3MSG);
return;
}
if (FINDCIRCUIT(L3MSG, &L4, &Index)) if (FINDCIRCUIT(L3MSG, &L4, &Index))
{ {
// SESSION EXISTS - ASSUME RETRY AND SEND ACK // SESSION EXISTS - ASSUME RETRY AND SEND ACK

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="HPLAPTOP"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="HPLAPTOP"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -2577,6 +2577,7 @@ nosocks:
if (P2[0]) if (P2[0])
{ {
sockptr->CMSSession = FALSE;
STREAM->Connecting = TRUE; STREAM->Connecting = TRUE;
STREAM->ConnectionInfo->SyncMode = TRUE; STREAM->ConnectionInfo->SyncMode = TRUE;
TCPConnect(TNC, TCP, STREAM, P2, atoi(P3), TRUE); TCPConnect(TNC, TCP, STREAM, P2, atoi(P3), TRUE);
@ -3205,6 +3206,7 @@ int Socket_Accept(struct TNCINFO * TNC, SOCKET SocketId, int Port)
TNC->Streams[n].FramesQueued = 0; TNC->Streams[n].FramesQueued = 0;
sockptr->HTTPMode = FALSE; sockptr->HTTPMode = FALSE;
sockptr->SyncMode = FALSE;
sockptr->DRATSMode = FALSE; sockptr->DRATSMode = FALSE;
sockptr->FBBMode = FALSE; sockptr->FBBMode = FALSE;
sockptr->RelayMode = FALSE; sockptr->RelayMode = FALSE;
@ -4273,6 +4275,9 @@ int DataSocket_ReadSync(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
strcpy(sockptr->Callsign, call); strcpy(sockptr->Callsign, call);
call --;
*(call) = ' ';
sockptr->UserPointer = &SyncUser; sockptr->UserPointer = &SyncUser;
SendtoNode(TNC, sockptr->Number, TCP->SyncAPPL, (int)strlen(TCP->SyncAPPL)); SendtoNode(TNC, sockptr->Number, TCP->SyncAPPL, (int)strlen(TCP->SyncAPPL));
@ -5469,6 +5474,7 @@ int Telnet_Connected(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, SOCK
sockptr->FBBMode = TRUE; sockptr->FBBMode = TRUE;
sockptr->RelayMode = FALSE; sockptr->RelayMode = FALSE;
sockptr->ClientSession = FALSE; sockptr->ClientSession = FALSE;
sockptr->SyncMode = FALSE;
if (TCP->CMS) if (TCP->CMS)
SaveCMSHostInfo(TNC->Port, TNC->TCPInfo, sockptr->CMSIndex); SaveCMSHostInfo(TNC->Port, TNC->TCPInfo, sockptr->CMSIndex);
@ -5500,7 +5506,10 @@ int Telnet_Connected(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, SOCK
if (sockptr->SyncMode) if (sockptr->SyncMode)
{ {
buffptr->Len = sprintf(&buffptr->Data[0], "*** Connected to SYNC\r"); char Addr[256];
Tel_Format_Addr(sockptr, Addr);
buffptr->Len = sprintf(&buffptr->Data[0], "*** Connected to SYNC %s:%d\r", Addr, htons(sockptr->sin.sin_port));
send(sockptr->socket, sockptr->Signon, (int)strlen(sockptr->Signon), 0); send(sockptr->socket, sockptr->Signon, (int)strlen(sockptr->Signon), 0);
} }
else else
@ -6195,12 +6204,12 @@ int TCPConnect(struct TNCINFO * TNC, struct TCPINFO * TCP, struct STREAMINFO * S
// Resolve Name if needed // Resolve Name if needed
destaddr.sin_family = AF_INET; sockptr->sin.sin_family = AF_INET;
destaddr.sin_port = htons(Port); sockptr->sin.sin_port = htons(Port);
destaddr.sin_addr.s_addr = inet_addr(Host); sockptr->sin.sin_addr.s_addr = inet_addr(Host);
if (destaddr.sin_addr.s_addr == INADDR_NONE) if (sockptr->sin.sin_addr.s_addr == INADDR_NONE)
{ {
struct hostent * HostEnt; struct hostent * HostEnt;
@ -6219,7 +6228,7 @@ int TCPConnect(struct TNCINFO * TNC, struct TCPINFO * TCP, struct STREAMINFO * S
struct in_addr addr; struct in_addr addr;
addr.s_addr = *(u_long *) HostEnt->h_addr_list[i++]; addr.s_addr = *(u_long *) HostEnt->h_addr_list[i++];
} }
memcpy(&destaddr.sin_addr.s_addr, HostEnt->h_addr, 4); memcpy(&sockptr->sin.sin_addr.s_addr, HostEnt->h_addr, 4);
} }
ioctl (sockptr->socket, FIONBIO, &param); ioctl (sockptr->socket, FIONBIO, &param);
@ -6245,7 +6254,7 @@ int TCPConnect(struct TNCINFO * TNC, struct TCPINFO * TCP, struct STREAMINFO * S
} }
if (connect(sockptr->socket,(struct sockaddr *) &destaddr, sizeof(destaddr)) == 0) if (connect(sockptr->socket,(struct sockaddr *) &sockptr->sin, sizeof(destaddr)) == 0)
{ {
// //
// Connected successful // Connected successful
@ -6941,6 +6950,7 @@ int DoRefreshWebMailIndex();
int RefreshWebMailIndex() int RefreshWebMailIndex()
{ {
DoRefreshWebMailIndex(); DoRefreshWebMailIndex();
return 0;
} }
#else #else

View File

@ -266,6 +266,19 @@ void RegisterAPPLCalls(struct TNCINFO * TNC, BOOL Unregister)
memset(AGW->TXHeader.callfrom, 0, 10); memset(AGW->TXHeader.callfrom, 0, 10);
strcpy(AGW->TXHeader.callfrom, Appl); strcpy(AGW->TXHeader.callfrom, Appl);
send(TNC->TCPSock,(const char FAR *)&AGW->TXHeader,AGWHDDRLEN,0); send(TNC->TCPSock,(const char FAR *)&AGW->TXHeader,AGWHDDRLEN,0);
memcpy(Appl, APPL->APPLALIAS_TEXT, 10);
ptr=strchr(Appl, ' ');
if (ptr)
*ptr = 0;
if (Appl[0])
{
memset(AGW->TXHeader.callfrom, 0, 10);
strcpy(AGW->TXHeader.callfrom, Appl);
send(TNC->TCPSock,(const char FAR *)&AGW->TXHeader,AGWHDDRLEN,0);
}
} }
} }
} }

View File

@ -10,14 +10,14 @@
#endif #endif
#define KVers 6,0,23,46 #define KVers 6,0,23,51
#define KVerstring "6.0.23.46\0" #define KVerstring "6.0.23.51\0"
#ifdef CKernel #ifdef CKernel
#define Vers KVers #define Vers KVers
#define Verstring KVerstring #define Verstring KVerstring
#define Datestring "January 2023" #define Datestring "March 2023"
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring #define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
#define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0" #define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0"
#define VerDesc "BPQ32 Switch\0" #define VerDesc "BPQ32 Switch\0"

View File

@ -274,6 +274,8 @@ typedef struct ConnectionInfo_S
int SyncCompressedLen; int SyncCompressedLen;
int SyncXMLLen; int SyncXMLLen;
int SyncMsgLen; int SyncMsgLen;
char * SyncHost; // Saved so can send "request sync"
int SyncPort;
UCHAR * SyncMessage; // Compressed SYNC message to send UCHAR * SyncMessage; // Compressed SYNC message to send
// These are used to detect CRLF split over a packet boundary // These are used to detect CRLF split over a packet boundary
@ -296,7 +298,9 @@ typedef struct ConnectionInfo_S
#define SENDBODY 128 #define SENDBODY 128
#define WAITPROMPT 256 // Waiting for prompt after message #define WAITPROMPT 256 // Waiting for prompt after message
#define PROPOSINGSYNCMSG 512 // Sent proposal to SYNC, waiting response #define PROPOSINGSYNCMSG 512 // Sent proposal to SYNC, waiting response
#define SENDINGSYNCMSG 1024 // Sent messagr to SYNC, waiting response #define SENDINGSYNCMSG 1024 // Sent message to SYNC, waiting response
#define REQUESTINGSYNC 2048
#define GETTINGSYNCMESSAGE 4096 // Receiving body of a SYNC message
// BBSFlags Equates // BBSFlags Equates

Binary file not shown.