• src/sbbs3/mailsrvr.cpp

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Wednesday, September 30, 2026 19:08:47
    https://gitlab.synchro.net/main/sbbs/-/commit/c6c715a40a2556421292cdc8
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    Mail Server: don't log POP3 passwords or SMTP AUTH credentials

    Fixes #1267

    With the receive/response debug options on, the mail server logged the
    POP3 PASS line, the SMTP AUTH LOGIN username and password responses, the
    AUTH PLAIN response (all base64, trivially decoded), and the AUTH PLAIN
    initial response on the command line was logged at LOG_DEBUG regardless of options. The "!Bad AUTH ..." notices logged the raw argument at NOTICE
    level. Anyone who could read the log could recover every password used to authenticate to the server.

    Redact those lines unless the sysop has set the "Echo Passwords Locally"
    system option (SM_ECHO_PW), the way the password-failure messages already
    honor it: a received command line is logged through loggable_line(), which replaces a POP3 password or an AUTH initial response with a placeholder,
    and a line that is nothing but credentials (an AUTH response) is logged as "<credentials>".

    Verified on a scratch mail server with the debug options on: POP3 USER/PASS, AUTH PLAIN (initial response and challenge forms), AUTH LOGIN and a
    malformed AUTH LOGIN argument all authenticate or fail as before, and the
    log holds no trace of the password in clear or base64; with SM_ECHO_PW set
    the lines are logged in full, as before.

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    --- SBBSecho 3.38-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 Tuesday, October 13, 2026 23:29:30
    https://gitlab.synchro.net/main/sbbs/-/commit/d4f33e47976414b619032701
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    mailsrvr: stop sending the message after a body line fails to send

    When a send failed partway through the message body, sockmimetext()
    broke out of the body loop but still went on to MIME-encode any
    attachments and send the "." end-of-data terminator over the dead
    connection. With DKIM signing enabled, that terminator finalized the
    verify pass's body hash over the truncated body, so every dropped
    connection mid-DATA was also logged as the error "DKIM body hash changed between sign and send - message delivery aborted", though nothing had
    changed and the delivery had already failed.

    Return as soon as a body line fails to send, as is already done when the
    header terminator fails.

    Fixes #1279

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    --- SBBSecho 3.38-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 Monday, October 26, 2026 00:05:59
    https://gitlab.synchro.net/main/sbbs/-/commit/dd868cf96f01d669158e480b
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    Mail server: keep the mailproc script's callback struct alive with its context

    Fixes a crash in sbbs.dll (remove_js_socket_event) when an SMTP client
    thread ends.

    b43e1c8256 (2009-01-14) made js_mailproc() reuse one JS runtime, context
    and global object per SMTP client thread, created on the first mailproc
    and destroyed only when the thread ends, but left its js_callback_t as a
    local of js_mailproc(). The "js" object and the client.socket Socket
    object created in that persistent global recorded a pointer to the local,
    which was gone as soon as the first js_mailproc() call returned.

    Nothing followed that stale pointer after the call until 85e04a4262 (2026-09-30) made every Socket object remember its script's callback
    struct at creation and consult it when closed. From then on, destroying
    the context at thread end finalized client.socket, do_js_close() walked
    the event list of a js_callback_t that was a dead stack frame, and the
    mail server crashed with an access violation.

    Move the js_callback_t to smtp_client_thread(), beside the runtime,
    context and global, and pass it to js_mailproc(). It is still zeroed and
    given the logger on each invocation, as before.

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    --- SBBSecho 3.38-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 Wednesday, November 11, 2026 13:04:30
    https://gitlab.synchro.net/main/sbbs/-/commit/59bb834db75f09c19a9bfd0c
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    mailsrvr: don't treat a failed user re-read as an unauthenticated client

    When an authenticated SMTP client sent to an external address, the relay
    check re-read the user's record with getuserdat() and ignored the result. getuserdat() zeroes user->number on failure, so a transient error such as
    a user record lock timeout made the session unauthenticated: the RCPT was refused as an "ILLEGAL RELAY ATTEMPT" (553/550, a permanent failure) and
    the rest of the session ran without the user. The emails-per-day check
    re-read the record the same way.

    Re-read into a copy that only replaces the session's user record on
    success, and answer a failure with a 451 temporary error so the client
    retries.

    Seen with GitLab's notification mail: concurrent sessions for the same
    user stalled ~105 seconds in lockuserdat() and one was rejected as an
    illegal relay.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    --- SBBSecho 3.38-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 Friday, November 13, 2026 20:51:10
    https://gitlab.synchro.net/main/sbbs/-/commit/80c2a8b975ed9eeb70bea54f
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    mailsrvr: don't apply the request rate limit to POP3 commands

    Every command received in the POP3 TRANSACTION state was counted
    against the request rate limiter, so an authenticated client with a
    large mailbox (e.g. RETR + DELE for each of 250 messages) exceeded a
    500 request limit and was disconnected with "-ERR too many requests,
    try again later", logged as "Too many requests per rate limit".

    Those commands are only reachable after a successful login, failed
    logins are already handled by the login attempt filter, and concurrent connections are already limited, so the request rate limit now applies
    only to SMTP commands.

    The POP3 check was added in c8490b7429f (2026-03-11).

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
    --- SBBSecho 3.38-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 Saturday, November 14, 2026 11:52:09
    https://gitlab.synchro.net/main/sbbs/-/commit/8195f1169c09075e219abebb
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    mailsrvr: never send a truncated POP3 LIST or UIDL listing

    The "list all" loop for LIST and UIDL stopped as soon as the mail base
    became locked, after "+OK" had been sent and before the terminating
    ".", so the client received a well-formed listing of only the first
    messages. A client that leaves mail on the server treats a message
    missing from the UIDL listing as removed, forgets it, and downloads it
    again as new on its next check: a session that collided with the
    daily e-mail purge caused 204 of 449 messages to be re-downloaded.

    The listing is now built first and sent only when every message was
    read; otherwise the reply is "-ERR" and the session ends. A failure to
    read a message's index or header also fails the listing, where before
    the message was silently left out.

    The lock check was added to the loop in 71aa48f825f (2026-01-16).

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)