• src/sbbs3/websrvr.cpp

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Tuesday, August 04, 2026 22:12:21
    https://gitlab.synchro.net/main/sbbs/-/commit/0ca5676148730160b440cf02
    Modified Files:
    src/sbbs3/websrvr.cpp
    Log Message:
    websrvr: always read the file header when resolving a file-vpath request

    4de1032086 (payroll-20-queue, 2026-08-01) skipped the header record for
    a file in a free directory, on the grounds that loadfile() zeroes the
    cost there and download_is_free() short-circuits on the same flag before
    any credit comparison.

    The cost is not the only field that comes from the header. The index
    record stores the filename truncated to SMB_FILEIDX_NAMELEN (64 bytes, extension preserved), and smb_getfile() points file.name at it, so at
    index detail file.name was that truncated form. Names longer than the
    limit are not hypothetical: one in this file base is 78 characters. The
    name reaches user_downloaded_file(), which embeds it in the uploader's
    "file downloaded" notification, and mqtt_file_download(), which
    publishes it.

    The transfer and the credit accounting survived it, because deriving an
    index name from an already-truncated one is idempotent and the record
    still resolved, but the name recorded and announced was wrong.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-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, August 08, 2026 18:05:04
    https://gitlab.synchro.net/main/sbbs/-/commit/0791f3e3bfcdb04afeda7134
    Modified Files:
    src/sbbs3/websrvr.cpp
    Log Message:
    Don't hand a CGI the web server's descriptors (#1174)

    The CGI child sets up stdin, stdout and stderr and then execs with everything else this process had open still in hand. Close the rest, as externals now
    do. Nothing above stderr is a CGI's business: the client socket it reads
    from, where it has one, has already been duplicated onto stdin.

    Verified against a listen socket left deliberately inheritable, standing in
    for the descriptors this cannot otherwise reach - the ones opened inside libraries, where there is no call site to mark. Before, the CGI inherited it; after, the CGI starts with stdio alone.

    The exec-failure message now goes to stderr directly, which is the pipe the parent already reads and logs as a CGI error. errprintf() is not usable after the close: it is not fork-safe, and its descriptors are among those closed.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)