Changes made to Jnos 1.11 to yield Jnos 1.11a:

mailbox.[ch]			Dynamic-IP-addr facilitated by XG command iff
				MBOX_DYNIPROUTE #define'd.

mailfor.c			Ignore comments in forward.bbs scanning.

smtpserv.c			Improve null ptr handling in TRANSLATEFROM code,
				and allow forwarding to addr beginning with '!'.

index.c				Avoid unnecessary changes to string arg to
				getaddress(s).

editor.c			Init error stat variable, and add -r for
				restricted-mode option.

mboxmail.c			Add "E=edit" feature to send command if ED,
				EDITOR, and SEND_EDIT_OK are all #define'd.
				Allow NIL area in changearea() call.

sessmgr.c			'sessmgr status' shows i/o-blocked state.

dialer.c			Fix control and status script cmds under Linux.
unixasy.c			Add param iface up, down, dtr commands.
asy.c				Parse 'r' Unix attach flag for true DCD (not
				complete).

tcpcmd.c			Fix Linux fault due to missing options.

tipmail.c			Increase delay between DCD tests for Unix ver.
				Fix parse for missing arg2.

convers.c			Minor change if Oldcode is used.

nntpcli.c, nntpserv.c		Add read timeouts unless NNTP_TIMEOUT is
				#define'd to 0 (default is 900 [sec]).

hop.c				Handle missing hop check arguments.

iface.c				Scan Hopper when detaching an iface. Other
				detach-time fixes.

tip.c				Handle iface detachment condition.

ftpserv.c			Problem in MDTM command fixed.  Add #define
				FTPSERV_XPERM to interact better with Netscape.

main.c, smisc.c, remote.h,	Add K2MF's UDP-based dynamic-ip-gateway code
config.c			iff ENCAP and UDP_DYNIPROUTE are #define'd.
				Also, add REMOTECLI #define tests.

forward.c			Save file-fwd info of last area forwarded.
				Detect rare missing-bid while preparing FBB
				proposal line.

nr3.c, netrom.h			Improve netrom detach handling.

udp.c				Improve del_udp().

asy.h, slip.h			For UNIX Jnos, allow up to 9 asy/slip ports.

http.c				Accept version HTTP 1.x requests, not just 1.0.

ripcmd.c			Avoid overwriting stack in doripproxy().

mboxcmd.c			Add more error checking to netrom display code.

sam.c				Add display for Tech-Plus code 'P'.

nrcmd.c				Handle rare null-pointer references.
=====================================================================
I added a mailbox command, having syntax:  XG 44-net-addr[/#bits]
which will add an encap route to the indicated subnet via the ip address of
the host making the tcp connection to the mailbox.  The mbox user must have
privilege bit 0x200000 (XG_ALLOWED) in ftpusers, there must be no existing
non-encap route to the indicated subnet, and the Jnos gateway must be
compiled with ENCAP, MBOX_DYNIPROUTE, TELNETSERVER and MAILBOX #define'd.
It is anticipated that the Jnos gateway has a static IP address, and that
the host connecting via TCP to issue the XG command has a dynamic ip address
that is to be used as a gateway for a 44-subnet (or even just one 44-net addr).
The route will persist for 900 seconds, unless changed by #defining
DYNIPROUTE_TTL <#secs> differently, perhaps in config.h.  The intent is to
allow a Jnos host with a dynamic IP address to use tcp protocols to forward
via a static-IP-addressed Jnos gateway, to 44-net destinations.  For example,
here is a sample forward.bbs script for such a host, k9dog.ampr.org (with
ip addr, say, of 44.108.0.51:
    xgddl 0023
    tcp static.gw.edu
    .k9dog
    .passme
    # Wait for prompt, indicating command-mode begun (assume no > in greetings)
    +>
    *60
    .xg 44.108.0.51
    .bye
    --------
    w5ddl 0023
    tcp w5ddl.ampr.org
    .k9dog
    .somepasswd
    w5ddl
    allus
    amsat
    ww
    ----------
If AT commands are used to initiate forwarding, a typical set would be:
    at 25 "mbox kick Xgddl+"     -- establish route to ddl via a gateway
    at 28 "mbox kick w5ddl+"     -- forward to ddl if any traffic pending
It is assumed that 15 minutes (or whatever the static-IP gateway system
has compiled in) is sufficient for a complete forwarding session.  Additional
kicks to Xgddl could be used to extend the life of a route, or even a kick
could be done every 15 minutes:  at now+0015 "mbox kick Xgddl+"
if the encap route is to be maintained for other non-forwarding purposes.
The destination system is assumed to route back to the 44-net station via
the same gateway: route add k9dog.ampr.org tnc static.gw.edu 2
See also the remote command modifications, described below, for an alternate
implementation.


I changed ReadFwdBbs() in mailfor.c to ignore comment lines (begun with '#')
while scanning forward.bbs ... this may allow a few more forwarding partners
to be scanned in R: lines, depending on how you organize the forward.bbs file.

Robin G8ECJ reported a bug in the TRANSLATEFROM Linux code, when handling a msg
being returned to sender.  In this case, the envelope from address is a NUL,
in an attempt to avoid any mail loop possibility.  The getaddress() routine was
invoked, and it was attempting to change the NUL to a NUL.  Apparently the
gcc compiler has allocated the NUL in a read-only section, which prevents
any updates.  I rewrote getaddress() in index.c to avoid unnecessary changes
to the input string.  Since in this case the improved getaddress() will return
a null pointer, I changed mailit() in smtpserv.c to handle this situation
better, ie, to avoid calling strdup with a null pointer.  The Borland compiler
seems to allocate a NUL string, but gcc will fault in the library.  So its
best to avoid using the null ptr altogether.

While looking at editor.c I found that the stat variable in editor() was
not set when getlst() returned, leading to a possible erroneous error msg.
Fixed.  I also improved the option parsing, and added a -r option to indicate
restricted mode, that is, no filenames can be given other than the initial one
in the ed invocation.  The -d option will eliminate some displays concerning
file lengths, and the -- option terminates further option processing and would
be used to read in a file name beginning with '-'.

I added the ability to edit a msg just composed while in the (S)end command,
provided EDITOR, ED, and SEND_EDIT_OK are all #define'd at compile time.  The
ed editor will work with telnet or ax.25 connections, but does take up a bit
(12KB) of memory, so use this option cautiously.  Fortunately, most msgs are
small so further memory impact should be minimal.  "mbox sendquery yes" must be 
in effect, and the query after the /EX is read is "Send(N=no,E=edit)?".
If e or E is typed in response, the editor is invoked, preceded by the
message: "Invoking Unix ed(itor); use Q to quit without saving changes."
then "Now press return to begin:".  I modified dosend() in mboxmail.c.
Unless the mbox user has sysop privileges, the editor is invoked in restricted
mode so no other files can be accessed.  The ed editor may not be the best
solution to email editing, but it is very capable when understood.  I refer
you to the editor helpfile, and recommend that the editor portion of it be made
available for download, if you enable this feature for your users.

I added a display of the i/o-blocked status to the Linux sessmgr status display,
shown by "(blocked)".  Note that the raw and dumb session managers block i/o
unless the associated screen is for the current session.  I changed
dosmstatus() in sessmgr.c.

Michael KF9UG reported a problem in the Linux version of dialer.c, when the
control up|down or status up|down commands were issued.  I fixed
dodial_control() and dodial_status() to avoid calling atol() with a null
pointer (always fatal under Linux).  I then had to add support for the
param <iface> up|down options, since the dialer relied on this ioctl.
I chose to make the Unix down option set the interface output baud to zero,
which drops DTR.  I made 'param up' restore the output baud, which seems to
reassert DTR with no further harmful effects.  I also added code to detect
if DCD is deasserted, so as to cause an immediate redial instead of waiting
for the pings to fail.  This assumes all installations have a reliable DCD
indication.  The 'r' attach flag indicates if this is true, but more work
needs to be done (to handle disconnects).

Robin G8ECJ reported that 'tcp access deny' caused a fault in the Linux Jnos.
It turns out that doaccess() in tcpcmd.c was using arg[2] without checking to
see if it was supplied, leading to processing a null ptr.  Fixed.

Robin G8ECJ also reported as a bug the long-standing refusal of Jnos to allow
a destination address beginning with '!' to be sent off-site.  This would
prevent Jnos from acting, for example, as an smtp gateway to a downstream
system that provides the nntp-gate behaviour that the '!' implies.  I don't
see any reason we should continue this behaviour, so I've made changes to
validate_address() in smtpserv.c to pass these msgs on, when NNTPS is not
compiled in.  However, when NNTPS is compiled, such msgs are never forwarded
off-site, but instead are routed to the nntp gate.  I'm not sure whether this
is a feature or bug!

I have added code to asy.c routine asy_attach() to parse an 'r' flag in the
Unix attach command, indicating that the attached device can assert DCD.  This
flag prevents Jnos from using the CLOCAL mode which always shows DCD asserted.
This is important to detect when a PPP connection hangs up.  asy_init() in
unixasy.c will not use CLOCAL when this 'r' flag is found.  Also carrier_detect
routine will report valid results.  THIS 'r' FEATURE IS INCOMPLETE!
I also added support iin unixasy.c for param <iface> {up, down, dtr <val>}
commands like in the DOS version of Jnos.

Gene K8EE sent a mod to formatline() in conver.c to allow more of the user's
input line to be formatted.  This pertains only if Oldcode is #defined.

I added code to nntpserv.c and nntpcli.c to set a read timeout equal to the
#define'd value of NNTP_TIMEOUT (in seconds).  The default is 900 s.
This should make Jnos NNTP client sessions no longer sit idle when a path to a
server, or the server itself, breaks.  To disable any read timeouts, #define
NNTP_TIMEOUT to 0 in config.h.  The timeout can of course also be defined to
another numeric value of your choice.

Jim WU3V reported a fault after typing 'hop check -h' and so I fixed hopcheck()
in hop.c to detect missing arguments.

Deni WB0TAX reported a crash when he plugged in a tnc and did a detach on
that interface.  It seems that detach frees up the iface structures, but did
not consider that there may be packets in the Hopper with that same iface addr
prepended.  I added code to fixup such packets, so that when the network proc
handles such packets, it won't use the invalidated iface ptr (avoiding a write
into freed memory).  I also saw a different crash after a detach, where a
packet which had not been acked, was resent (via a now-detached interface).
Detach seems very problematic, since interface ptrs are not always validated
before each use. I added code from Barry K2MF to remove any trace structures
belonging to the interface being detached, and to handle the netrom interface.
I moved Barry's if_nrdrop() to nr3.c, and added a call to it in nr_stop()
to complete a detach of the netrom interface.

Jim WU3V reported a crash due to the tip command's tip_out() process trying to
use an interface pointer for an interface that had just been detached. I fixed
it by adding code to the tip_out() process to detect when the interface is
detached and to then kill itself.  Note that detaching a non-idle interface
still can cause problems since not all code can, or even should, validate each
interface pointer before use.

Ray DL2GG reported a problem with Netscape crashing the Jnos ftp server, and 
it turns out Jnos under DOS will crash if the MDTM command is issued for a non-
existent file.  This is really a problem with stat() library routine, which
trashes a dos system if invoked for a non-existent file.  I bypassed this
by using access() to determine if the file exists before calling stat().

I added Barry K2MF's modifications to the remote UDP server and client, to
provide an alternate method (see XG, above) of sending Jnos info to do encap
routing to a gateway having a dynamic IP address.  This feature is enabled when
Jnos is compiled with both ENCAP and UDP_DYNIPROUTE #defined.  The typical
sequence is that the Jnos with a static address configures remote with a
gateway password (remember REMOTESERVER must also have been #define'd):
	remote -g gwkey
and then starts the remote server:  start remote 1234
Then a Jnos which has been assigned a dynamic IP address, would issue this
command to have 44.108.99.100 routed to it via an encap packet sent to its
dynamic IP address (remember REMOTECLI must also have been #define'd):
	remote -p 1234 -k gwkey -r 44.108.99.100/32 static-Jnos-hostname add
To terminate the encapped route, send the above command with 'add' changed to
'drop', or wait for the route to time out, which is defaulted to 900 seconds.
To change the default route TTL, the static-addressed Jnos should be compiled
with #define DYNIPROUTE_TTL nnn    in config.h, where nnn is the number of
seconds desired.  Also, a Jnos remote client desiring to renew the encapped
route before the TTL expires, might use this method:
	at now+0005 "route -p 1234 -k gwkey -r 44.5.6/24 n5knx.net add+"
Affected were smisc.c, main.c, remote.h, and config.c.

Allan Holm reported that the last area forwarded via the file-forwarding
method, did not have its .usr file updated.  This was due to dorevfwd()
in forward.c not calling changearea, since the oldarea name is NIL.  This
was to avoid constructing a bogus lockname in scanmail().  However, I
changed it to call changearea(), and then modified changearea() in mboxmail.c
to avoid the unneeded calls when the area name is NIL.

Robin G8ECJ described how Linux Jnos' ftp server didn't work with Netscape
when the ftp user was assigned a non-root homedir in ftpusers.  This is the
same problem the was solved for MSDOS, so I extended the same solution to non-
dos systems iff FTPSERV_XPERM is #define'd.  This technique first tries to find
the pathname as given, and if that fails, then it is taken to be relative to
the user's root dir (typically the first dir given in the ftpusers file; see
readme.now for more details) and retried.  Thus if a user's rootdir is
/jnos/public, a command "CWD /src" will at first fail if ftpusers gives no
access to "/src", but a retry may well find /jnos/public/src, where access IS
allowed.  The downside is that if you mis-type a CWD command, you may end up
in an unexpected place, rather than getting a non-found error.

I made a few fixes to tipmail.c, to eliminate a very tight loop while awaiting
DCD (but the 'r' attach flag is a prerequisite to needing this) and to handle
the arg parsing case where there is no modem or terminal argument supplied.

Jim WU3V reported a crash in Linux Jnos in del_udp() of udp.c.  It appears
that the mbuf chain and the packet count were out of sync!  I am not sure
how this happened, but I rewrote the code to delete the mbuf chain without
reliance on the counter.

Jim WU3V asked that the max number of asy and slip ports be increased under
Unix, since more ports can easily be supported.  I changed the max to 9 (still
a totally arbitrary value).

Dennis KD1CA forwarded an http server mod from Barry K2MF, that allows HTTP
version 1.x requests to be scanned, rather than reject them as not version 1.0.
I modified http() in http.c.

I noticed that doripproxy() in ripcmd.c didn't declare sufficient space for the
rip_auth[] array, so I changed it like in doripadd().

Jim WU3V reported a crash of Jnos/Linux trying to display a bogus Netrom uplink
in 'mbox stat'.  I added code to handle errors better in dombusers() in
mboxcmd.c.  I asssume an update of some database was interrupted, leaving it
momentarily in an inconsistent state.

Jim WU3V reported a problem where Jnos Linux crashed while preparing an FBB
proposal for a msg that had no bid.  It's unclear how this happened, probably
an improper smtp Message-Id header, and so I changed Jnos to detect such a case
and refuse to forward such a msg.

Jim WU3V reported a Linux crash where Jnos identd used a null pointer.  I added
a test of the pointer returned by itop() in identserv() in smisc.c.

Bob WA4GIU sent a mod for sam.c to display the Tech-Plus license category.

Jim WU3V sent a backtrace from a Linux crash, that revealed that dorouteinfo()
and donrneighbor() in nrcmd.c could derefence a null pointer in "rare" cases.
I fixed these two routines to test such pointers first!
