• src/sbbs3/mailsrvr.cpp

    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 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/1728d248fb27d5d1cf0737e9
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    mailsrvr: POP3 LIST/UIDL skips unreadable messages instead of stopping

    In the POP3 LIST and UIDL (all messages) loop, a failure to read a
    message's index entry, lock its header, or read its header ended the
    listing early. Every message after the bad one was then missing from
    the client's view of the mailbox. Skip just the bad message instead:
    the error is still logged, and the other messages keep their POP3
    numbers, so RETR and DELE still work on them. A failed socket write
    still ends the loop.

    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)
  • From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Saturday, November 21, 2026 11:03:05
    https://gitlab.synchro.net/main/sbbs/-/commit/808eb8cd0faf3682b5302148
    Modified Files:
    src/sbbs3/mailsrvr.cpp
    Log Message:
    mailsrvr: a delivery-failure notice names the failed message

    bounce() copied the failed message into the notice, so the notice's
    Message-ID was the failed message's own ID (or, when that had none, an
    ID derived from the failed message's number and time), and it carried
    no reply-ID. A mail client could not tell which sent message a notice
    was about, nor thread the notice under it.

    The notice now gets a Message-ID of its own, derived from a fresh
    message number, and the failed message's Message-ID as its reply-ID.
    When the failed message has no Message-ID the notice has no reply-ID.
    The guards against bouncing a notice are untouched.

    Verified by reading and compiling only; there is no automated test for
    this path. Built with GCC only.

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