• src/sbbs3/answer.cpp ftps

    From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Thu Oct 29 00:11:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/7ecf0b07863637a1259ec7fc
    Modified Files:
    src/sbbs3/answer.cpp ftpsrvr.cpp js_system.cpp login.cpp mailsrvr.cpp services.cpp userdat.c userdat.h websrvr.cpp
    Log Message:
    Report a failed user lookup as an error, not as an unknown user

    matchuser() and finduserstr() returned 0 both when no user matched and
    when name.dat or user.tab could not be opened or read, and
    find_login_id() passed that through. Every authenticating server then
    treated a lookup that never ran as a bad login: it logged "UNKNOWN
    USER" (with the password when Echo Password is on), counted a failed
    attempt against the client, and at the filter threshold banned its IP.
    The SMTP recipient lookup bounced mail with a permanent 550 the same
    way. A short read of name.dat returned a bogus user number.

    The scanning bodies are now matchuser_ex() and finduserstr_ex(), which
    return a USER_* error code when the user base could not be searched; matchuser() and finduserstr() clamp that to 0 so their other callers
    and system.matchuser() are unchanged. find_login_id() propagates the
    error, and system.find_login_id() clamps it for scripts. The login
    paths in the mail, FTP, web, Services and terminal servers log the
    error at LOG_ERR and answer with a temporary failure (-ERR [SYS/TEMP],
    454 4.7.0, 451 4.3.0, 421) without calling badlogin(); the SSH path no
    longer starts new-user registration on one.

    Seen on vert on 2026-10-27 when a handle leak (c42d0dc07c) exhausted
    the process's stdio streams: for four hours every real login was
    reported as an unknown user and a mail client retrying a valid
    account was banned for 90 days. Closes #1307.

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Wed Nov 11 13:04:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/87e3a065c359a7c846f1e7e4
    Modified Files:
    src/sbbs3/answer.cpp ftpsrvr.cpp login.cpp mailsrvr.cpp upload.cpp
    Log Message:
    Check getuserdat() results where a failure was silently ignored

    getuserdat() zeroes user->number on failure (e.g. a user record lock
    timeout) and leaves the other fields as they were. Several callers
    ignored the result, so a transient read error was misreported or acted
    on with data never read:

    - ftpsrvr: the per-command refresh of the logged-in user's record set
    user.number to 0, so every following command failed with "530 Please
    login". Keep the session's existing user data and log the error.
    - login(): the user was treated as unknown, counting as a failed login
    attempt (toward the failed-login filter). Log the read error and fail
    the login the same way a failed user-base lookup already does.
    - RLogin: the password was checked against a record that wasn't read,
    so a valid user could be logged and counted as a failed password
    attempt and disconnected. A failed find_login_id() lookup was likewise
    logged as an unknown user and counted by badlogin(). Log the error and
    fall through to the interactive login instead.
    - mailsrvr: SMTP authentication by IP address turned a read failure into
    a permanent "ILLEGAL RELAY ATTEMPT" refusal; answer 451 instead, as the
    authenticated-relay check now does.
    - User-to-user upload: user_can_download() evaluated an uninitialized
    user_t when the recipient's record couldn't be read. Report the error
    and skip that recipient.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>