# What's New in Synchronet v3.13

- All Servers
  - Overhaul of temporary directory usage:
    - No more temp files in `data` or `data/temp`
      `ctrl/../temp` (e.g. `sbbs/temp`) is the new default location for temporary files
    - Each server has its own separately configurable temp dir (in `ctrl/sbbs.ini`)
    - BBS events (e.g. QWK packet processing) now have their own exclusive-use temp dir (e.g. `sbbs/temp/event`)
    - All server threads will attempt to create and verify the validity of their temp dir
    - The system temp directory is only used as the default temp dir for Unix (i.e. `/tmp`)
      since the Windows default temp dir (e.g. `C:\DOCUME~1\Rob\LOCALS~1\Temp`) is not particularly friendly or attractive
  - The startup/initialization file may now be named:
    `ctrl/sbbs[.host | .platform].ini` or `ctrl/startup[.host | .platform].ini`
  - New bool ARS keywords (convenience shorthand):
    - `GUEST` (shorthand for "`REST G`")
    - `QNODE` (shorthand for "`REST Q`")
- Web Server
  - Win32-CGI support (tested with `php-cgi.exe`)
  - Created `ctrl/cgi_env.ini` which dictates which system environment variables will be passed to CGI processes and which default or forced values they will have
  - Default CGI content-type is now configurable via `sbbs.ini [web] DefaultCGIContent`
    (defaults to "`text/plain`")
  - Added CGI environment variable `REDIRECT_STATUS=200` for PHP-CGI kludge (thx Deuce)
  - Added non-standard (Apache) `SCRIPT_FILENAME` environment variable required by PHP-CGI
  - Bug-fix: default server-side JavaScript file extension (".ssjs", not "ssjs")
  - Bug-fix: removed ":port" specification from vhost paths
  - When logging and using virtual hosts, log every virtual host in it's own separate file in the format: `(prefix)vhostname-date.log`
  - Renamed `sbbs.ini [web] CgiTempDirectory` to just `TempDirectory`
    (this directory is actually used for SSJS, not CGI)
  - Work-around: change current directory to `ctrl` directory during initialization
    Deuce's .ssjs files make assumptions about the current working directory when opening files
  - Created global JS variables: web_root_dir and web_error_dir
    to be used in the future instead of assuming that `"../web/.."` will be the correct location of a specific file
  - Created global JS log() function (like all good servers should have)
  - JS print() is an alias for writeln()
  - Bug-fix: JS write() and writeln() methods must return string written as other servers' implementations do
  - Add support for streaming-style `.ssjs` files
    If you set http_reply.fast to true BEFORE the first write(), the first write will send the headers and every write will go through the socket immediately
    This will make large `.ssjs` files appear to be faster (e.g. Large user lists)
  - CGI scripts now have STDIN directly from the socket. File uploads should work again now
  - If a CGI script sends the LENGTH header, turn keep-alives on
  - New `formmail.ssjs` script to emulate Matt Wright's `FormMail.pl` script
  - New `404.ssjs` file to display directory contents [example]
  - Bug-fix: numerous memory leaks were present due to things being allocated, and structures being zeroed every time through the redirect loop instead of per-request
  - Added external web-content handler support using `ctrl/web_handler.ini`
    This should allow for competing dynamic HTML solutions based on server-side JavaScript (e.g. `.xjs`).
    Tip: use http_request.real_path for the path to file-to-be-parsed
    This should also allow `php-cgi.exe` (for example) to automatically handle `.php` files
  - Bug-fix: when logging failed login attempts, was logging wrong password variable (i.e. garbage)
- Mail Server
  - Bug-fixes: Numerous External Mail Processor (`mailproc.ini`) related problems
  - Set the "reply-to" header field on outbound mail if the local sender has their account configured to forward received mail to a valid netmail address
  - SMTP `RCPT TO` command now fails if no recipient specified
  - Represent FidoNet addresses in "From:" header fields using `"name" <ftn_addr>` notation (for Deuce)
  - Bug-fix: send "EHLO" (instead of "HELO") for SMTP relay attempts using SMTP authentication (which requires the ESMTP extensions implied by the "EHLO" command)
  - Bug-fix: handle received multiple-hop (routed) QWK netmail correctly
  - If sending to a domain your system handles (i.e. system inetaddr, host name or an entry in `ctrl/domains.cfg`), connect to the local SMTP server, by interface IP if server is bound to a specific IP, or "127.0.0.1" if it is not
  - Reject (don't attempt to send to) MX records that resolve to `127.x.x.x`
    (e.g. `sbcglobel.net` [sic])
  - Bug-fix: handles attachments of multiple files specified in subject
    (typically FTN netmail messages)
- FTP Server
  - Now supports configurable IP address to use in PASV responses (for broken firewall/NAT devices) and PASV port ranges (default is 1024-65535)
    See the TCP/IP FAQ for more details
  - Added kludge required to work-around SMC Barricade router "P@SW" bug
  - Bug-fix: not allowing simultaneous downloads of the same file
  - Support "LIST -opts" command in local file system mode
  - Create tempory transfer files in the (*gasp*) temporary directory (instead of data directory)
  - Use more unique temporary transfer filenames (includes the local hostname)
  - If an aliased file or directory has a description of "hidden", don't display it in directory listings
  - Created `exec/ftp-web-html.js` for sysops running the Synchronet Web Server
    Uses HTTP for CSS and image files. Edit `ctrl/sbbs.ini` to use `ftp-web-html.js` instead of the default `ftp-html.js`
- Telnet/RLogin Server
  - Bug-fix: the Win32 list long filename feature didn't work correctly with filenames with a less than 8 character base name
  - Bug-fix: if a file with a long filename was blind uploaded (e.g. with SEXYZ or rz), then it would not be properly added to the database
    (but the file would be copied to the destination directory)
  - Bug-fix: moving a file between directories would use the Micros~1 shortened version of the filename
  - When uploading a file, if no description is given, use the filename (rather than "No description given")
    if the real filename is different than the one in the database (e.g. it's a long filename)
  - Now passes QWKnet hub name as `%s` on QWKnet call-out command-line
  - Bug-fix: qnet-ftp will only delete the .REP packet if it was sent successfully
  - Delete/ignore the file ATTXREF.DAT if included in .REP packets
  - Ignore the "Your Messages Only" scan configuration flag for QWKnet accounts
  - Don't ask "Your Messages Only?" during scan configuration for QWKnet accounts
  - Bug-fix: when answering 'No' to the "Use an external text editor?" new user question, it would not force the editor to the internal line editor
  - Bug-fix: hitting 'Q' from the external editor selection dialog, the current editor would be changed anyway
  - Bug-fix: allow control keys (e.g. Ctrl-U) to have effect while waiting for paged node to respond
  - Bug-fix: buffer overflow (segfault) in temporary directory file extraction/transfer section
  - Subtle Bug-fix: when executing a native external program, the server process's environment is no longer modified to set variables in the spawned process's environment. This could result in a race condition where if multinodes executed native externals simultaneously, one node's child process could get the wrong node number (SBBSNNUM) or node directory (SBBSNODE) value (in theory).
    This Bug-fix only applies to Win32 builds only
  - Changed parsing of DSZLOG (`protocol.log`) to account for long filenames and filenames with spaces in them
  - Fix ups for new user creation via RLogin (Deuce)
  - Bug-fix: don't upper-case the file path when it's input for a new file in a text file section
  - Bug-fixes: interrupting users or chatting with users during logon process
  - New @-code: `INCLUDE`
    Just like `TYPE`, except no auto-prepending of CRLF (blank line)
    Used for including `head.asc` and `tail.asc` in the new `menu/main.asc`
  - The width of fixed-width @-codes may now be specified (as a decimal number)
    following the `-R` or `-L` (right or left justification) appendage
    Allows expanded text to be shorter than the unexpanded @-code length
    (e.g. `@NODE-L2@` for a left-justified 2 character node number)
  - Bugfix: Ctrl-A codes to move the cursor right (>0x7f) weren't working for non-ANSI users
  - New command-line specifier (`%@`) expands to `exec` dir on Win32 (same as `%!`), blank on Unix
    for use with info-zip command-lines
  - Command-lines containing filenames (`%f`) with spaces in them are now automatically quoted as needed
  - Command-lines of external programs are now logged
  - Additional (potentially helpful) log output when detecting QWK pack semaphore and mutex (lock) files
  - Bugfix: Baja/PCMS integer manipulation functions (e.g. ADD,SUB,MUL,DIV,AND, etc.) did not work if the second argument was a string variable
  - Password masking now handles space characters correctly
  - ESC immediately followed by anything other than '`[`' is now handled immediately
  - Auto-terminating JavaScript modules:
    If js.auto_terminate is true (the default value) and the remote user disconnects, the script will automatically terminate
    (use the new js.on_exit() method to have any critical clean-up functions perfomed during termination)
  - New Baja module/shell decompiler (from Deuce): `unbaja`
- JavaScript
  - Bug-fix: predictable random numbers being returned from random()
  - Bug-fix: system.newuser_password and system.newuser_magic_word were reversed
  - Bug-fix: Queue objects can now have null encoded/enqueued and dequeued without converting to an empty object or segfaulting
  - Bug-fix: a background-executed script (via `load(true,...)`) was not enqueueing the result of the last evaluated statement if it was undefined
    (some functions return undefined on failure)
  - Bug-fix: corrected link property for directories in libraries that use a "code prefix" (the prefix isn't used in the FTP virtual directories)
  - JSexec-Unix: a `SIGHUP` will cause a recycle/re-run
  - JSexec: added `-f` option to force console output stream to non-buffered
  - JSexec: added `-S` option to set thread stack size limit, default is 256K bytes
    This should keep JSexec from crashing due to the ircd recursion bug.
    It'll log a JS exception/error and exit (or loop) instead
    Use `-S0` to set an unlimited thread stack size (not recommended)
  - JSexec: if error and console messages are redirected to files (using `-e` and `-o` options) echo error messages to status output (default: stderr) as well
  - All string-modification methods now return undefined if passed an undefined value (rather than converting to the string "undefined")
  - Enhancements: Queue.peek() and Queue.read() now support an optional timeout argument (in milliseconds)
  - bbs.get_newscantime() now returns null on abort instead of undefined
    It's been determined that null is the better error return value for functions (for one, it's easier to to enqueue/dequeue)
  - New feature (requested by sinister-x), if a msg header object is passed to bbs.post_msg(), it will be used for the in-relpy-to header fields and thread linkage automatically
  - Always enqueue the result of a background-executed script (even if it fails with an error)
    If an argument is passed to exit(), enqueue that value instead
  - Global sleep() function now returns the number of elapsed timer ticks instead of undefined
  - Defined new global variable socket_errno, for debugging socket errors without an associated Socket object
    (e.g. failed resolve_ip() or resolve_host() calls)
    On *nix, this value will be the same as errno, but on Win32, it will be different
  - New global function: flags_str() to convert string flag representations (e.g. "A-Z") to/from numeric representation (used in the user.security properties)
  - New advanced function: js.report_error()
    used to report errors using the internal JS error reporter
    (passing false as the second argument causes the script to immediately terminate)
    log() should be used instead, for normal script error reporting
  - New console.printfile() mode flag: `P_NOCRLF` (defined in `sbbsdefs.js`)
  - Bug-fix: log() now treats a single numeric argument as the value to be logged rather than the log level
  - New advanced function: js.on_exit()
    used to add a string to a last-in-first-out queue of strings to be automatically evaluated/executed upon termination of the script
  - If a Date object is passed as the default value to File.iniGetObject(), return a Date object
  - The object properties returned from MsgBase.get_msg_index() and get_msg_header() (header and index fields) are now writable
- SBBSecho
  - Work-around for BRE/FE inter-BBS attachment bug (remove pre-pended '^' from attached filename)
  - Fix case of attached files before placing in `.?LO` files (for Unix file system compatibility)
  - Now supports `%@` (for info-zip), `%.`, and `%?` command-line specifiers in file pack/unpack command-line
  - Create RFC822 mesage-IDs for imported FTN echomail messages
    (for later cross-referencing of posted replies via `nntpservice.js`)
- Synchronet Console
  - Bug-fix: for log output, display control characters in ^X format
    (ths should fix the mystery termination bug when ran from xterm and logging a Ctrl-E character)
  - Bug-fix: don't over-ride the Unix syslog facility type when using the sbbs `-d` option and no facility type was specified
  - Allow the Unix syslog identity to be configured using the `sbbs.ini [Unix] LogIdent` key
  - Allow the Unix PID file name to be configured using the `sbbs.ini [Unix] PidFile`
    (when daemonized only) default is still `/var/run/sbbs.pid`
- Synchronet Control Panel (for Win32)
  - Bug-fix: hostname being set to "(null)" when importing registry settings from v3.00-v3.11
  - List of web server index files is now configurable
  - External changes to `ctrl/sbbs.ini` are now loaded when starting servers
  - Bug-fix: restore the current working dir (ctrl dir) when done selecting sound files from configuration dialogs
  - Don't add selected sound files to recent documents history
  - Only request the minimum required security access in SCM calls
    This allows `sbbsctrl.exe` to be run by non-admin users and still start/stop/monitor Synchronet NT Services
- Synchronet NT Services
  - If [-]help or [-]? is passed on the command-line, no longer attempts to start service control dispatcher (just displays usage)
  - Usage is no longer displayed if the service control dispatcher is started successfully
  - "/options" are supported (as well as `-options` and just `options`)
  - When re-enabling a disabled service, sets the service's start type to "auto" or "manual" based on the AutoStart settings in the startup file (e.g. `sbbs.ini`)
  - Added "list" command, to list service install/start mode and current state
  - Added "start" and "stop" commands to easily start and stop one or all services using sbbsNTsvcs
  - Added mute, unmute, and recycle commands
  - Allow short-hand service names on command-line (e.g. just "BBS" instead of "SynchronetBBS")
- CHKSMB
  - Detect and report number of "in-transit" messages
  - Detect and report number of unvalidated moderated messages
- ListServer
  - Work-around bug in v3.12a: remove msgtxt file to prevent mail server from attempting delivery of list contributions to user #0
  - Stops parsing listserver commands when tear line (`---`) is reached
  - Export no messages if the list.ptr file is empty/invalid
  - Report an error if no listname was specified on the subscribe/unsubscribe command line
  - Beautified/unified log output (include "ListServer" in all output)
  - Don't send help text for every invalid command (just once)
  - Bug-fix: moderated message posting
  - Bug-fix: convert sub code to lowercase for use as index into msg_area.sub[] array
- NewsLink
  - Bug-fix: If aborted due to disconnection, the import pointer would be off by one causing the next article to not be imported the next time NewsLink was run
  - Use XOVER to get article headers (if supported on server)
    This reduces the likelihood of requesting a bad article number which some servers now consider worthy of disconnection!
  - Added `-nx` command-line option or "no_xover" `newlink.cfg` option to disable XOVER-on-import support
  - Added an "unmangle" option to `newslink.cfg` (or `-um` on the command-line) to automatically remove the NewsLink anti-spam measure from the e-mail address (if present) in imported messages
  - If "NNTP-Posting-Host" header field is defined, compare value to contents of ip and ip-silent trashcan/filter files.
    Allows easy silent filtering of trash-canned twit/spammer IPs. Requires the latest `newsutil.js`
- NNTP Service
  - Added support for the LISTGROUP command (from RFC 2980)
  - Bug-fix: Don't allow guest/anonymous logins if the `-na` option is used
  - Bug-fix: Always logout the current user upon receipt of AUTHINFO PASS
  - Bug-fix: don't attempt to use msgbase.cfg for xref field:
    use selected.newsgroup instead, which is always valid, even for the "mail" group
  - Bug-fix: treat messages posted by non-QWKnet accounts as "local" messages
    (i.e. set header.from_net_type to NET_NONE)
    This defeats the v3.12 "feature" in msgbase.save_msg(), which auto-detects the from_net_type based on the from_net_addr
- IRC Daemon
  - Lots of bug-fixes and enhancements by Cyan
  - For details, see ircd.js, ircd_user.js, ircd_channel.js, ircd_server.js and ircd_unreg.js
- Documentation
  - The Web Server is now documented in `docs/websrvr.txt`
  - The ListGate module (`exec/listgate.js`) is now documented in `docs/listgate.txt`
  - Fixed JS documentation error: default timeout value for Queue.poll() is 0, not infinite
- Message Bases (SMBLIB v2.41)
  - Hash database no longer used for the mail database:
    - Message-IDs were not used for duplicate checking or threading
    - The old body text CRC history dupe checking is sufficient (when enabled)
    - Eliminates unnecessary burden on mail database operations
    - Reduces disk consumption of typically-ephemeral mail messages
    - After upgrading, you can safely delete your `date/mail.hash` file
- SCFG
  - Bug-fix: crash when using help (F1) in certain contexts
- SEXYZ
  - Synchronet External X/Y/Zmodem file transfer protocol driver
  - Replaces 16-bit DOS drivers: FDSZ or CE-XYZ
  - See `docs/sexyz.txt` for details

For many more changes since v3.10, see v311_new.html, and v312_new.html

Copyright © 2005 Rob Swindell
$Id: v313_new.html,v 1.2 2005/09/11 23:52:49 rswindell Exp $