• src/sbbs3/ftpsrvr.c

    From Deucе@VERT to Git commit to main/sbbs/master on Fri Feb 19 09:32:09 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/59b8829a0915a454233ea17d
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix CIDs 174500 and 174471

    ---
    ï¿­ Synchronet ï¿­ Vertrauen ï¿­ Home of Synchronet ï¿­ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Mar 8 11:41:21 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/b62505add30804e8c6a6fb79
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Remove extraneous (void) typedefs

    See if this resolves rjwboys reported error:
    threadwrap.h:204:42: error: expected expression before ‘do’
    #define protected_uint32_init(pval, val) atomic_init(pval, val)

    ---
    ï¿­ Synchronet ï¿­ Vertrauen ï¿­ Home of Synchronet ï¿­ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Jun 7 20:14:25 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/6fee19566f510a9c5cda36a4
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Detect TLS startup errors correct/fully

    We can't (apparently) only rely on the return value of start_tls(), we have to check the value of the crypt session too.
    This fix the possibility of this happening:
    Jun 7 18:07:26 sbbs synchronet: ftp 0058 TLS ERROR 'No permiss.to perform this operation' (-21) opening keyset
    Jun 7 18:07:26 sbbs synchronet: ftp 0058 <192.168.1.25> initialized TLS successfully

    Instead, we'll detect the failure and disable FTPS support, logging "failed to initialize TLS successfully".

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Sat Sep 18 17:02:24 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/bb1ee45982174c3a0a73ce1e
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix segfault reported with ftpalias.cfg support in some cases

    ftpalias() can return true even when the directory is not set to a valid directory index (i.e. set to -1), so using as an array index would definitely segfault. Part of commit 8ad30b6c by Deuce 3 years ago.

    I didn't test this as I'm not sure exactly the combination of ftpalias.cfg content and FTP command received that would trigger this, but it's most definitely a bug.

    So should fix the segfault reported in issue #288.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Sat Sep 18 22:22:14 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/15906e19c9b0b832027ce673
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Handle FTP requests for paths that start with "/./"

    Midnight Commander (mc) apparently sends requests like this for files
    (e.g. aliases) in the virtual root directory.

    Fixes another part of the reported issue #288.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Sun Dec 5 18:42:38 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/17a67ee9d95051145677ec52
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix FTPS upload failure: !DATA ERROR 0 receiving on data socket

    Don't treat CRYPT_ERROR_COMPLETE (-24) as a socket error during upload since it's an indication that the remote closed the connection and is the normal "end of file/transfer" indicator, not an error. 'rd' is already 0 in this case, so no need to set at all (since recv() returns 0 upon disconnect and that's what we're emulating here).

    Fixes issue #309 reported by Jas Hud.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From MRO@VERT/BBSESINF to Rob Swindell on Mon Dec 6 13:35:33 2021
    Re: src/sbbs3/ftpsrvr.c
    By: Rob Swindell to Git commit to main/sbbs/master on Sun Dec 05 2021 06:42 pm

    https://gitlab.synchro.net/main/sbbs/-/commit/17a67ee9d95051145677ec52 Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix FTPS upload failure: !DATA ERROR 0 receiving on data socket

    Don't treat CRYPT_ERROR_COMPLETE (-24) as a socket error during upload since it's an indication that the remote closed the connection and is the normal "end of file/transfer" indicator, not an error. 'rd' is already 0 in this case, so no need to set at all (since recv() returns 0 upon disconnect and that's what we're emulating here).

    Fixes issue #309 reported by Jas Hud.

    i cant upload files using any protocol on your bbs and cvs.synchro.net
    ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::
  • From Digital Man@VERT to MRO on Mon Dec 6 13:20:33 2021
    Re: src/sbbs3/ftpsrvr.c
    By: MRO to Rob Swindell on Mon Dec 06 2021 01:35 pm

    Fixes issue #309 reported by Jas Hud.

    i cant upload files using any protocol on your bbs and cvs.synchro.net

    Working for me (now). I replied to your emails about this already. I appreciate your continued testing.

    Don't try to use SyncTERM v1.2b for uploads (they don't work).
    --
    digital man (rob)

    Synchronet/BBS Terminology Definition #14:
    CGA = Color Graphics Adapter (IBM)
    Norco, CA WX: 72.0øF, 35.0% humidity, 8 mph NNW wind, 0.00 inches rain/24hrs ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From MRO@VERT/BBSESINF to Digital Man on Tue Dec 7 14:58:09 2021
    Re: src/sbbs3/ftpsrvr.c
    By: Digital Man to MRO on Mon Dec 06 2021 01:20 pm

    Re: src/sbbs3/ftpsrvr.c
    By: MRO to Rob Swindell on Mon Dec 06 2021 01:35 pm

    Fixes issue #309 reported by Jas Hud.

    i cant upload files using any protocol on your bbs and cvs.synchro.net

    Working for me (now). I replied to your emails about this already. I appreciate your continued testing.

    Don't try to use SyncTERM v1.2b for uploads (they don't work).

    yeah i tried to delete this msg but it already sent.
    i'm using 1.1b win32 of syncterm
    ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::
  • From Digital Man@VERT to MRO on Tue Dec 7 19:45:13 2021
    Re: src/sbbs3/ftpsrvr.c
    By: MRO to Digital Man on Tue Dec 07 2021 02:58 pm

    Re: src/sbbs3/ftpsrvr.c
    By: Digital Man to MRO on Mon Dec 06 2021 01:20 pm

    Re: src/sbbs3/ftpsrvr.c
    By: MRO to Rob Swindell on Mon Dec 06 2021 01:35 pm

    Fixes issue #309 reported by Jas Hud.

    i cant upload files using any protocol on your bbs and cvs.synchro.net

    Working for me (now). I replied to your emails about this already. I appreciate your continued testing.

    Don't try to use SyncTERM v1.2b for uploads (they don't work).

    yeah i tried to delete this msg but it already sent.
    i'm using 1.1b win32 of syncterm

    1.1 was released over a year ago. That's the supported/known-working version. 1.1b (for SyncTERM) means "beta" or pre-1.1.
    --
    digital man (rob)

    This Is Spinal Tap quote #39:
    Female Airport Security Officer: Do you have any artificial plates or limbs? Norco, CA WX: 54.1øF, 85.0% humidity, 0 mph SSW wind, 0.00 inches rain/24hrs ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From MRO@VERT/BBSESINF to Digital Man on Wed Dec 8 05:14:29 2021
    Re: src/sbbs3/ftpsrvr.c
    By: Digital Man to MRO on Tue Dec 07 2021 07:45 pm

    yeah i tried to delete this msg but it already sent.
    i'm using 1.1b win32 of syncterm

    1.1 was released over a year ago. That's the supported/known-working version. 1.1b (for SyncTERM) means "beta" or pre-1.1.

    yeah, it works for what i use it for so i'm not going to upgrade.
    it's not bombing out on me during connections.
    ---
    þ Synchronet þ ::: BBSES.info - free BBS services :::
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Jan 10 22:27:52 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/7ccc618a991a97d22336fcc0
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Log unallowed/illegal filenames in quotes

    Prefixed or trailing white-space characters would be hard to discern without this.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Jan 31 11:58:42 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/658773d65b44452a84a696fb
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Log the full path for rejected uploads based on directory

    The logged error "!attempted to upload to invalid directory" did log the actual path that was attempted to be uploaded.

    Added some quotes around other logged paths.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Jan 31 12:20:26 2022
    https://gitlab.synchro.net/main/sbbs/-/commit/52b2e20a5dd8330adb315d73
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Change "attempted to upload to invalid directory" msg

    Make it more accurate/clear:
    "attempted to upload invalid path/filename"

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Mon Jan 30 16:00:04 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/5fdf8f0fddbcc5016c033af8
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Don't MQTT-publish the download of temp files

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows)@VERT to Git commit to main/sbbs/master on Thu Feb 2 17:51:37 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/8e94a448a7346a36d4a85dbe
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix uploader-notification, credit awards, download-counters in FTP downloads

    Since v3.19 (the new filebases), when a user FTP-downloaded a file, we failed to properly find/load that file's record from the filebase (searching for the file's full path, rather than just the filename), so the code the increments the file's download counter, notifies the uploader, awards credits, etc. did not ever execute. This means that FTP-downloads for all files downloaded via FTP were effectively "free" (and nobody noticed). No error was logged either.

    I discovered this while debugging the case of "(null)" filenames in the action/download MQTT topic messages being published by the FTP server. So
    that issue is fixed as part of this commit as well.

    Oh, and if this code had executed before, it would have memory-leaked the
    file information, so that's fixed too (added call to smb_freefilemem). Ugh.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows)@VERT to Git commit to main/sbbs/master on Thu Feb 9 12:43:11 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/3709ae9d438cc0932f70c46f
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Free/zero out the file_t struct *after* sending the MQTT action msg

    ... not before. This explains why FTP-uploaded actions had a (null) filename.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on ChromeOS)@VERT to Git commit to main/sbbs/master on Sat Mar 18 19:40:18 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/448e18156d14b0b8a2bb535a
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Add free disk space check against minimum space configured

    Disallow uploads when free disk space falls below minimum configured
    minimum free disk space.

    This fixes issue #535

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on ChromeOS)@VERT to Git commit to main/sbbs/master on Sat Mar 18 19:40:18 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/36fea1c5acf774be516d1df6
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Limit uploaded file sizes, accounting for free disk space

    The lower of the configured maximum file size (for the FTP server) and
    the available disk space minus the configured minimum free disk space
    is used as the maximum file size to allow upload. Appended files
    are accounted for too.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (in GitKraken)@VERT to Git commit to main/sbbs/master on Fri Mar 24 12:01:53 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/2e93426824b48954395c0b1f
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix some signed/unsigned comparison warnings from MSVC

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows)@VERT to Git commit to main/sbbs/master on Thu Apr 13 18:45:54 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/3e2c3176de6108c697d25a69
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix false "SUSPECTED BOUNCE ATTACK ATTEMPT" for IPv6 FTP-data connections

    This bug only impacted non-passive FTP connections. Using an FTP client
    with active (not passive) data connections over an IPv6 connection would false-trigger the "bounce attack" detection and the FTP server responded with "504 Bad port number" and logged a hack attempt in data/hack.log.

    The issue was that we were comparing the socket address structure (which contains other fields besides the address itself) between the control and proposed-data connections. While this logic worked okay for IPv4,
    it did not for IPv6 (the 2 structs contained some non-address differences). Rather than modify the socket address structures to match where needed, I'm just comparing the string representation of the addresses, since that's
    what we really care about anyway.

    Thank to "mark i" of Truck Stop BBS for alerting me to this issue

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Tue Oct 22 14:15:38 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/51ce7e6f71c2009c1804679f
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Attempt to fix issue #799

    receive_thread() needs to use the control session correctly for
    TLS connections.

    ---
    ï¿­ 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 Tue Oct 22 17:20:46 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/17912ca377006ca652483b1e
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    IP addresses are logged (most) everywhere else in square brackets

    There are still places where it could be logged in <> (if username is not yet known).

    ---
    þ 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 Sat Nov 16 19:16:05 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/ffba326dad6263eedc29ed94
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Fix the "ERROR x getting data user y" log message (usernum was 0).

    Add the errno value to help root-cause.

    We really should be using safe_strerror() everywhere.

    ---
    þ 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 Sat Nov 16 20:08:50 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/569efded81398f71ad35f70b
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Use safe_strerror() in place of strerror() - everything multithreaded should

    ---
    þ 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 Sun Nov 17 03:11:30 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/6fc2a6b6ff98fab8f98bf955
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    A little beautification of errno logging

    ---
    þ 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 Mon Nov 18 01:50:47 2024
    https://gitlab.synchro.net/main/sbbs/-/commit/8b4d02103bb4a63ffcc360f3
    Modified Files:
    src/sbbs3/ftpsrvr.c
    Log Message:
    Correct initialization of fmutex_t so the file descriptor is -1

    For some reason, MSVC was initializing the time_t (second element of the struct) to -1, not the int fd (the first element), which was initialized to
    0. Weird.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to Rob Swindell (on Windows 11) on Mon Nov 18 12:01:14 2024
    Re: src/sbbs3/ftpsrvr.c
    By: Rob Swindell (on Windows 11) to Git commit to main/sbbs/master on Mon Nov 18 2024 01:50 am

    For some reason, MSVC was initializing the time_t (second element of the struct) to -1, not the int fd (the first element), which was initialized to 0. Weird.

    Actually, this assessment was wrong. fmutex_open() was memsetting the fmutex_t to zero.
    --
    digital man (rob)

    Synchronet/BBS Terminology Definition #88:
    UART = Universal Asynchronous Receiver/Transmitter
    Norco, CA WX: 61.5øF, 38.0% humidity, 2 mph W wind, 0.00 inches rain/24hrs
    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net