Mailing List Archive

a patch adding hooks to run 'chat' during console initialisation....
Attached is a patch to integrate hooks to call the public domain 'chat'
program (often supplied with pppd, but also included in this patch) with
an optional per-console chat script each time the console is initialised
(i.e. after carrier or DTR returns, or after a telnet connection is
re-established).

A separate conserver.chat file is provided for, both to simplify the
configuration and to allow the chat script to be protected from prying
eyes (since its most common application might well be to login to a
terminal server and thus it will contain at least an access password --
that's what I use it for anyway, and the examples are real! :-).

The chat-script is run after the first read for a network console port
(in order to allow telent negotiation to proceed first even though
nothing is really done yet). This means a chat to a really raw socket
connection might fail unless something can be read before the chat is
attempted.

I apologise for the rather extensive unrelated changes -- I found it
necessary to hack around quite a bit before I got all the right things
in the right places and I'm too lazy to try to undo the stylistic
changes (I find some aspects of the current coding style almost
unreadable, and some of the utility functions are quite bizzare).

The portability of this code isn't guaranteed, though it shouldn't be
too bad, at least for any half-way modern system (not that the code will
even begin to compile on a pre-ANSI machine anyway!). It's been tested
on NetBSD/sparc-1.3.2 and lightly on NetBSD/{i386,sparc}-1.5W.

Note the version of the 'chat' program included in this patch is a
slightly modified version of the one from NetBSD-current (1.25). I've
added a new flag, '-I', which causes it to not try to modify the TTY
settings (which fails on a direct socket); and I've fixed up the manual
page a bit. The hooks in conserver will use this option if the console
is a network port, so you'll definitely need this customised version!

(Note I've not really tested it against a serial TTY, but it should work
fine given that the chat program works fine when tested by hand on the
command-line via a real serial port.) I've not done any autoconf-
iscation on chat either. It may compile by default though on many
modern systems since it seems to expects only TERMIOS and other basic
POSIX functionality. It certainly works fine on NetBSD from whence it
was taken, and no doubt will work equally well on any recent *BSD and
maybe even MacOS-X.

Note too that some, though perhaps not all, of the suggested
improvements in the last patch I posted are included in this one too
(they were too hard for me to separate :-).

(apologies also for the size of this message -- but it appears it will
just under 128kb on the wire and it seems best to post it as one than to
expect y'all to put together a MIME message/partial multi-message post ;-)

--
Greg A. Woods

+1 416 218-0098; <gwoods@acm.org>; <g.a.woods@ieee.org>; <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>