• src/smblib/smblib.c

    From Rob Swindell@VERT to Git commit to main/sbbs/master on Wednesday, December 09, 2020 00:42:43
    https://gitlab.synchro.net/main/sbbs/-/commit/05104f134188b139a6f3e5ba
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    When a message has been forwarded, invalidate the "to" ext/net ptrs

    The convenience pointers to_ext and to_net need to be invalidated (nullified) if we are going to allow forwarding from local email boxes to network mail and keep all the original message header fields in tact.

    The "Forwarded" field must now be added *before* any new recipient information (local user extension or network address of the forwarding destination).

    This is part of the solution to request #83, #108, and #141.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Sunday, May 02, 2021 17:14:43
    https://gitlab.synchro.net/main/sbbs/-/commit/ba1f38cc4126d388c6a897ef
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    When adding a msg/file header, remove the DELETE attribute

    When moving or renewing files, they're first removed and then added and they were being added with the DELETE attribute set. The filenames are displayed in red when staged for deletion/removal, so that's how I noticed. Oops.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows)@VERT to Git commit to main/sbbs/master on Monday, May 08, 2023 18:07:50
    https://gitlab.synchro.net/main/sbbs/-/commit/2ee37e4ee9e91ddb2d790f72
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    Fix the relocation of enlarged message headers in smb_putmsghdr()

    The first commit of this feature would leave the base corrupted for a couple
    of reasons (.sha file wasn't opened, using modified header when re-writing the old header to set the DELETED attribute). Both fixed.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Monday, May 08, 2023 18:09:07
    https://gitlab.synchro.net/main/sbbs/-/commit/b5c5630c1ccd675a559dd98d
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    More detail in error strings in smb_getmsghdr()

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows)@VERT to Git commit to main/sbbs/master on Monday, May 08, 2023 18:16:05
    https://gitlab.synchro.net/main/sbbs/-/commit/4985797d2b07ca169326ab6f
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    Streamlined code: we need only one check for hyper-alloc'd msg base here

    No functional change.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Friday, December 29, 2023 17:10:28
    https://gitlab.synchro.net/main/sbbs/-/commit/47fe4a60247147dc217ad02b
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    Fix stale comments (msg.offset became msg.idx_offset a couple years back).

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Friday, September 13, 2024 20:08:11
    https://gitlab.synchro.net/main/sbbs/-/commit/1ab4ef2bfe0d0b1c7598cc53
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    smb_getmsgidx() now reads entire index records from file bases too

    chksmb needed this to perform filename checks (index against headers).

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Friday, September 13, 2024 20:30:10
    https://gitlab.synchro.net/main/sbbs/-/commit/ffa2c51ba23c59641e1a6e47
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    MSVC requires a 0 in the struct initializer

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Sunday, November 10, 2024 16:14:22
    https://gitlab.synchro.net/main/sbbs/-/commit/6224ce6476a079f5e1e7a880
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    Fix printf formatting issue in error message

    GCC and Coverity (x 2) both flagged this one.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Friday, January 16, 2026 20:45:33
    https://gitlab.synchro.net/main/sbbs/-/commit/5bd46a2ed2ff6bbc4aa2fb8a
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    smb_lock(): Confirm the lock file exists after closing it and a short delay

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Monday, May 11, 2026 23:57:27
    https://gitlab.synchro.net/main/sbbs/-/commit/931d45a1c1bd411af6c1c16c
    Modified Files:
    src/smblib/smblib.c
    Log Message:
    smb_new_msghdr: auto-repair small .sid/.shd status mismatches; check smb_putstatus return value

    Problem: if the .sid index file length didn't exactly match total_msgs * idxreclen, smb_new_msghdr returned SMB_ERR_FILE_LEN (-206) hard, blocking
    all further message adds until the msgbase was manually repaired. On 2026-05-09 this caused the mail SMB to reject every incoming message for
    ~14 hours (647 logged errors), resulting in SMTP "452 Insufficient system storage" responses.

    Root cause of the corruption: smb_putstatus() was called but its return
    value was silently discarded. If the status write failed after the index record was already appended to .sid, the two files diverged: .sid had one
    more record than total_msgs reflected (or vice-versa).

    Fix 1 Ä propagate smb_putstatus() failures: the return value is now
    assigned back to i and returned to the caller, so a failed status write is
    no longer silent.

    Fix 2 Ä auto-repair small discrepancies in smb_new_msghdr (rather than hard-failing) when the mismatch is 1-2 records and the .sid length is an
    exact multiple of idxreclen:
    - LONG by 1 (.sid has one orphan record): truncate the extra record with
    chsize() and continue. This was the May 9 failure mode.
    - SHORT by 1-2 (.sid is missing 1-2 records): reduce total_msgs to match
    the actual index length, persist the correction with smb_putstatus(),
    and continue. The orphaned header/data space is harmless and can be
    reclaimed by smbpack.
    - Mismatch of 3+ records, or non-aligned length: still returns
    SMB_ERR_FILE_LEN as before.

    Test cases (smblib/smbidxtest.c, using CuTest framework):
    Test_NoCorruption - baseline: normal add still works
    Test_ShortIndexByOne - .sid truncated by 1 record: auto-repairs
    Test_ShortIndexByTwo - .sid truncated by 2 records: auto-repairs
    Test_LongIndexByOne - .sid extended by 1 record: truncates and proceeds
    Test_LargeCorruptionFails - .sid truncated by 3 records: still returns -206

    All 5 tests pass with the fix; 3 of 5 fail against the original code.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net