From 1f40ff4a07793ecfa679a1384053451c4f3f536f Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Tue, 22 Jul 2025 20:56:59 +0100 Subject: New upstream version 6.0.24.77+repack --- BBSUtilities.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 111 insertions(+), 17 deletions(-) (limited to 'BBSUtilities.c') diff --git a/BBSUtilities.c b/BBSUtilities.c index 72a2371..90b4c7b 100644 --- a/BBSUtilities.c +++ b/BBSUtilities.c @@ -69,6 +69,10 @@ extern BPQVECSTRUC ** BPQHOSTVECPTR; UCHAR * GetLogDirectory(); DllExport int APIENTRY SessionStateNoAck(int stream, int * state); int RefreshWebMailIndex(); +struct PORTCONTROL * GetPortTableEntryFromSlot(int portslot); +int GetPortHardwareType(struct PORTCONTROL *PORT); +int GetNumberofPorts(); + #else __declspec(dllimport) BPQVECSTRUC ** BPQHOSTVECPTR; typedef char * (WINAPI FAR *FARPROCZ)(); @@ -2085,6 +2089,7 @@ hold certain types or sizes of messages. The first letter of each valid line specifies the action : +A = Accept : Message is accepted without checking other filters R = Reject : The message will not be received. H = Hold : The message will be received but held until the sysop reviews. L = Local Hold : Only messages created on this BBS will be held. @@ -2179,21 +2184,38 @@ BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type while (p) { - if (p->Action != 'R') + if (p->Action != 'R' && p->Action != 'A') goto Continue; if (p->Type != Type && p->Type != '*') goto Continue; + // wildcardcompare returns true on a match + if (wildcardcompare(From, p->From) == 0) goto Continue; - if (wildcardcompare(ToCopy, p->TO) == 0) - goto Continue; + if (p->TO[0] == '!') + { + if (wildcardcompare(ToCopy, &p->TO[1]) == 1) + goto Continue; + } + else + { + if (wildcardcompare(ToCopy, p->TO) == 0) + goto Continue; + } if (ATBBS) - if (wildcardcompare(ATBBS, p->AT) == 0) + { + char AtCopy[256]; + + strcpy(AtCopy, ATBBS); + _strupr(AtCopy); + + if (wildcardcompare(AtCopy, p->AT) == 0) goto Continue; + } if (BID) if (wildcardcompare(BID, p->BID) == 0) @@ -2202,6 +2224,11 @@ BOOL CheckRejFilters(char * From, char * To, char * ATBBS, char * BID, char Type if (p->MaxLen && Len < p->MaxLen) goto Continue; + // if type 'A' matches all rules then accept without checking rest + + if (p->Action == 'A') + return FALSE; + return TRUE; // Hold Continue: @@ -2244,6 +2271,7 @@ BOOL CheckHoldFilters(struct MsgInfo * Msg, char * From, char * To, char * ATBBS { char ** Calls; FBBFilter * p = Filters; + char ToCopy[256]; if (HoldFrom && From) { @@ -2307,6 +2335,9 @@ BOOL CheckHoldFilters(struct MsgInfo * Msg, char * From, char * To, char * ATBBS // check fbb reject.sys type filters + strcpy(ToCopy, To); + _strupr(ToCopy); + while (p) { if (p->Action != 'H') @@ -2318,9 +2349,16 @@ BOOL CheckHoldFilters(struct MsgInfo * Msg, char * From, char * To, char * ATBBS if (wildcardcompare(Msg->from, p->From) == 0) goto Continue; - if (wildcardcompare(Msg->to, p->TO) == 0) - goto Continue; - + if (p->TO[0] == '!') + { + if (wildcardcompare(ToCopy, &p->TO[1]) == 1) + goto Continue; + } + else + { + if (wildcardcompare(ToCopy, p->TO) == 0) + goto Continue; + } if (wildcardcompare(Msg->via, p->AT) == 0) goto Continue; @@ -3388,6 +3426,7 @@ void Flush(CIRCUIT * conn) SendUnbuffered(conn->BPQStream, &conn->OutputQueue[conn->OutputGetPointer], len); conn->OutputGetPointer+=len; + conn->bytesSent += len; tosend-=len; SendUnbuffered(conn->BPQStream, "bort, Continue..>", 25); FreeSemaphore(&OutputSEM); @@ -3399,6 +3438,7 @@ void Flush(CIRCUIT * conn) } SendUnbuffered(conn->BPQStream, &conn->OutputQueue[conn->OutputGetPointer], len); + conn->bytesSent += len; conn->OutputGetPointer+=len; @@ -5216,7 +5256,6 @@ char * CheckToAddress(CIRCUIT * conn, char * Addr) return NewAddr; } } - else { WPRecP WP = LookupWP(Addr); @@ -5437,7 +5476,18 @@ BOOL DecodeSendParams(CIRCUIT * conn, char * Context, char ** From, char *To, ch } else { - conn->LocalMsg = TRUE; + // See if a WP entry + + WP = LookupWP(To); + + if (WP) + { + *ATBBS = WP->first_homebbs; + nodeprintf(conn, "Address @%s added from WP\r", *ATBBS); + conn->LocalMsg = FALSE; + } + else + conn->LocalMsg = TRUE; } } else @@ -9016,6 +9066,10 @@ CheckForSID: return TRUE; } +#ifndef LINBPQ +extern FARPROCX pGetPortHardwareType; +#endif + VOID Parse_SID(CIRCUIT * conn, char * SID, int len) { ChangeSessionIdletime(conn->BPQStream, BBSIDLETIME); // Default Idletime for BBS Sessions @@ -9072,10 +9126,44 @@ VOID Parse_SID(CIRCUIT * conn, char * SID, int len) { // We should really only do this on Telnet Connections, as OpenBCM flag is used to remove relnet transparency + // See if Telnet + + struct PORTCONTROL * PORT; + char Call[11] = ""; + int port, dummy; + + GetConnectionInfo(conn->BPQStream, Call, &port, &dummy, &dummy, &dummy, &dummy); + + PORT = GetPortTableEntryFromSlot(0); // Get first entry + + do + { + if (PORT->PORTNUMBER == port) + break; + + PORT=PORT->PORTPOINTER; + + } while (PORT); + +#define H_TELNET 6 + +#ifndef LINBPQ + + if (pGetPortHardwareType) + { + if (PORT && GetPortHardwareType(PORT) == H_TELNET) + conn->OpenBCM = TRUE; + } + else + conn->OpenBCM = TRUE; // Old Node version so follow old behavoiur and treat all as telnet +#else + if (PORT && GetPortHardwareType(PORT) == H_TELNET) + conn->OpenBCM = TRUE; +#endif - conn->OpenBCM = TRUE; } + if (_memicmp(SID, "PMS-3.2", 7) == 0) { // Paccom TNC that doesn't send newline prompt ater receiving subject @@ -10245,7 +10333,7 @@ BOOL GetConfig(char * ConfigName) GetStringValue(group, "ISPAccountPass", EncryptedISPAccountPass, 100); sprintf(SignoffMsg, "73 de %s\r", BBSName); // Default - GetStringValue(group, "SignoffMsg", ISPAccountName, 50); + GetStringValue(group, "SignoffMsg", SignoffMsg, 50); DecryptPass(EncryptedISPAccountPass, ISPAccountPass, (int)strlen(EncryptedISPAccountPass)); @@ -10550,7 +10638,7 @@ int Connected(int Stream) char callsign[10]; int port, paclen, maxframe, l4window; char ConnectedMsg[] = "*** CONNECTED "; - char Msg[100]; + char Msg[256]; char Title[100]; int64_t Freq = 0; int Mode = 0; @@ -10633,7 +10721,13 @@ int Connected(int Stream) } } } - + + if (Mode < 0 || Mode > 54) + Mode = 0; + + if (Freq < 0 || Freq > 11000000000) + Freq = 0; + memset(conn, 0, sizeof(ConnectionInfo)); // Clear everything conn->Active = TRUE; conn->BPQStream = Stream; @@ -10698,7 +10792,7 @@ int Connected(int Stream) LongFreq = GetPortFrequency(port, FreqString); #endif } - Length += sprintf(MailBuffer, "New User %s Connected to Mailbox on Port %d Freq %d Mode %ld\r\n", callsign, port, LongFreq, Mode); + Length += sprintf(MailBuffer, "New User %s Connected to Mailbox on Port %d Freq %lld Mode %d\r\n", callsign, port, LongFreq, Mode); sprintf(Title, "New User %s", callsign); @@ -10758,10 +10852,10 @@ int Connected(int Stream) } if (port) - n=sprintf_s(Msg, sizeof(Msg), "Incoming Connect from %s on Port %d Freq %d Mode %s", + n = sprintf_s(Msg, sizeof(Msg), "Incoming Connect from %s on Port %d Freq %lld Mode %s", user->Call, port, Freq, WL2KModes[Mode]); 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 (Unless Sync) @@ -11051,7 +11145,6 @@ int DoReceivedData(int Stream) if (Stream == conn->BPQStream) { conn->SIDResponseTimer = 0; // Got a message, so cancel timeout. - do { // May have several messages per packet, or message split over packets @@ -11068,6 +11161,7 @@ int DoReceivedData(int Stream) if (InputLen == 0 && conn->InputMode != 'Y') return 0; + conn->bytesRxed += InputLen; conn->InputLen += InputLen; if (conn->InputLen == 0) return 0; -- cgit v1.2.3