Skip to content
Snippets Groups Projects
  1. Mar 02, 2023
    • Rob Swindell's avatar
      Better automatic network address type detection · ce5f8ccc
      Rob Swindell authored
      smb_netaddr_type():
      - if passed NULL or a string that begins with whitespace, now returns NET_NONE.
      - if passed a string that begins with '@', now returns NET_UNKNOWN.
      - if the user.name portion of an otherwise value Internet email address
        contains a space, now returns NET_NONE.
      
      smb_get_net_type_by_addr()
      - if passed a string that begins with '@', now returns NET_UNKNOWN.
      - if passed a string with space following '@', will now return NET_UNKNOWN.
      - if passed a string without a dot following '@', will never return NET_INTERNET.
      
      Unrelated change: Add the missing FILE attribute to smb_msgattrstr()
      ce5f8ccc
  2. Feb 19, 2023
  3. Jun 02, 2022
  4. May 10, 2022
  5. Mar 21, 2022
    • Rob Swindell's avatar
      SMB items (messages or files) can now have 32-bit or 64-bit cost value · f1332d3e
      Rob Swindell authored
      To fully support files > 4GB in size in file bases, credit values larger than 32-bits must be supported too.
      
      There's a couple of todo comments/items included in this commit, but that's mainly to do with messages (which don't really have costs anyway).
      
      The main thing to deal with now is the fact that users can't have more than 4GB in credits in the first place! That's got to be fixed next.
      f1332d3e
    • Rob Swindell's avatar
      Support files > 4MB in SMB filebase indexes · 493ea18b
      Rob Swindell authored
      Used the reserved 16-bits in the file index record to extend the supported index-file-size from 4294967295 (4GB) to 281474976710655 (281TB). I think that's big enough for the foreseeable future. :-)
      493ea18b
  6. Mar 14, 2022
    • Rob Swindell's avatar
      Fix heap corruption of qp_decode() · b7726f69
      Rob Swindell authored
      qp_decode (quoted-printable in-place decode of a string) could write 2 characters *beyond* the allocated buffer by appending "\r\n" to a string that was not quoted-printable in the first place. i.e. the  contents of buf were not actually changed in the decode loop. This could result in a corrupted heap and crash of sbbs or smbutil when reading such a message.
      
      This change may result in a lack of CRLF appended to decoded plain text output, so we'll have to keep an eye out for that and resolve it some other way. One possibility could be to only append the CRLF if the destination pointer is sufficiently behind the source pointer.
      
      This solves the crash that Kirkman reported with a specific message in his "mail" base. The header for the message said it was quoted-printable encoded, but the body text was not actually encoded at all:
      OtherHeader      Content-Type: text/plain; charset="iso-8859-1"
      OtherHeader      MIME-Version: 1.0
      OtherHeader      Content-Transfer-Encoding: quoted-printable
      b7726f69
    • Rob Swindell's avatar
      65e83da5
  7. Mar 03, 2022
  8. Mar 02, 2022
  9. Sep 24, 2021
  10. Jun 10, 2021
    • Rob Swindell's avatar
      Standardize on "metadata" as the description of a file's "tail" dfield · 1993a13c
      Rob Swindell authored
      It's anticipated that this will be used for JS-populated file metadata in JSON format in the future (and not just "archive contents" in .ini format).
      
      Also, fix the double-free issue that was occurring when moving files with extended file descriptions (sbbs_t::movefile()). This was actually the primary problem I was fixing here, but noticed the metadata issue: metadata would not have been moved along with the other file info between bases.
      1993a13c
  11. May 14, 2021
  12. May 13, 2021
    • Rob Swindell's avatar
      Fix crash in smb_addfile_withlist() when passed a non-NULL empty list · 2f328eca
      Rob Swindell authored
      Don't allocate and memset a buffer of -1:
      #1  0x0000559222bc167f in strListCombine (list=0x559224220720, buf=0x559224226550 "", maxlen=18446744073709551615,
          delimit=0x559222bcce0a "\r\n") at str_list.c:447
      447             memset(buf, 0, maxlen);
      (gdb) print maxlen
      $1 = 18446744073709551615
      (gdb) up
      #2  0x0000559222ba3841 in smb_addfile_withlist (smb=0x7ffce63a7e90, file=0x7ffce63a5bc0, storage=1, extdesc=0x0,
          list=0x559224220720, path=0x7ffce63a6e80 "/xfer/loons/manhater.mp3") at smbfile.c:365
      365                     strListCombine(list, content, size - 1, "\r\n");
      (gdb) print list
      $2 = (str_list_t) 0x559224220720
      (gdb) print list[0]
      $3 = 0x0
      
      Found/reported by plt via irc. Thanks!
      2f328eca
  13. May 03, 2021
  14. May 02, 2021
    • Rob Swindell's avatar
      Store contents (list) of archive files in filebase (in the "msg tail") · 875a92d8
      Rob Swindell authored
      This will allow fast/easy display of archive contents without actually reading the archive files.
      
      Introduces some new functions:
      - list_archive_contents()
      - smb_adddfile_withlist()
      
      A new SMB convenience variable ("tail", aliased as "content" for a file).
      A new file detail level ("file_detail_content", exposed in JS as FileBase.DETAIL.CONTENTS) which adds a "content" array property to file metadata objects for JS FileBase.get().
      
      Files already added to the new filebases won't have this archive content automatically - I'm looking into that now (likely a new or updated JS script to run).
      875a92d8
  15. Apr 24, 2021
  16. Apr 22, 2021
  17. Apr 04, 2021
    • Rob Swindell's avatar
      A poll() failure with EINTR does not mean a socket is closed. · 925e3b0a
      Rob Swindell authored
      This won't impact Synchronet as it has a separate signal handling
      thread, but we still need to behave properly for processes that
      don't.  I'm also saying that ENOMEM does not indicate a disconnection,
      though it may be better to pretend it was disconnected...
      925e3b0a
  18. Feb 22, 2021
  19. Feb 15, 2021
  20. Feb 05, 2021
  21. Jan 23, 2021
  22. Jan 21, 2021
    • Rob Swindell's avatar
      Fix new GCC warning about return type. · 40ccdbb4
      Rob Swindell authored
      40ccdbb4
    • Rob Swindell's avatar
      Support single-part MIME-encoded messages in SMBLIB · e9f56e5d
      Rob Swindell authored
      This involved the removal of the content-transfer-decoding feature of the SMTP mail server since we need single-part MIME-attached file contents to be stored in their original encoded form (e.g. base64-encoded) and not in binary, for the message body text (where NULs aren't allowed, CR/LF is appended, etc).
      
      I accidentally made this change to smbtxt.c in the new_file_base branch and then copied over here, so there's some unrelated innocuous changes (comment header, removal of SMBCALL) that hopefully won't cause a merge conflict later.
      
      I don't actually receive single-part MIME attached files, so depending on others (e.g. Nelgin and Dream Master) to test for me.
      e9f56e5d
  23. Dec 25, 2020
    • Rob Swindell's avatar
      Add/use new FTN "BBSID" control paragraph (kludge line) · bce719a8
      Rob Swindell authored
      Advertise the system's QWK-ID (a.k.a. BBS ID) in exported echomail messages. This will allow correlation of avatars that were imported via SYNCDATA carried via QWKnet (e.g. DOVE-Net) with messages imported from those same BBSes via FTN.
      
      The alternative was to have SYNCDATA Avatar messages include all the AKAs of each BBS (in the body text), but that was looking like a rather complicated solution. This approach (the BBSID kludge) seems a much simpler solution.
      
      I still need to implement the JS side of this solution however (for avatar lookups using the FTN BBSID), but this was the first important step.
      bce719a8
  24. Dec 22, 2020
  25. Dec 11, 2020
    • Rob Swindell's avatar
      Support forwarding of single-part HTML emails, add "Fwd:" subject prefix · bb303fa4
      Rob Swindell authored
      When forwarding a single-part MIME-encoded HTML email, the preamble (original message header info) and any user comments, need to be HTML-encoded.
      
      Add the commonly-used "Fwd: " prefix to the default message subject, when forwarding.
      
      This required that smb_getplaintext() no longer always-NULLify the message's text_subtype (e.g. "html"). For single-part messages, this element was getting freed and NULLed.
      
      Add/use a new SMBLIB convenience function to add a string header field, but only if non-NULL: smb_hfield_string()
      bb303fa4
  26. Dec 10, 2020
    • Rob Swindell's avatar
      Include comment headers in smb_getmsgtxt() returned buffer · e7698942
      Rob Swindell authored
      even when GETMSGTXT_PLAIN mode flag is used and the message contains a MIME-encoded plain-text portion. Obviously the GETMSGTXT_NO_HFIELDS exception still applies.
      
      The fixed problem was when forwarding a MIME-encoded email, the forwarding information (and user comment, if supplied) could be suppressed/lost.
      e7698942
    • Rob Swindell's avatar
      Overhauled message forwarding, allow comments · 657ba52d
      Rob Swindell authored
      No longer derive the new message header from the original - too many problems. Simplified the forwarding support smblib (multiple SENDER* and RECIPIENT* header fields no longer expected/supported). Technically, the FORWARDED header field really serves no important purpose now.
      A comment can be passed into forwardmail() or (if NULL), will be prompted for. There is an issue where the added comment can be obscured by the receiving mail program if the original message is a multi-part MIME message. Not sure the best solution for that. Still a WIP in that regard.
      657ba52d
  27. Dec 09, 2020
    • Rob Swindell's avatar
      Dump the "forwarded" header field date/time nicely · 5d27f8c8
      Rob Swindell authored
      Use ctime_r() to dump the forwarded date/time.
      Correct some other unsafe uses of ctime() here (replace with cime_r).
      Fix the accidental reference to the GPL license (it's actually LGPL for smblib).
      5d27f8c8
    • Rob Swindell's avatar
      When a message has been forwarded, invalidate the "to" ext/net ptrs · c76148b6
      Rob Swindell authored
      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.
      c76148b6
  28. Nov 12, 2020
    • Rob Swindell's avatar
      Fix crashing bug introduced in previous commit of this file · a7ba442d
      Rob Swindell authored
      Don't pass NULL to strcasestr().
      a7ba442d
    • Rob Swindell's avatar
      Improved parsing of "charset" parameter in MIME Content-Type header. · 1f528dad
      Rob Swindell authored
      In Issue #177, the reported problem message header was "Content-Type: text/plain; charset=utf-8; format=flowed"
      The fact that the "charset" value was not quoted and not space delimited means the charset would have been parsed as "utf-8;", which would not provide an exact match (against "utf-8") in smb_msg_is_utf8() and thus the message body would not be considered to be utf-8 encoded.
      
      The solution is to terminate the "charset" parameter value at the semicolon, if it exists, and the value was not quoted.
      
      Also, for good measure, only search for " charset" or ";charset" to avoid false-positive parameter matches,  like "notcharset".
      1f528dad
  29. Nov 06, 2020
    • Rob Swindell's avatar
      Replace ctype.h function calls with new MSVC-safe XPDEV macros · ec20d959
      Rob Swindell authored
      I'm fed-up with MSVC assertions in ctype functions (e.g. isdigit, isprint, isspace, etc.) when called with out-of-range (e.g. negative) values.
      
      This problem only affects MSVC debug builds, but if you run them (like I do), these things are like little time bombs that can drive you crazy (knocking your board out of service).
      
      The new macros names are bit more descriptive as well.
      ec20d959
  30. Nov 05, 2020
  31. Sep 26, 2020
    • Rob Swindell's avatar
      Add smb_msg_type() and smb_msg_count() for index-based msg counting. · 0b87ef5d
      Rob Swindell authored
      In support of message bases with vote-messages and poll-closures:
      
      smb_msg_type() returns an enum smb_msg_type inferred from the combination
      of attribute flags specified (should match msghdr_t.type).
      
      smb_msg_count() calculates the number of message index records of the
      specified type(s) (a bit-field) by reading the message base index file. This
      value should only used for info/display purposes, so no locking is performed
      to return the result as fast as possible.
      
      This allows an accurate number of "posts" (posted *messages*) to be queried
      and displayed to a user when appropriate (e.g. instead of
      smb.status.total_msgs or just the size of the index file divided by the size
      of an index record). In that case, since vote messages and poll closures
      aren't displayed as messages to users, exclude those from the count to reduce
      confusion. For message bases that don't support voting, this scheme is not
      necessary.
      0b87ef5d
Loading