• src/sbbs3/mailsrvr.c

    From rswindell@1:103/705 to CVS commit on Wed Apr 8 22:48:48 2020
    src/sbbs3 mailsrvr.c 1.720 1.721
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv4643

    Modified Files:
    mailsrvr.c
    Log Message:
    Fix bug introduced in previous commit of this file (8 months ago):
    If the RECIPIENTTOLIST header fields exists and the RFC822 header field
    does not exist, that means the original RFC822 "To" field was not MIME-encoded, which is the majority of email. The routine that converted an smbmsg_t to an RFC822 header did not use this new field however (ignored it). Whoops. So multiple recipients were reflect in the To field and the original destination address(es) in the To field weren't passed on either. Thanks, Frank!

    --- SBBSecho 3.10-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to Git commit to main/sbbs/master on Mon Feb 7 20:10:12 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/427599b46e19dc809a5fb268
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix compile issue in previous commit. <blush>
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to Git commit to main/sbbs/master on Tue Mar 1 20:30:38 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/bff956a191a7427dc0acafe4
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix host name or IP address-based smtpspy.txt loggingCaught by Coverity-scan (use of uninitialized variable, 'str') :-)
    --- SBBSecho 3.15-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to Git commit to main/sbbs/master on Mon Mar 7 17:53:40 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/304f72934c3e401e7cc92ea8
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix issue with smtpspy-listed names added in previous commitp (which is used after this) points into 'str', so we can't use 'str' as a temporary variable here.
    --- SBBSecho 3.15-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (in GitKraken)@1:103/705 to Git commit to main/sbbs/master on Tue Feb 21 16:52:12 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/ce90be9ea7fcacddfd60628c
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix corrupted RFC822 msg headers when a header field was > 1024 charsWhen sending an SMB message header via SMTP or POP3, some header fields (lines) could potentially be longer than 1024 and yet sockprintf() was limited to sending 1024 bytes (actually 1022 plus CRLF). This could result in some messages not being sent correctly: header field truncated, not CRLR-terminated, and notably resulting in MIME message contents not being decoded properly in a message viewer/reader. Example (Content-Type is part of the previous header field/line):x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cm9T1Q9G65VC/lKTTqhODKhy5lHT2y6WWMb/WyvJ+EeGEwYmY7ILhzE3yfNM?= =?us-ascii?Q?KeFWN9T/PqHBya1plKf/sHgaw0iRmI7Hq+u9Dp4bG8OqdniKQlK+Aa27oXMd?= =?us-ascii?Q?Hly6OEYaSu7jbhGGY89LF0gyRVqquqxkaMfpKvG+h4cQnnu4Tl8YAKeE39a2?= =?us-ascii?Q?lHW3372ulmb9jvvZU72J2RtZYkuoIr+Wsqhfyuj39wTZ/+C4qKCsYrmTxrki?= =?us-ascii?Q?fBZ4gMPzWkrcWAr7zPcXBg8bphJJB8VJFUjQyksA3EG4dtH8+TZeEcNNBmHf?= =?us-ascii?Q?oCGnV9wHr9HszzrSkkZ2GGyh3QZLHAVDNe7wDXSy7HJttZugf9kNqKGeaYQL?= =?us-ascii?Q?TpljH1aHPe7MiSP9Dmp/xHQ/DWQOZDx5guNS+iMciMt5p5ad+SkQye0hWRhd?= =?us-ascii?Q?usHvpllclzIee6lxJ0VSPAzHGlAOhtOolrHdDB2ODjvkEzU7L2Fj2f5x7p9q?= =?us-ascii?Q?9d6sUgSz7vZVx8yyR3KPq3jIX0QUnl0xr2Mix9xcmMNcg0yFLPcznqBdLVa8?= =?us-ascii?Q?IC7j0+8oy4BjYxr8Z3elxMC2JKq13gPYgR95cwm6hMDiZbMB4EW/J1uJhD/I?= =?us-ascii?Q?RIIqTZ+Ywt8nKOfXj6/a9Aauf0wN71QKKA+in7KY9oksIhkUGvWOrtJwkVDL?= =?us-ascii?Q?Q2UFrBBJyQHJgumj5Y+bG8FDk/55IfyV9XYEcsdLL4bCF+HX4QPHZCw4P+li?= =?us-ascii?Q?bRvN+UxOO8hgXVkgB1q8mNJ62yQuaj0AContent-Type: multipart/alternative; boundary="_000_SN6PR07MB454477F4C32C66D48BA0B02187A09SN6PR07MB4544namp_"Solved by using asprintf() instead of snprintf() for dynamic string formatting and allocation in one go. Using realloc() to expand the buffer for the appended/required CRLF.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (in GitKraken)@1:103/705 to Git commit to main/sbbs/master on Mon Feb 27 17:30:34 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/b19288125fb9470836cf50af
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Reject SMTP session from any client that sends illegally-long linesLog a warning message and send a "500 Line too long" before disconnecting any SMTP client that sends lines > 998 characters in length. Technically, we can handle lines up to 1023 characters, but then we could get out of sync with the client if it sends exactly 1023 chars and then a new-line char (which we would interpret as a blank line, separating the message header and body) - so just punt the client who doesn't obey the rules of the protocol.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Mon Feb 27 17:32:16 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/7611f92f4057dae1dd11878a
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Resolve new GCC printf-format warning in new log message text
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (in GitKraken)@1:103/705 to Git commit to main/sbbs/master on Mon Feb 27 18:33:56 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/4c6cc08369da690cae967264
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Handle illegally-long received SMTP lines betterSMTP commands have a shorter limit (510 versus 998) and the body text line limit needed to account for dot-stuffing.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Thu Mar 2 01:11:32 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/2852540e7b592e32195f03b8
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix false FORGED mail header 'FROM' field detection/rejectionPretty much any From field that contains an '@' in the username portionwas subject to comparison to the full email address, but clearly some ofthese rejected emails were not forge attempts:'Chris @ StubHub' vs 'events@mail.stubhub.com''Eric S. Raymond (@esr)' vs 'gitlab@mg.gitlab.com'Fixed by requiring that the sender name is actually a well-formed Internetemail address using smb_netaddr_type(), which was also recently improved tobe more accurate.Unrelated change: include reverse-path (email address for bounces) inILLEGALLY-LONG body and header line log messages (usually SPAM from whatI can tell).
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Sun Jun 4 11:45:28 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/fb11866c6dadbd6a8d861b77
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix potential NULL pointer deref in rblchk(), observed via segfault latelyI'm not sure why this one only started popping up now, but h_addr_list is aNULL-terminated list and it makes perfect sense that the first entry couldbe the NULL-terminator.gethostbyname is obsolete/deprecated and we should address that in a separatecommit.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on ChromeOS)@1:103/705 to Git commit to main/sbbs/master on Sun Jun 4 11:46:12 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/1f7cd77aef826d3256ae4e2e
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Check return value of fread()
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Wed Nov 1 15:23:12 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/f689169a82124f18d5e4ccd9
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Close socket after logging the "REFUSED SESSION from blacklisted server" msg

    Fixes issue #670
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Wed Dec 13 19:11:22 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/a35cb08fb0a5f69bbe11f010
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Better resource (e.g. client thread) management

    My mail server was suddenly and inexplicably creating thousands of SMTPS
    client threads, each with a unique remote IP address, and each eventually failing with the rather obscure log message (from cryptlib):
    dbg 'Cannot read item from object' (-41) setting session active

    Eventually (after not long, really), the server would run out of resources
    and fail in weird and wonderful ways (can't malloc, can't create JS runtime
    or context, etc.). The max_clients limit (100, as I have it set) wasn't being effectively-imposed on SMTPS connections.

    The root-cause: the active_clients (counter) wasn't incremented until *after* the cryptlib/TLS setup for SMTPS connections and SMTPS/TLS connections can
    take a long time to fail, resulting in a vulnerability to an effective denial of service attack.

    Raise the minimum severity of all cryptlib/TLS log messages from Debug to
    Info.

    Create wrappers for smtp_thread() [now smtp_client_thread()] and pop3_thread [now pop3_client_thread()] that handle basic resource management (thread counters, active client counters, the client socket).
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Wed Dec 13 22:26:08 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/7d9c8624f7d9c5e0fd1cd5a7
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Fix extra decrement of active_clients (added in previous commit)

    And fix some use of CRYPT_UNUSED instead of cryptlib session ID.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Thu Dec 14 16:39:04 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/f43e852a170d27afdf6e33a4
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    SMTP mail server wasn't RFC 4954 compliant for "AUTH PLAIN" logins

    The base64-encoded credentials can either be supplied with the AUTH PLAIN command or in response to a 334 server-challenge. We only supported the
    former form and logged a warning ("Missing AUTH PLAIN argument") when we received the latter. No warning is logged now and the appropriate server-challege is sent and the response accepted and base64-decoded and
    parsed as before.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Sat Dec 16 23:31:14 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/952a25f17aa96355e4c92e95
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    More commonization of "CLIENT BLOCKED" log messages
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Mon Jan 22 19:40:40 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/62b866c243d9a8201c55b6fa
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    If cryptInit() fails, just disable TLS support

    But continue initializing/running for other non-TLS protocol support.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Wed Feb 7 14:00:48 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/fa5ae01239d3488112dae489
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Some more printf formats... mostly off_t but also a size_t and an time_t
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Wed Feb 7 14:11:24 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/76055e3d35e795f4ceeefb0e
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Add missing header?
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Wed Feb 7 14:20:24 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/f44997570fb796b34f99285f
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Aha! XP_PRIsize_t is a *size*, not a *type*.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Wed Feb 7 14:35:38 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/aaa82ca4c9a5aac286603272
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Oh damn, this is an off_t + size_t + 1... talk about the wild west of types!

    Both long long and long are reasonable for some mixes of platforms.

    Just punt, cast the whole thing to int64_t, and forget about it.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Thu Feb 15 22:55:30 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/5cc3767eb1d56bb0db294f86
    Modified Files:
    src/sbbs3/mailsrvr.c
    Log Message:
    Use fnopen() for auto-retry when opening dnsbl_exempt.cfg for append
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)