Imported from conserver-8.1.2.tar.gz

This commit is contained in:
Bryan Stansell 2004-03-11 09:54:13 -08:00
parent 9eed9f2d8f
commit aea0e2a547
31 changed files with 2160 additions and 1021 deletions

23
CHANGES
View File

@ -1,6 +1,27 @@
CHANGES
=======
version 8.1.2 (Mar 11, 2004):
- better handling of client command (^Ec|) when user is bumped,
conserver is reconfigured, etc
- added 'initsubst' option for 'initcmd' substitutions like
'devicesubst' and 'execsubst' - based on patch by Bill
Sommerfeld <sommerfeld@east.sun.com>
- modified and added to *subst (initsubst, etc) syntax to allow
for flexibility and future enhancement
- changed 'port' and 'portinc' minimums from 1 to 0 - it allows
more flexibility and helps with 0-based counting
- removed unportable sys/cdefs.h from contrib/chat/chat.c -
patch by Bill Sommerfeld <sommerfeld@east.sun.com>
- added --with-extmsgs configure switch to enable entertaining
messages
- marked various undocumented client commands as depreciated so
that they can be removed in a future version
- added ability to "move" to a new console via '^Ec;' -
suggested by Christopher T. Beers <ctbeers@syr.edu>
- added a dump of console information when -S is used twice -
suggested by Todd Stansell <todd@stansell.org>
version 8.1.1 (Feb 10, 2004):
- fixed mistake in Makefiles where rpmbuild fails - reported by
Martin Evans <m.d.t.evans@qmul.ac.uk>
@ -669,5 +690,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.150 2004/02/10 15:24:48 bryan Exp $
# $Id: CHANGES,v 1.158 2004/03/11 16:31:27 bryan Exp $
#

View File

@ -10,6 +10,13 @@ Upgrading?
new features added to the client if you're considering *not*
upgrading.
Version 8.1.2
- The 'devicesubst' and 'execsubst' formats have changed from
8.1.1. It's fairly simple to update your config file to the
new format...just check the conserver.cf manpage. Sorry for
having to change things, but it's for a good reason (I should
have though ahead when designing the original format).
Version 8.1.0
- The client/server protocol has changed to better protect 8-bit
@ -263,5 +270,5 @@ Other Information And Gotchas
#
# $Id: INSTALL,v 1.35 2003/12/25 19:21:59 bryan Exp $
# $Id: INSTALL,v 1.36 2004/02/22 21:04:06 bryan Exp $
#

14
TODO
View File

@ -94,6 +94,18 @@ Bryan Stansell
- allow for very long replays (hundres of lines) : John Stoffel
<stoffel@lucent.com>
- log rotation by date : Tom Pachla <tom.pachla@nlc-bnc.ca>
- client config file (for -M, etc?) : Erik Sjolund
<erik.sjolund@sbc.su.se>
- strict file permission checks on conserver.passwd/conserver.cf : Erik
Sjolund <erik.sjolund@sbc.su.se>
- imbedded startup delays per remote host...or "group" of consoles in
some way 'cause some ssh connections to console servers need
significant throttling : Jay McCanta <mccantaj@amgen.com>
#
# $Id: TODO,v 1.45 2004/01/28 14:57:39 bryan Exp $
# $Id: TODO,v 1.46 2004/03/11 16:45:57 bryan Exp $
#

26
config.guess vendored
View File

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2004-02-02'
timestamp='2004-03-03'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -197,12 +197,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
amd64:OpenBSD:*:*)
echo x86_64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
cats:OpenBSD:*:*)
echo arm-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
@ -242,10 +248,21 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit 0 ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
@ -283,11 +300,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha*:OpenVMS:*:*)
echo alpha-hp-vms

View File

@ -324,6 +324,9 @@
/* Defined if we trust reverse DNS */
#undef TRUST_REVERSE_DNS
/* Defined if we produce extended messages */
#undef USE_EXTENDED_MESSAGES
/* use tcp_wrappers libwrap */
#undef USE_LIBWRAP

18
config.sub vendored
View File

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2004-02-02'
timestamp='2004-02-23'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -363,6 +363,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@ -442,12 +445,20 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@ -1143,8 +1154,9 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -ekkobsd* | -kfreebsd* | -freebsd* \
| -riscix* | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \

1769
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ AH_TEMPLATE([HAVE_OPENSSL], [have openssl support])
AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support])
AH_TEMPLATE([HAVE_SA_LEN],[Defined if sa_len member exists in struct sockaddr])
AH_TEMPLATE([TRUST_REVERSE_DNS],[Defined if we trust reverse DNS])
AH_TEMPLATE([USE_EXTENDED_MESSAGES],[Defined if we produce extended messages])
dnl ### Normal initialization. ######################################
AC_INIT
@ -215,6 +216,19 @@ AC_ARG_WITH(trustrevdns,
;;
esac],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(whether to display extended messages)
AC_ARG_WITH(extmsgs,
AC_HELP_STRING([--with-extmsgs],[Produce extended messages]),
[case "$withval" in
yes)
AC_DEFINE(USE_EXTENDED_MESSAGES)
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
esac],[AC_MSG_RESULT(no)])
dnl ### Check for compiler et al. ###################################
AC_PROG_CC
AC_PROG_INSTALL

View File

@ -91,9 +91,10 @@ default * {
default cyclades {
# sets up /dev/ttyC0 through /dev/ttyC31, for a 32 port card
# referenced as ports 1 through 32
type device;
device /dev/ttyC.;
devicesubst ,.d;
devicesubst .=Pd;
portbase -1;
portinc 1;
host none; # not really used, since devicesubst doesn't use it

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.cf.man,v 1.55 2003/12/21 16:23:03 bryan Exp $
.TH CONSERVER.CF 5 "2003/12/21" "conserver-8.1.1" "conserver"
.\" $Id: conserver.cf.man,v 1.58 2004/02/24 02:59:36 bryan Exp $
.TH CONSERVER.CF 5 "2004/02/24" "conserver-8.1.2" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)
@ -411,33 +411,73 @@ as the access to the console.
Only consoles of type ``device'' will use this value.
.TP
.B devicesubst
.RI [ " hp" [ n ] "f "
.RI [ c = t [ n ] f "[,...]"
| "" ]
.br
Perform string substitutions on the
Perform character substitutions on the
.B device
value.
.I h
is the character in
.B device
to replace with the
A series of replacements can be defined by specifying a
comma-separated list of
.IR c = t [ n ] f
sequences where
.I c
is any printable character,
.I t
specifies the replacement value,
.I n
is a field length (optional),
and
.I f
is the format string.
.I t
can be one of the characters below, catagorized as a string replacement
or a numeric replacement, which dictates the use of the
.I n
and
.I f
fields.
.RS
.RS
.sp
.PD 0
.TP
String Replacement
.TP
.B h
.B host
value and
.I p
is the character to replace with the
value
.TP
.B c
console name
.sp
.PP
Numeric Replacement
.TP
.B p
config
.B port
value.
The
.B port
value will be formatted to at least
value
.TP
.B P
calculated port value
.PD
.RE
.RE
.IP
For string replacements, if the replacement isn't at least
.I n
characters, it will be padded with space characters on the left.
.I f
must be `s'.
For numeric replacements, the value will be formatted to at least
.I n
characters, padded with 0s if
.I n
begins with a 0, and space characters otherwise.
.I f
must be either `d' or `x' or `X', specifying a decimal, lower-case
hexdecimal, or uppercase hexdecimal representation of
.BR port .
must be either `d', `x' or `X', specifying a decimal, lower-case
hexadecimal, or an uppercase hexadecimal conversion.
If the null string (``""'') is used, no replacements will be done.
.TP
.B exec
@ -455,33 +495,15 @@ keyword is specified, conserver will use the command ``/bin/sh -i''.
Only consoles of type ``exec'' will use this value.
.TP
.B execsubst
.RI [ " hp" [ n ] "f "
.RI [ c = t [ n ] f "[,...]"
| "" ]
.br
Perform string substitutions on the
Perform character substitutions on the
.B exec
value.
.I h
is the character in
.B exec
to replace with the
.B host
value and
.I p
is the character to replace with the
.B port
value.
The
.B port
value will be formatted to at least
.I n
characters, padded with 0s if
.I n
begins with a 0, and space characters otherwise.
.I f
must be either `d' or `x' or `X', specifying a decimal, lower-case
hexdecimal, or uppercase hexdecimal representation of
.BR port .
See the
.B devicesubst
option for an explanation of the format string.
If the null string (``""'') is used, no replacements will be done.
.TP
.B host
@ -493,12 +515,13 @@ as the host to connect to for accessing the console.
You must also set the
.B port
option as well.
Normally, only consoles of type ``host'' will use this value.
If the
.B devicesubst
Normally, only consoles of type ``host'' will use this value, however
if the
.BR devicesubst ,
.BR execsubst ,
or
.B execsubst
keywords are used in ``device'' and ``exec'' types, this value is used.
.B initsubst
keywords are used in any console type, this value is used.
.TP
.B idlestring
.RI [ " string "
@ -524,7 +547,8 @@ The default string is ``\en''.
.br
Set the idle timeout of the console to
.I number
seconds. If an `s', `m', or `h' is used after
seconds.
If an `s', `m', or `h' is used after
.IR number ,
the specified time is interpreted as seconds, minutes, or hours.
Set the timeout to zero to disable the idle timeout (the default).
@ -552,13 +576,26 @@ is passed as an argument to ``/bin/sh -ce''.
If the null string (``""'') is used, the command is unset and
nothing is invoked.
.TP
.B initsubst
.RI [ c = t [ n ] f "[,...]"
| "" ]
.br
Perform character substitutions on the
.B initcmd
value.
See the
.B devicesubst
option for an explanation of the format string.
If the null string (``""'') is used, no replacements will be done.
.TP
.B logfile
.RI [ " filename "
| "" ]
.br
Assign the logfile specified by
.I filename
to the console. Any occurrence of ``&'' in
to the console.
Any occurrence of ``&'' in
.I filename
will be replaced with the name of the console.
If the null string (``""'') is used, the logfile name is unset and
@ -764,24 +801,31 @@ The formula used is
.BR portbase " + "
.BR portinc " * " port .
By using proper values in the formula, you can reference ports on a
terminal server by their physical numbering of 1 through
.IR n .
terminal server by their physical numbering of
.RI 0.. n
or
.RI 1.. n
(depending on if you like zero-based or one-based numbering).
Warning: you can generate a \-1 value with this formula,
which will become a very high numbered positive
value (since things are stored unsigned).
You must also set the
.B host
option as well.
Normally, only consoles of type ``host'' will use this value.
If the
.B devicesubst
Normally, only consoles of type ``host'' will use this value, however
if the
.BR devicesubst ,
.BR execsubst ,
or
.B execsubst
keywords are used in ``device'' and ``exec'' types, this value is used.
.B initsubst
keywords are used in any console type, this value is used.
.TP
.B portbase
.I number
.br
Set the base value for the port calculation formula.
.I number
must be -1 or greater.
must be 0 or greater.
The default is zero.
See
.B port
@ -792,7 +836,7 @@ for the details of the formula.
.br
Set the increment value for the port calculation formula.
.I number
must be 1 or greater.
must be 0 or greater.
The default is one.
See
.B port
@ -880,7 +924,8 @@ can be specified to add logging of break sequences sent to the console.
.B type
.RB [ " device " | " exec " | " host " ]
.br
Set the type of console. The type
Set the type of console.
The type
.RB `` device ''
should be used for local serial ports (also set the
.B device

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.passwd.man,v 1.10 2004/01/08 16:12:33 bryan Exp $
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.1.1" "conserver"
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.1.2" "conserver"
.SH NAME
conserver.passwd \- user access information for
.BR conserver (8)

View File

@ -48,16 +48,17 @@ default cisco { type host; portbase 2000; portinc 1; }
default xyplex { type host; portbase 2000; portinc 100; }
# this is a cyclades card referenced with /dev/ttyC0 through /dev/ttyC31
# (referenced as ports 1 through 32 in conserver.cf)
# we set the various port calculation bits and pattern substitution to
# come up with a generic definition
default cyclades { type device; device /dev/ttyC&; baud 9600; parity none;
devicesubst .&d; portbase -1; portinc 1; host unused; }
devicesubst &=Pd; portbase -1; portinc 1; host unused; }
## this is a term server accessed with an ssh command
# it too uses pattern substitution and such to get the job done
default ciscossh { type exec; portbase 2000; portinc 1;
exec /usr/local/bin/ssh -p P -l tsuser H;
execsubst HPd; }
execsubst H=hs,P=Pd; }
# ------- set the global default for the first conserver host -------

View File

@ -47,16 +47,17 @@ default cisco { type host; portbase 2000; portinc 1; }
default xyplex { type host; portbase 2000; portinc 100; }
# this is a cyclades card referenced with /dev/ttyC0 through /dev/ttyC31
# (referenced as ports 1 through 32 in conserver.cf)
# we set the various port calculation bits and pattern substitution to
# come up with a generic definition
default cyclades { type device; device /dev/ttyC&; baud 9600; parity none;
devicesubst .&d; portbase -1; portinc 1; host unused; }
devicesubst &=Pd; portbase -1; portinc 1; host unused; }
## this is a term server accessed with an ssh command
# it too uses pattern substitution and such to get the job done
default ciscossh { type exec; portbase 2000; portinc 1;
exec /usr/local/bin/ssh -p P -l tsuser H;
execsubst HPd; }
execsubst H=hs,P=Pd; }
# ------- define the consoles on ts1.conserver.com --------

View File

@ -56,11 +56,11 @@
<INPUT type="HIDDEN" name="method" value="and"> <INPUT
type="HIDDEN" name="format" value="builtin-long">
<INPUT type="HIDDEN" name="sort" value="score"> <INPUT
type="HIDDEN" name="config" value="htdig"> <INPUT type=
"HIDDEN" name="restrict" value=""> <INPUT type="HIDDEN"
name="exclude" value=""> <INPUT type="TEXT" size="20"
name="words" value=""> <INPUT type="SUBMIT" value=
"Search">
type="HIDDEN" name="config" value="conserver.com">
<INPUT type="HIDDEN" name="restrict" value=""> <INPUT
type="HIDDEN" name="exclude" value=""> <INPUT type=
"TEXT" size="20" name="words" value=""> <INPUT type=
"SUBMIT" value="Search">
</FORM>
</TD>
</TR>
@ -181,11 +181,11 @@
<H3>Downloading</H3>
<P>The current version, released on Feb 10, 2004, is <A
href="8.1.1.tar.gz">8.1.1.tar.gz</A>. You can get it via
<P>The current version, released on Mar 11, 2004, is <A
href="8.1.2.tar.gz">8.1.2.tar.gz</A>. You can get it via
<A href=
"ftp://ftp.conserver.com/conserver/8.1.1.tar.gz">FTP</A>
or <A href="8.1.1.tar.gz">HTTP</A>. See the <A href=
"ftp://ftp.conserver.com/conserver/8.1.2.tar.gz">FTP</A>
or <A href="8.1.2.tar.gz">HTTP</A>. See the <A href=
"CHANGES">CHANGES</A> file for information on the latest
updates.</P>

View File

@ -1,5 +1,5 @@
/*
* $Id: client.c,v 5.79 2003/11/28 23:36:02 bryan Exp $
* $Id: client.c,v 5.80 2004/03/10 02:55:45 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -367,8 +367,7 @@ Replay(pCE, fdOut, iBack)
*/
#define WHEN_SPY 0x01
#define WHEN_ATTACH 0x02
#define WHEN_VT100 0x04
#define WHEN_EXPERT 0x08 /* ZZZ no way to set his yet */
#define WHEN_EXPERT 0x04 /* ZZZ no way to set his yet */
#define WHEN_ALWAYS 0x40
#define HALFLINE 40
@ -380,6 +379,7 @@ typedef struct HLnode {
static HELP aHLTable[] = {
{WHEN_ALWAYS, ". disconnect"},
{WHEN_ALWAYS, "; switch to another console"},
{WHEN_ALWAYS, "a attach read/write"},
{WHEN_ALWAYS, "b send broadcast message"},
{WHEN_ATTACH, "c toggle flow control"},
@ -403,16 +403,12 @@ static HELP aHLTable[] = {
{WHEN_ALWAYS, "x show console baud info"},
{WHEN_ALWAYS, "z suspend the connection"},
{WHEN_ATTACH, "| attach local command"},
{WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS, "? print this message"},
{WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS, "^R replay the last line"},
{WHEN_ATTACH, "\\ooo send character by octal code"},
{WHEN_EXPERT, "^I toggle tab expansion"},
{WHEN_EXPERT, "+(-) do (not) drop line"},
{WHEN_VT100, "PF1 print this message"},
{WHEN_VT100, "PF2 disconnect"},
{WHEN_VT100, "PF3 replay the last 20 lines"},
{WHEN_VT100, "PF4 spy read only"}
};
/* list the commands we know for the user (ksb)
@ -441,9 +437,6 @@ HelpUser(pCL)
} else {
FileWrite(pCL->fd, FLAGTRUE, acH2, sizeof(acH2) - 1);
}
if ('\033' == pCL->ic[0] && 'O' == pCL->ic[1]) {
iCmp |= WHEN_VT100;
}
BuildString((char *)0, acLine);
for (i = 0; i < sizeof(aHLTable) / sizeof(HELP); ++i) {

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.135 2004/01/28 14:47:52 bryan Exp $
* $Id: consent.c,v 5.137 2004/02/20 14:58:13 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -236,6 +236,23 @@ TtyDev(pCE)
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
return -1;
}
if (fDebug >= 2) {
int i;
Debug(2, "TtyDev(): [%s] termp.c_iflag=%lu", pCE->server,
(unsigned long)termp.c_iflag);
Debug(2, "TtyDev(): [%s] termp.c_oflag=%lu", pCE->server,
(unsigned long)termp.c_oflag);
Debug(2, "TtyDev(): [%s] termp.c_cflag=%lu", pCE->server,
(unsigned long)termp.c_cflag);
Debug(2, "TtyDev(): [%s] termp.c_lflag=%lu", pCE->server,
(unsigned long)termp.c_lflag);
#if defined(NCCS)
for (i = 0; i < NCCS; i++) {
Debug(2, "TtyDev(): [%s] termp.c_cc[%d]=%lu", pCE->server, i,
(unsigned long)termp.c_cc[i]);
}
#endif
}
# if HAVE_STROPTS_H
/*
* eat all the streams modules upto and including ttcompat
@ -741,7 +758,7 @@ ConsInit(pCE)
hp->h_length);
#endif
port.sin_family = hp->h_addrtype;
port.sin_port = htons(pCE->port);
port.sin_port = htons(pCE->netport);
if ((cofile = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
Error
@ -833,7 +850,7 @@ ConsInit(pCE)
pCE->execSlave);
break;
case HOST:
Verbose("[%s] port %hu on %s", pCE->server, pCE->port,
Verbose("[%s] port %hu on %s", pCE->server, pCE->netport,
pCE->host);
break;
case DEVICE:

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.h,v 5.55 2003/12/21 16:23:02 bryan Exp $
* $Id: consent.h,v 5.56 2004/02/20 14:58:14 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -92,8 +92,9 @@ typedef struct consent { /* console information */
#endif
/* type == HOST */
char *host; /* hostname */
unsigned short port; /* port number socket = portbase + */
unsigned short portbase; /* port base portinc * port */
unsigned short netport; /* final port | netport = portbase + */
unsigned short port; /* port number | portinc * port */
unsigned short portbase; /* port base */
unsigned short portinc; /* port increment */
unsigned short raw; /* raw or telnet protocol? */
/* type == EXEC */
@ -105,6 +106,7 @@ typedef struct consent { /* console information */
char *logfile; /* logfile */
off_t logfilemax; /* size limit for rolling logfile */
char *initcmd; /* initcmd command */
char *initsubst; /* initcmd substitution pattern */
char *motd; /* motd */
time_t idletimeout; /* idle timeout */
char *idlestring; /* string to print when idle */

View File

@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.40 2003/11/10 15:37:24 bryan Exp $
.TH CONSERVER 8 "2003/11/10" "conserver-8.1.1" "conserver"
.\" $Id: conserver.man,v 1.42 2004/03/11 17:52:08 bryan Exp $
.TH CONSERVER 8 "2004/03/11" "conserver-8.1.2" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS
@ -324,6 +324,37 @@ connect to remote consoles will result in an informative message to the user.
.B \-S
Do not run the server, just perform a syntax check of configuration file and
exit with a non-zero value if there is an error.
Using more than one
.B \-S
will cause conserver to output various information about each console in 5
colon-separated fields, enclosed in curly-braces.
The philosophy behind the output is to provide information to allow external
detection of multiple consoles access the same physical port.
Since this is
.I highly
environment-specific, conserver cannot do the check internally.
.RS
.TP 8
.I name
The name of the console.
.TP
.I master
The hostname of the master conserver host for the console.
.TP
.I aliases
The console aliases in a comma-separated list.
.TP
.I type
The type of console.
Values will be a `/' for a local device, `|' for
a command, or `!' for a remote port.
.TP
.I details
Multiple values are comma-separated and depend on the type of the console.
Local devices will have the values of the device file and baud rate/parity.
Commands will have string to invoke.
Remote ports will have the values of the remote hostname and port number.
.RE
.TP
.B \-u
Send unloved console output to

View File

@ -1,5 +1,5 @@
/*
* $Id: cutil.c,v 1.113 2004/01/18 13:05:43 bryan Exp $
* $Id: cutil.c,v 1.115 2004/03/11 16:23:59 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -1491,6 +1491,8 @@ VWrite(cfp, bufferonly, str, fmt, ap)
break;
case 's':
p = va_arg(ap, char *);
if (p == (char *)0)
p = "(null)";
{
int l = strlen(p);
int c;
@ -1934,6 +1936,19 @@ FileSawQuoteAbrt(cfp)
return r;
}
FLAG
#if PROTOTYPES
FileSawQuoteGoto(CONSFILE *cfp)
#else
FileSawQuoteGoto(cfp)
CONSFILE *cfp;
#endif
{
FLAG r = cfp->sawiacgoto;
cfp->sawiacgoto = FLAGFALSE;
return r;
}
#if HAVE_OPENSSL
/* Get the SSL instance */
SSL *
@ -2334,6 +2349,8 @@ ParseIACBuf(cfp, msg, len)
cfp->sawiacexec = FLAGTRUE;
else if (b[i] == OB_ABRT)
cfp->sawiacabrt = FLAGTRUE;
else if (b[i] == OB_GOTO)
cfp->sawiacgoto = FLAGTRUE;
else {
if (b[i] != OB_IAC)
Error

View File

@ -1,5 +1,5 @@
/*
* $Id: cutil.h,v 1.60 2004/01/18 13:05:43 bryan Exp $
* $Id: cutil.h,v 1.61 2004/03/10 02:55:45 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -20,6 +20,7 @@
*/
#define OB_IAC 0xff /* quote char */
#define OB_EXEC 'E' /* exec a command on the client */
#define OB_GOTO 'G' /* goto next console */
#define OB_SUSP 'Z' /* suspended by server */
#define OB_ABRT '.' /* abort */
@ -74,6 +75,7 @@ typedef struct consFile {
FLAG sawiacsusp;
FLAG sawiacexec;
FLAG sawiacabrt;
FLAG sawiacgoto;
#if HAVE_OPENSSL
/* SSL stuff */
SSL *ssl;
@ -142,6 +144,7 @@ extern void FileSetQuoteIAC PARAMS((CONSFILE *, FLAG));
extern FLAG FileSawQuoteSusp PARAMS((CONSFILE *));
extern FLAG FileSawQuoteExec PARAMS((CONSFILE *));
extern FLAG FileSawQuoteAbrt PARAMS((CONSFILE *));
extern FLAG FileSawQuoteGoto PARAMS((CONSFILE *));
extern void Bye PARAMS((int));
extern void DestroyDataStructures PARAMS((void));
extern int IsMe PARAMS((char *));

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.284 2004/01/18 16:33:25 bryan Exp $
* $Id: group.c,v 5.289 2004/03/10 02:55:45 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -167,6 +167,22 @@ SendAllClientsMsg(pGE, message)
}
}
void
#if PROTOTYPES
AbortAnyClientExec(CONSCLIENT *pCL)
#else
AbortAnyClientExec(pCL)
#endif
{
if (pCL->iState == S_CEXEC) {
FileSetQuoteIAC(pCL->fd, FLAGFALSE);
FilePrint(pCL->fd, FLAGTRUE, "%c%c", OB_IAC, OB_ABRT);
FileSetQuoteIAC(pCL->fd, FLAGTRUE);
pCL->fcon = 1;
pCL->iState = S_NORMAL;
}
}
void
#if PROTOTYPES
DisconnectClient(GRPENT *pGE, CONSCLIENT *pCL, char *message, FLAG force)
@ -184,6 +200,8 @@ DisconnectClient(pGE, pCL, message, force)
return;
}
AbortAnyClientExec(pCL);
if (pCL->fcon) {
FileWrite(pCL->fd, FLAGFALSE, message, -1);
}
@ -443,6 +461,7 @@ DestroyConsent(pGE, pCE)
for (pCL = pGE->pCLall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) {
if (pCL->pCEto != pCE)
continue;
AbortAnyClientExec(pCL);
if (pCL->fcon) {
FileWrite(pCL->fd, FLAGFALSE,
"[-- Conserver reconfigured - console has been (re)moved --]\r\n",
@ -502,6 +521,8 @@ DestroyConsent(pGE, pCE)
free(pCE->devicesubst);
if (pCE->execsubst != (char *)0)
free(pCE->execsubst);
if (pCE->initsubst != (char *)0)
free(pCE->initsubst);
if (pCE->logfile != (char *)0)
free(pCE->logfile);
if (pCE->initcmd != (char *)0)
@ -1847,7 +1868,7 @@ CommandExamine(pGE, pCLServing, pCEServing, tyme)
break;
case HOST:
BuildTmpString((char *)0);
d = BuildTmpStringPrint("%s/%hu", pCE->host, pCE->port);
d = BuildTmpStringPrint("%s/%hu", pCE->host, pCE->netport);
b = "Netwk";
p = ' ';
break;
@ -1911,6 +1932,7 @@ CommandForce(pGE, pCLServing, pCEServing, tyme)
FilePrint(pCLServing->fd, FLAGFALSE, "bumped %s]\r\n",
pCL->acid->string);
}
AbortAnyClientExec(pCL);
if (pCL->fcon)
FilePrint(pCL->fd, FLAGFALSE,
"\r\n[forced to `spy' mode by %s]\r\n",
@ -2016,7 +2038,7 @@ CommandInfo(pGE, pCLServing, pCEServing, tyme)
break;
case HOST:
FilePrint(pCLServing->fd, FLAGTRUE, "!:%s,%hu,%s",
pCE->host, pCE->port,
pCE->host, pCE->netport,
(pCE->raw ? "raw" : "telnet"));
break;
case DEVICE:
@ -2475,6 +2497,75 @@ DoCommandRead(pCEServing)
}
}
unsigned char CM[] = {
0xdf, 0xd2, 0xd2, 0xdf, 0xab, 0x90, 0x90, 0x93, 0xdf, 0x96,
0x8c, 0xdf, 0x9e, 0x91, 0xdf, 0xd5, 0x9e, 0x92, 0x9e, 0x85,
0x96, 0x91, 0x98, 0xd5, 0xdf, 0x9d, 0x9e, 0x91, 0x9b, 0xd1,
0xff, 0xdf, 0xd2, 0xd2, 0xdf, 0xb7, 0x9e, 0x89, 0x9a, 0xdf,
0x86, 0x90, 0x8a, 0xdf, 0x8d, 0x9a, 0x9e, 0x9b, 0xdf, 0x8b,
0x97, 0x9a, 0xdf, 0x92, 0x9e, 0x91, 0x8f, 0x9e, 0x98, 0x9a,
0xc0, 0xff, 0xdf, 0xd2, 0xd2, 0xdf, 0xbe, 0x93, 0x88, 0x9e,
0x86, 0x8c, 0xdf, 0x93, 0x9a, 0x8b, 0xdf, 0x8b, 0x97, 0x9a,
0xdf, 0x88, 0x90, 0x90, 0x94, 0x96, 0x9a, 0xdf, 0x88, 0x96,
0x91, 0xd1, 0xff, 0xdf, 0xd2, 0xd2, 0xdf, 0x89, 0x96, 0x92,
0xdf, 0x96, 0x8c, 0xdf, 0xd5, 0x8b, 0x90, 0x90, 0xd5, 0xdf,
0x9c, 0x90, 0x90, 0x93, 0xde, 0xff, 0xdf, 0xd2, 0xd2, 0xdf,
0xb3, 0x9e, 0x8b, 0x9a, 0x8d, 0x9e, 0x93, 0x8a, 0x8c, 0xc5,
0xdf, 0xc9, 0xd3, 0xc8, 0xd3, 0xca, 0xd3, 0xc7, 0xd3, 0xcb,
0xd3, 0xc6, 0xd3, 0xce, 0xcc, 0xd3, 0xce, 0xd3, 0xce, 0xcd,
0xd3, 0xcd, 0xd3, 0xce, 0xce, 0xd3, 0xcc, 0xd3, 0xce, 0xcf,
0xff, 0xdf, 0xd2, 0xd2, 0xdf, 0xb2, 0x90, 0x8a, 0x91, 0x8b,
0xdf, 0x9e, 0xdf, 0x91, 0x9a, 0x88, 0xdf, 0x8c, 0x9c, 0x8d,
0x9e, 0x8b, 0x9c, 0x97, 0xdf, 0x92, 0x90, 0x91, 0x94, 0x9a,
0x86, 0xdf, 0x9e, 0x91, 0x9b, 0xdf, 0x8b, 0x8d, 0x86, 0xdf,
0x9e, 0x98, 0x9e, 0x96, 0x91, 0xd1, 0xff, 0xdf, 0xd2, 0xd2,
0xdf, 0x96, 0x99, 0xdf, 0x86, 0x90, 0x8a, 0xdf, 0x9b, 0x9e,
0x8d, 0x9a, 0xd1, 0xd1, 0xd1, 0xff, 0xff
};
unsigned char *
#if PROTOTYPES
Challenge()
#else
Challenge()
#endif
{
int i;
static unsigned char **n = (unsigned char **)0;
static int cnt = 0;
static int cur = 0;
static int rnd = 0;
if (n == (unsigned char **)0) {
int j;
for (i = 0; i < sizeof(CM); i++) {
if (CM[i] == 0xff)
cnt++;
}
n = (unsigned char **)calloc(cnt, sizeof(unsigned char *));
j = 0;
for (i = 0; i < sizeof(CM); i++) {
if (n[j] == (unsigned char *)0)
n[j] = &(CM[i]);
if (CM[i] == 0xff) {
j++;
}
CM[i] = CM[i] ^ 0xff;
}
cnt--;
cur = time(NULL) % cnt;
rnd = time(NULL) % 2;
}
if (++rnd % 2 == 0) {
rnd = 0;
if (cur >= cnt)
cur = 0;
return n[cur++];
}
return n[cnt];
}
void
#if PROTOTYPES
DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
@ -3166,11 +3257,20 @@ DoClientRead(pGE, pCLServing)
pCLServing->iState = S_NORMAL;
switch (acIn[i]) {
case ';':
if (pCLServing->fcon == 1)
goto unknownchar;
FileWrite(pCLServing->fd, FLAGFALSE,
"connected]\r\n", -1);
pCLServing->fcon = 1;
if (pCLServing->fcon) {
FileSetQuoteIAC(pCLServing->fd,
FLAGFALSE);
FilePrint(pCLServing->fd, FLAGFALSE,
"%c%c", OB_IAC, OB_GOTO);
FileSetQuoteIAC(pCLServing->fd,
FLAGTRUE);
DisconnectClient(pGE, pCLServing,
(char *)0, FLAGFALSE);
} else {
FileWrite(pCLServing->fd, FLAGFALSE,
"connected]\r\n", -1);
pCLServing->fcon = 1;
}
break;
case '+':
case '-':
@ -3183,46 +3283,54 @@ DoClientRead(pGE, pCLServing)
"no drop line]\r\n", -1);
break;
case 'b': /* broadcast message */
#define DEPRECIATED FileWrite(pCLServing->fd, FLAGFALSE, "<use of DEPRECIATED (and undocumented) key> ", -1)
case 'B':
DEPRECIATED;
case 'b': /* broadcast message */
FileWrite(pCLServing->fd, FLAGFALSE,
"Enter message: ", -1);
pCLServing->iState = S_BCAST;
break;
case 'a': /* attach */
case 'A':
DEPRECIATED;
case 'a': /* attach */
CommandAttach(pGE, pCLServing, pCEServing,
tyme);
break;
case 'c':
case 'C':
DEPRECIATED;
case 'c':
CommandChangeFlow(pGE, pCLServing,
pCEServing, tyme);
break;
case 'd': /* down a console */
case 'D':
DEPRECIATED;
case 'd': /* down a console */
CommandDown(pGE, pCLServing, pCEServing,
tyme);
break;
case 'e': /* redefine escape keys */
case 'E':
DEPRECIATED;
case 'e': /* redefine escape keys */
pCLServing->iState = S_CATTN;
FileWrite(pCLServing->fd, FLAGFALSE,
"redef: ", -1);
break;
case 'f': /* force attach */
case 'F':
DEPRECIATED;
case 'f': /* force attach */
CommandForce(pGE, pCLServing, pCEServing,
tyme);
break;
case 'g': /* group info */
case 'G':
DEPRECIATED;
case 'g': /* group info */
FilePrint(pCLServing->fd, FLAGFALSE,
"group %s]\r\n",
pGE->pCEctl->server);
@ -3230,15 +3338,17 @@ DoClientRead(pGE, pCLServing)
tyme);
break;
case 'P': /* DEC vt100 pf1 */
case 'h': /* help */
case 'H':
case 'P': /* DEC vt100 pf1 */
DEPRECIATED;
case 'h': /* help */
case '?':
HelpUser(pCLServing);
break;
case 'i':
case 'I':
DEPRECIATED;
case 'i':
FileWrite(pCLServing->fd, FLAGFALSE,
"info]\r\n", -1);
CommandInfo(pGE, pCLServing, pCEServing,
@ -3272,8 +3382,9 @@ DoClientRead(pGE, pCLServing)
pCEServing->motd);
break;
case 'o': /* close and re-open line */
case 'O':
DEPRECIATED;
case 'o': /* close and re-open line */
CommandOpen(pGE, pCLServing, pCEServing,
tyme);
break;
@ -3285,6 +3396,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'R': /* DEC vt100 pf3 */
DEPRECIATED;
case 'r': /* replay 20 lines */
FileWrite(pCLServing->fd, FLAGFALSE,
"replay]\r\n", -1);
@ -3298,6 +3410,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'S': /* DEC vt100 pf4 */
DEPRECIATED;
case 's': /* spy mode */
pCLServing->fwantwr = 0;
if (!pCLServing->fwr) {
@ -3314,23 +3427,26 @@ DoClientRead(pGE, pCLServing)
"spying]\r\n", -1);
break;
case 'u': /* hosts on server this */
case 'U':
DEPRECIATED;
case 'u': /* hosts on server this */
FileWrite(pCLServing->fd, FLAGFALSE,
"hosts]\r\n", -1);
CommandHosts(pGE, pCLServing, pCEServing,
tyme);
break;
case 'v': /* version */
case 'V':
DEPRECIATED;
case 'v': /* version */
FilePrint(pCLServing->fd, FLAGFALSE,
"version `%s']\r\n",
THIS_VERSION);
break;
case 'w': /* who */
case 'W':
DEPRECIATED;
case 'w': /* who */
FilePrint(pCLServing->fd, FLAGFALSE,
"who %s]\r\n",
pCEServing->server);
@ -3338,8 +3454,9 @@ DoClientRead(pGE, pCLServing)
tyme);
break;
case 'x':
case 'X':
DEPRECIATED;
case 'x':
FileWrite(pCLServing->fd, FLAGFALSE,
"examine]\r\n", -1);
CommandExamine(pGE, pCLServing, pCEServing,
@ -3361,8 +3478,9 @@ DoClientRead(pGE, pCLServing)
pCLServing->iState = S_CWAIT;
break;
case 'z': /* suspend the client */
case 'Z':
DEPRECIATED;
case 'z': /* suspend the client */
case '\032':
FileSetQuoteIAC(pCLServing->fd, FLAGFALSE);
FilePrint(pCLServing->fd, FLAGFALSE,
@ -3429,29 +3547,12 @@ DoClientRead(pGE, pCLServing)
break;
case 'Q': /* DEC vt100 PF2 */
DEPRECIATED;
case '.': /* disconnect */
case '\004':
case '\003':
FileWrite(pCLServing->fd, FLAGFALSE,
"disconnect]\r\n", -1);
if (pCEServing->fup &&
pCEServing->type == DEVICE) {
if (-1 ==
tcgetattr(FileFDNum
(pCEServing->cofile),
&sbuf)) {
FileWrite(pCLServing->fd,
FLAGFALSE,
"[failed]\r\n", -1);
continue;
}
if (0 == (sbuf.c_iflag & IXOFF)) {
sbuf.c_iflag |= IXOFF | IXON;
tcsetattr(FileFDNum
(pCEServing->cofile),
TCSANOW, &sbuf);
}
}
DisconnectClient(pGE, pCLServing,
(char *)0, FLAGFALSE);
return;
@ -3483,9 +3584,14 @@ DoClientRead(pGE, pCLServing)
break;
default: /* unknown sequence */
unknownchar:
#if USE_EXTENDED_MESSAGES
FilePrint(pCLServing->fd, FLAGFALSE,
"unknown -- use `?'%s]\r\n",
Challenge());
#else
FileWrite(pCLServing->fd, FLAGFALSE,
"unknown -- use `?']\r\n", -1);
#endif
break;
}
continue;

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.174 2003/12/21 16:23:02 bryan Exp $
* $Id: main.c,v 5.178 2004/03/11 16:23:59 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -853,7 +853,7 @@ DumpDataStructures()
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
CONDDEBUG((1,
"DumpDataStructures(): group: id=%u pid=%lu, port=%hu, imembers=%d",
"DumpDataStructures(): group: id=%u port=%hu, pid=%lu, imembers=%d",
pGE->id, pGE->port, (unsigned long)pGE->pid,
pGE->imembers));
@ -864,8 +864,9 @@ DumpDataStructures()
"DumpDataStructures(): server=%s, type=DEVICE",
EMPTYSTR(pCE->server)));
CONDDEBUG((1,
"DumpDataStructures(): baud=%s, parity=%s",
pCE->baud->acrate, pCE->parity->key));
"DumpDataStructures(): baud=%s, parity=%s, device=%s",
pCE->baud->acrate, pCE->parity->key,
EMPTYSTR(pCE->device)));
break;
case EXEC:
CONDDEBUG((1,
@ -883,9 +884,9 @@ DumpDataStructures()
"DumpDataStructures(): server=%s, type=HOST",
EMPTYSTR(pCE->server)));
CONDDEBUG((1,
"DumpDataStructures(): host=%s, raw=%hu, port=%hu, telnetState=%d",
EMPTYSTR(pCE->host), pCE->raw, pCE->port,
pCE->telnetState));
"DumpDataStructures(): host=%s, raw=%hu, netport=%hu, port=%hu, telnetState=%d",
EMPTYSTR(pCE->host), pCE->raw, pCE->netport,
pCE->port, pCE->telnetState));
break;
case UNKNOWNTYPE:
CONDDEBUG((1,
@ -1311,7 +1312,7 @@ main(argc, argv)
optConf->redirect = FLAGFALSE;
break;
case 'S':
fSyntaxOnly = 1;
fSyntaxOnly++;
break;
case 'u':
fAll = 1;

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.c,v 5.163 2004/01/28 14:47:53 bryan Exp $
* $Id: readcfg.c,v 5.168 2004/03/11 16:23:59 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -605,6 +605,8 @@ DestroyParserDefaultOrConsole(c, ph, pt)
free(c->devicesubst);
if (c->execsubst != (char *)0)
free(c->execsubst);
if (c->initsubst != (char *)0)
free(c->initsubst);
if (c->logfile != (char *)0)
free(c->logfile);
if (c->initcmd != (char *)0)
@ -667,6 +669,8 @@ ApplyDefault(d, c)
c->logfilemax = d->logfilemax;
if (d->port != 0)
c->port = d->port;
if (d->netport != 0)
c->netport = d->netport;
if (d->portinc != 0)
c->portinc = d->portinc;
if (d->portbase != 0)
@ -739,6 +743,12 @@ ApplyDefault(d, c)
if ((c->execsubst = StrDup(d->execsubst)) == (char *)0)
OutOfMem();
}
if (d->initsubst != (char *)0) {
if (c->initsubst != (char *)0)
free(c->initsubst);
if ((c->initsubst = StrDup(d->initsubst)) == (char *)0)
OutOfMem();
}
if (d->logfile != (char *)0) {
if (c->logfile != (char *)0)
free(c->logfile);
@ -953,98 +963,235 @@ ProcessDevice(c, id)
void
#if PROTOTYPES
ProcessDevicesubst(CONSENT *c, char *id)
ProcessSubst(CONSENT *pCE, char **repl, char **str, char *name, char *id)
#else
ProcessDevicesubst(c, id)
CONSENT *c;
ProcessSubst(pCE, repl, str, name, id)
CONSENT *pCE;
char **repl;
char **str;
char *name;
char *id;
#endif
{
/*
* (CONSENT *pCE) and (char **repl) are used when a replacement is to
* actually happen...repl is the string to munch, pCE holds the data.
*
* (char **str) is used to store a copy of (char *id), if it passes
* the format check.
*
* the idea is that this is first called when the config file is read,
* putting the result in (char **str). then we call it again, near
* the end, permuting (char **repl) with values from (CONSENT *pCE) with
* the saved string now coming in as (char *id). got it?
*
* you could pass all arguments in...then both types of actions occur.
*/
char *p;
char *repfmt[255];
unsigned short repnum;
int i;
if (c->devicesubst != (char *)0) {
free(c->devicesubst);
c->devicesubst = (char *)0;
enum repstate {
REP_BEGIN,
REP_LTR,
REP_EQ,
REP_INT,
REP_END
} state;
if (str != (char **)0) {
if (*str != (char *)0) {
free(*str);
*str = (char *)0;
}
}
if ((id == (char *)0) || (*id == '\000'))
return;
if (strlen(id) < 3) {
if (isMaster)
Error("incomplete `devicesubst' option [%s:%d]", file, line);
return;
repnum = 0;
state = REP_BEGIN;
for (i = 0; i < 256; i++)
repfmt[i] = (char *)0;
for (p = id; *p != '\000'; p++) {
switch (state) {
case REP_BEGIN:
/* must be printable */
if (*p == ',' || !isgraph((int)(*p)))
goto subst_err;
/* make sure we haven't seen this replacement char yet */
repnum = (unsigned short)(*p);
if (repfmt[repnum] != (char *)0) {
if (isMaster)
Error
("substitution characters of `%s' option are the same [%s:%d]",
name, file, line);
return;
}
state = REP_LTR;
break;
case REP_LTR:
if (*p != '=')
goto subst_err;
state = REP_EQ;
break;
case REP_EQ:
repfmt[repnum] = p;
if (*p == 'h' || *p == 'c' || *p == 'p' || *p == 'P')
state = REP_INT;
else
goto subst_err;
break;
case REP_INT:
if (*p == 'd' || *p == 'x' || *p == 'X') {
if (*(repfmt[repnum]) != 'p' &&
*(repfmt[repnum]) != 'P')
goto subst_err;
state = REP_END;
} else if (*p == 's') {
if (*(repfmt[repnum]) != 'h' &&
*(repfmt[repnum]) != 'c')
goto subst_err;
state = REP_END;
} else if (!isdigit((int)(*p)))
goto subst_err;
break;
case REP_END:
if (*p != ',')
goto subst_err;
state = REP_BEGIN;
break;
}
}
if (id[0] == id[1]) {
if (state != REP_END) {
subst_err:
if (isMaster)
Error
("first two characters of `devicesubst' option are the same [%s:%d]",
file, line);
("invalid `%s' specification `%s' (char #%d: `%c') [%s:%d]",
name, id, (p - id) + 1, *p, file, line);
return;
}
for (p = id + 2; *p != '\000'; p++)
if (!isdigit((int)(*p)))
break;
/* if it wasn't a number followed by a d/x/X */
if (!((*p == 'd' || *p == 'x' || *p == 'X') && *(p + 1) == '\000')) {
if (isMaster)
Error("invalid `execsubst' specification `%s' [%s:%d]", id,
file, line);
return;
if (str != (char **)0) {
if ((*str = StrDup(id)) == (char *)0)
OutOfMem();
}
if ((c->devicesubst = StrDup(id)) == (char *)0)
OutOfMem();
}
if (pCE != (CONSENT *)0 && repl != (char **)0) {
static STRING *result = (STRING *)0;
void
#if PROTOTYPES
ProcessExecsubst(CONSENT *c, char *id)
#else
ProcessExecsubst(c, id)
CONSENT *c;
char *id;
#endif
{
char *p;
if (result == (STRING *)0)
result = AllocString();
BuildString((char *)0, result);
if (c->execsubst != (char *)0) {
free(c->execsubst);
c->execsubst = (char *)0;
for (p = *repl; *p != '\000'; p++) {
if (repfmt[(unsigned short)(*p)] != (char *)0) {
char *r = repfmt[(unsigned short)(*p)];
int plen = 0;
char *c = (char *)0;
int o = 0;
if (*r == 'h' || *r == 'c') {
/* check the pattern for a length */
if (isdigit((int)(*(r + 1))))
plen = atoi(r + 1);
if (*r == 'h')
c = pCE->host;
else if (*r == 'c')
c = pCE->server;
plen -= strlen(c);
/* pad it out, if necessary */
for (i = 0; i < plen; i++)
BuildStringChar(' ', result);
/* throw in the string */
BuildString(c, result);
} else {
unsigned short port = 0;
unsigned short base = 0;
int padzero = 0;
static STRING *num = (STRING *)0;
if (num == (STRING *)0)
num = AllocString();
BuildString((char *)0, num);
if (*r == 'p')
port = pCE->port;
if (*r == 'P')
port = pCE->netport;
/* check the pattern for a length and padding */
for (c = r + 1; *c != '\000'; c++)
if (!isdigit((int)(*c)))
break;
if (c != r + 1) {
plen = atoi(r + 1);
padzero = (r[1] == '0');
}
/* check for base */
switch (*c) {
case 'd':
base = 10;
break;
case 'x':
case 'X':
base = 16;
break;
default:
return;
}
while (port >= base) {
if (port % base >= 10)
BuildStringChar((port % base) - 10 +
(*c == 'x' ? 'a' : 'A'), num);
else
BuildStringChar((port % base) + '0', num);
port /= base;
}
if (port >= 10)
BuildStringChar(port - 10 +
(*c == 'x' ? 'a' : 'A'), num);
else
BuildStringChar(port + '0', num);
/* if we're supposed to be a certain length, pad it */
while (num->used - 1 < plen) {
if (padzero == 0)
BuildStringChar(' ', num);
else
BuildStringChar('0', num);
}
/* reverse the text to put it in forward order */
o = num->used - 1;
for (i = 0; i < o / 2; i++) {
char temp;
temp = num->string[i];
num->string[i]
= num->string[o - i - 1];
num->string[o - i - 1] = temp;
}
BuildStringN(num->string, o, result);
}
} else
BuildStringChar(*p, result);
}
free(*repl);
if ((*repl = StrDup(result->string)) == (char *)0)
OutOfMem();
}
if ((id == (char *)0) || (*id == '\000'))
return;
if (strlen(id) < 3) {
if (isMaster)
Error("incomplete `execsubst' option [%s:%d]", file, line);
return;
}
if (id[0] == id[1]) {
if (isMaster)
Error
("first two characters of `execsubst' option are the same [%s:%d]",
file, line);
return;
}
for (p = id + 2; *p != '\000'; p++)
if (!isdigit((int)(*p)))
break;
/* if it wasn't a number followed by a d/x/X */
if (!((*p == 'd' || *p == 'x' || *p == 'X') && *(p + 1) == '\000')) {
if (isMaster)
Error("invalid `execsubst' specification `%s' [%s:%d]", id,
file, line);
return;
}
if ((c->execsubst = StrDup(id)) == (char *)0)
OutOfMem();
return;
}
void
@ -1068,7 +1215,8 @@ DefaultItemDevicesubst(id)
#endif
{
CONDDEBUG((1, "DefaultItemDevicesubst(%s) [%s:%d]", id, file, line));
ProcessDevicesubst(parserDefaultTemp, id);
ProcessSubst((CONSENT *)0, (char **)0,
&(parserDefaultTemp->devicesubst), "devicesubst", id);
}
void
@ -1080,7 +1228,21 @@ DefaultItemExecsubst(id)
#endif
{
CONDDEBUG((1, "DefaultItemExecsubst(%s) [%s:%d]", id, file, line));
ProcessExecsubst(parserDefaultTemp, id);
ProcessSubst((CONSENT *)0, (char **)0, &(parserDefaultTemp->execsubst),
"execsubst", id);
}
void
#if PROTOTYPES
DefaultItemInitsubst(char *id)
#else
DefaultItemInitsubst(id)
char *id;
#endif
{
CONDDEBUG((1, "DefaultItemInitsubst(%s) [%s:%d]", id, file, line));
ProcessSubst((CONSENT *)0, (char **)0, &(parserDefaultTemp->initsubst),
"initsubst", id);
}
void
@ -1560,9 +1722,7 @@ ProcessPort(c, id)
/* if it was a number */
if (*p == '\000') {
if (((c->port = (unsigned short)atoi(id)) == 0) && isMaster)
Error("invalid port number `%s' [%s:%d]", id, file, line);
return;
c->port = (unsigned short)atoi(id) + 1;
} else {
/* non-numeric */
struct servent *se;
@ -1573,9 +1733,7 @@ ProcessPort(c, id)
id, file, line);
return;
} else {
if (((c->port = ntohs((unsigned short)se->s_port)) == 0) &&
isMaster)
Error("invalid port number `%s' [%s:%d]", id, file, line);
c->port = ntohs((unsigned short)se->s_port) + 1;
}
}
}
@ -1605,12 +1763,6 @@ ProcessPortinc(c, id)
return;
}
c->portinc = (unsigned short)atoi(id) + 1;
/* make sure the value was >=1 */
if (c->portinc <= 1) {
if (isMaster)
Error("invalid portinc number `%s' [%s:%d]", id, file, line);
c->portinc = 0;
}
}
void
@ -2161,6 +2313,26 @@ ConsoleEnd()
invalid = 1;
break;
}
if (parserConsoleTemp->initsubst != (char *)0 &&
parserConsoleTemp->initcmd != (char *)0) {
if (parserConsoleTemp->port == 0 ||
parserConsoleTemp->host == (char *)0) {
if (parserConsoleTemp->port == 0) {
if (isMaster)
Error
("[%s] console has 'initsubst' attribute without 'port' attribute (ignoring) [%s:%d]",
parserConsoleTemp->server, file, line);
}
if (parserConsoleTemp->host == (char *)0) {
if (isMaster)
Error
("[%s] console has 'initsubst' attribute without 'host' attribute (ignoring) [%s:%d]",
parserConsoleTemp->server, file, line);
}
free(parserConsoleTemp->initsubst);
parserConsoleTemp->initsubst = (char *)0;
}
}
if (invalid != 0) {
DestroyParserDefaultOrConsole(parserConsoleTemp, (CONSENT **)0,
@ -2250,109 +2422,6 @@ ExpandLogfile(c, id)
OutOfMem();
}
void
#if PROTOTYPES
DoSubstitution(char *sub, int port, char *host, char **string)
#else
DoSubstitution(sub, port, host, string)
char *sub;
int port;
char *host;
char **string;
#endif
{
char *p = (char *)0;
char *pstr = (char *)0;
int o = 0;
int i = 0;
int plen = 0;
int base = 0;
short padzero = 0;
STRING *result = (STRING *)0;
if (sub == (char *)0 || sub[0] == '\000' || sub[1] == '\000' ||
string == (char **)0 || *string == (char *)0 || host == (char *)0)
return;
if (result == (STRING *)0)
result = AllocString();
BuildString((char *)0, result);
/* check the pattern for a length and padding */
for (p = sub + 2; *p != '\000'; p++)
if (!isdigit((int)(*p)))
break;
if (p != sub + 2) {
plen = atoi(sub + 2);
padzero = (sub[2] == '0');
}
/* check for base */
switch (*p) {
case 'd':
base = 10;
break;
case 'x':
case 'X':
base = 16;
break;
default:
return;
}
while (port >= base) {
if (port % base >= 10)
BuildStringChar((port % base) - 10 + (*p == 'x' ? 'a' : 'A'),
result);
else
BuildStringChar((port % base) + '0', result);
port /= base;
}
if (port >= 10)
BuildStringChar(port - 10 + (*p == 'x' ? 'a' : 'A'), result);
else
BuildStringChar(port + '0', result);
/* if we're supposed to be a certain length, pad it */
while (result->used - 1 < plen) {
if (padzero == 0)
BuildStringChar(' ', result);
else
BuildStringChar('0', result);
}
/* reverse the text to put it in forward order */
o = result->used - 1;
for (i = 0; i < o / 2; i++) {
char temp;
temp = result->string[i];
result->string[i]
= result->string[o - i - 1];
result->string[o - i - 1] = temp;
}
if ((pstr = StrDup(result->string)) == (char *)0)
OutOfMem();
BuildString((char *)0, result);
for (o = 0, p = *string; *(p + o) != '\000'; o++) {
if (*(p + o) == sub[0]) {
BuildStringN(p, o, result);
BuildString(host, result);
p += o + 1;
o = -1;
} else if (*(p + o) == sub[1]) {
BuildStringN(p, o, result);
BuildString(pstr, result);
p += o + 1;
o = -1;
}
}
BuildStringN(p, o, result);
free(*string);
if ((*string = StrDup(result->string)) == (char *)0)
OutOfMem();
free(pstr);
}
/* this will adjust parserConsoles/parserConsolesTail if we're adding
* a new console.
*/
@ -2727,8 +2796,8 @@ ConsoleAdd(c)
SwapStr(&pCEmatch->host, &c->host);
closeMatch = 0;
}
if (pCEmatch->port != c->port) {
pCEmatch->port = c->port;
if (pCEmatch->netport != c->netport) {
pCEmatch->netport = c->netport;
closeMatch = 0;
}
break;
@ -2839,7 +2908,7 @@ ConsoleDestroy()
if (c->breakNum == 0)
c->breakNum = 1;
/* portbase and portinc values are +2 and +1, so a zero can
/* portbase, portinc, and port values are +2, +1, +1, so a zero can
* show that no value was given. defaults: portbase=0, portinc=1
*/
if (c->portbase != 0)
@ -2849,18 +2918,36 @@ ConsoleDestroy()
else
c->portinc = 1;
/* now calculate the "real" port number */
/* this formula should always give >= 0 because
* portbase >= -1, portinc >= 1, and port >= 1
/* if this is ever false, we don't actually use the port value, so
* doesn't matter if we "default" to zero...it's all enforced in
* ConsoleEnd()
*/
c->port = c->portbase + c->portinc * c->port;
if (c->port != 0)
c->port--;
/* now calculate the "real" port number */
/* this formula could give -1 because
* portbase >= -1, portinc >= 0, and port >= 0
* since it's an unsigned type, it'll wrap back around
* look very, very, bizarre. but, oh well. yeah, a
* user can shoot himself in the foot with a bad config
* file, but it won't hurt too much.
*/
c->netport = c->portbase + c->portinc * c->port;
/* check for substitutions */
if (c->type == DEVICE && c->devicesubst != (char *)0)
DoSubstitution(c->devicesubst, c->port, c->host, &(c->device));
ProcessSubst(c, &(c->device), (char **)0, (char *)0,
c->devicesubst);
if (c->type == EXEC && c->execsubst != (char *)0)
DoSubstitution(c->execsubst, c->port, c->host, &(c->exec));
ProcessSubst(c, &(c->exec), (char **)0, (char *)0,
c->execsubst);
if (c->initcmd != (char *)0 && c->initsubst != (char *)0)
ProcessSubst(c, &(c->initcmd), (char **)0, (char *)0,
c->initsubst);
/* go ahead and do the '&' substitution */
if (c->logfile != (char *)0) {
@ -2925,6 +3012,48 @@ ConsoleDestroy()
/* now remember where we're headed and do the dirty work */
cNext = c->pCEnext;
if (fSyntaxOnly > 1) {
static STRING *s = (STRING *)0;
if (s == (STRING *)0)
s = AllocString();
BuildString((char *)0, s);
BuildString(BuildTmpStringPrint
("{%s:%s:", c->server, c->master), s);
if (c->aliases != (NAMES *)0) {
NAMES *n;
for (n = c->aliases; n != (NAMES *)0; n = n->next) {
if (n == c->aliases)
BuildStringChar(',', s);
BuildString(n->name, s);
}
}
BuildStringChar(':', s);
switch (c->type) {
case EXEC:
BuildString(BuildTmpStringPrint
("|:%s",
(c->exec !=
(char *)0 ? c->exec : "/bin/sh")), s);
break;
case HOST:
BuildString(BuildTmpStringPrint
("!:%s,%hu", c->host, c->netport), s);
break;
case DEVICE:
BuildString(BuildTmpStringPrint
("/:%s,%s%c", c->device,
(c->baud ? c->baud->acrate : ""),
(c->parity ? c->parity->key[0] : ' ')),
s);
break;
case UNKNOWNTYPE: /* shut up gcc */
break;
}
BuildStringChar('}', s);
Msg("%s", s->string);
}
ConsoleAdd(c);
}
@ -3119,7 +3248,8 @@ ConsoleItemDevicesubst(id)
#endif
{
CONDDEBUG((1, "ConsoleItemDevicesubst(%s) [%s:%d]", id, file, line));
ProcessDevicesubst(parserConsoleTemp, id);
ProcessSubst((CONSENT *)0, (char **)0,
&(parserConsoleTemp->devicesubst), "devicesubst", id);
}
void
@ -3131,7 +3261,21 @@ ConsoleItemExecsubst(id)
#endif
{
CONDDEBUG((1, "ConsoleItemExecsubst(%s) [%s:%d]", id, file, line));
ProcessExecsubst(parserConsoleTemp, id);
ProcessSubst((CONSENT *)0, (char **)0, &(parserConsoleTemp->execsubst),
"execsubst", id);
}
void
#if PROTOTYPES
ConsoleItemInitsubst(char *id)
#else
ConsoleItemInitsubst(id)
char *id;
#endif
{
CONDDEBUG((1, "ConsoleItemInitsubst(%s) [%s:%d]", id, file, line));
ProcessSubst((CONSENT *)0, (char **)0, &(parserConsoleTemp->initsubst),
"initsubst", id);
}
void
@ -4302,6 +4446,7 @@ ITEM keyDefault[] = {
{"idletime", DefaultItemIdletimeout},
{"include", DefaultItemInclude},
{"initcmd", DefaultItemInitcmd},
{"initsubst", DefaultItemInitsubst},
{"logfile", DefaultItemLogfile},
{"logfilemax", DefaultItemLogfilemax},
{"master", DefaultItemMaster},
@ -4333,6 +4478,7 @@ ITEM keyConsole[] = {
{"idletimeout", ConsoleItemIdletimeout},
{"include", ConsoleItemInclude},
{"initcmd", ConsoleItemInitcmd},
{"initsubst", ConsoleItemInitsubst},
{"logfile", ConsoleItemLogfile},
{"logfilemax", ConsoleItemLogfilemax},
{"master", ConsoleItemMaster},

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.57 2004/02/10 15:24:50 bryan Exp $
* $Id: version.h,v 1.58 2004/02/17 15:34:42 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -14,4 +14,4 @@
@(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n"
#define THIS_VERSION "conserver.com version 8.1.1"
#define THIS_VERSION "conserver.com version 8.1.2"

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.155 2004/01/08 16:12:46 bryan Exp $
* $Id: console.c,v 5.157 2004/03/10 02:55:47 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -57,6 +57,7 @@ int disconnectCount = 0;
STRING *execCmd = (STRING *)0;
CONSFILE *execCmdFile = (CONSFILE *)0;
pid_t execCmdPid = 0;
int gotoConsole = 0;
#if HAVE_OPENSSL
SSL_CTX *ctx = (SSL_CTX *)0;
@ -782,6 +783,57 @@ ExecCmd()
return;
}
void
#if PROTOTYPES
GetUserInput(STRING *str)
#else
GetUserInput(str)
STRING *str;
#endif
{
char c;
if (str == (STRING *)0)
return;
BuildString((char *)0, str);
for (;;) {
if (read(0, &c, 1) == 0)
break;
if (c == '\n' || c == '\r') {
break;
}
if (c >= ' ' && c <= '~') {
BuildStringChar(c, str);
FileWrite(cfstdout, FLAGFALSE, &c, 1);
} else if ((c == '\b' || c == 0x7f) && str->used > 1) {
FileWrite(cfstdout, FLAGFALSE, "\b \b", 3);
str->string[str->used - 2] = '\000';
str->used--;
} else if ((c == 0x15) && str->used > 1) {
while (str->used > 1) {
FileWrite(cfstdout, FLAGFALSE, "\b \b", 3);
str->string[str->used - 2] = '\000';
str->used--;
}
} else if ((c == 0x17) && str->used > 1) {
while (str->used > 1 &&
isspace((int)(str->string[str->used - 2]))) {
FileWrite(cfstdout, FLAGFALSE, "\b \b", 3);
str->string[str->used - 2] = '\000';
str->used--;
}
while (str->used > 1 &&
!isspace((int)(str->string[str->used - 2]))) {
FileWrite(cfstdout, FLAGFALSE, "\b \b", 3);
str->string[str->used - 2] = '\000';
str->used--;
}
}
}
}
void
#if PROTOTYPES
DoExec(CONSFILE *pcf)
@ -791,34 +843,10 @@ DoExec(pcf)
#endif
{
FileWrite(cfstdout, FLAGFALSE, "exec: ", 6);
BuildString((char *)0, execCmd);
for (;;) {
char c;
if (read(0, &c, 1) == 0)
break;
if (c == '\n' || c == '\r') {
FileWrite(cfstdout, FLAGFALSE, "]\r\n", 3);
break;
}
if (c == '\a' || (c >= ' ' && c <= '~')) {
BuildStringChar(c, execCmd);
FileWrite(cfstdout, FLAGFALSE, &c, 1);
} else if ((c == '\b' || c == 0x7f) && execCmd->used > 1) {
if (execCmd->string[execCmd->used - 2] != '\a') {
FileWrite(cfstdout, FLAGFALSE, "\b \b", 3);
}
execCmd->string[execCmd->used - 2] = '\000';
execCmd->used--;
} else if ((c == 0x15) && execCmd->used > 1) {
while (execCmd->used > 1) {
if (execCmd->string[execCmd->used - 2] != '\a') {
FileWrite(cfstdout, FLAGFALSE, "\b \b", 3);
}
execCmd->string[execCmd->used - 2] = '\000';
execCmd->used--;
}
}
}
GetUserInput(execCmd);
FileWrite(cfstdout, FLAGFALSE, "]\r\n", 3);
if (execCmd != (STRING *)0 && execCmd->used > 1) {
ExecCmd();
BuildString((char *)0, execCmd);
@ -880,6 +908,7 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
char *r = (char *)0;
static char acMesg[8192];
gotoConsole = 0;
if (fVerbose) {
Msg("%s to %s (on %s)", pcHow, pcMach, pcMaster);
}
@ -1076,22 +1105,35 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
}
while ((l = ParseIACBuf(pcf, acMesg, &nc)) >= 0) {
if (l == 0) {
if (FileSawQuoteExec(pcf) == FLAGTRUE)
DoExec(pcf);
if (FileSawQuoteSusp(pcf) == FLAGTRUE) {
justSuspended = 1;
if (execCmdFile == (CONSFILE *)0) {
if (FileSawQuoteExec(pcf) == FLAGTRUE)
DoExec(pcf);
else if (FileSawQuoteSusp(pcf) == FLAGTRUE) {
justSuspended = 1;
#if defined(SIGSTOP)
FileWrite(cfstdout, FLAGFALSE, "stop]", 5);
C2Cooked();
kill(thepid, SIGSTOP);
C2Raw();
FileWrite(cfstdout, FLAGFALSE,
"[press any character to continue", 32);
FileWrite(cfstdout, FLAGFALSE, "stop]", 5);
C2Cooked();
kill(thepid, SIGSTOP);
C2Raw();
FileWrite(cfstdout, FLAGFALSE,
"[press any character to continue",
32);
#else
FileWrite(cfstdout, FLAGFALSE,
"stop not supported -- press any character to continue",
53);
FileWrite(cfstdout, FLAGFALSE,
"stop not supported -- press any character to continue",
53);
#endif
} else if (FileSawQuoteGoto(pcf) == FLAGTRUE) {
gotoConsole = 1;
break;
}
} else {
if (FileSawQuoteAbrt(pcf) == FLAGTRUE) {
FD_CLR(FileFDNum(execCmdFile), &rinit);
FD_CLR(FileFDOutNum(execCmdFile), &winit);
FileClose(&execCmdFile);
kill(execCmdPid, SIGHUP);
}
}
continue;
}
@ -1328,11 +1370,6 @@ DoCmds(master, ports, cmdi)
FileClose(&pcf);
continue;
} else {
/* right now, we can only connect to one console, so it's ok
* to clear the password. if we were allowed to connect to
* multiple consoles (somehow), either in parallel or serial,
* we wouldn't want to do this here */
ClearPassword();
CallUp(pcf, server, cmdarg, cmds[0], result);
return 0;
}
@ -1423,9 +1460,10 @@ main(argc, argv)
extern int optopt;
extern char *optarg;
int i;
STRING *textMsg = (STRING *)0;
static STRING *textMsg = (STRING *)0;
int cmdi;
int retval;
static STRING *consoleName = (STRING *)0;
isMultiProc = 0; /* make sure stuff DOESN'T have the pid */
@ -1698,7 +1736,31 @@ main(argc, argv)
cmds[++cmdi] = "master";
}
retval = DoCmds(pcInMaster, acPorts->string, cmdi);
for (;;) {
char *ports;
if ((ports = StrDup(acPorts->string)) == (char *)0)
OutOfMem();
retval = DoCmds(pcInMaster, ports, cmdi);
free(ports);
/* if we didn't "call" or we didn't ask for another console, abort */
if (cmds[cmdi][0] != 'c' || gotoConsole == 0)
break;
if (consoleName == (STRING *)0)
consoleName = AllocString();
C2Raw();
if (gotoConsole == -1)
FileWrite(cfstdout, FLAGFALSE, "[console: ", 10);
else
FileWrite(cfstdout, FLAGFALSE, "console: ", 9);
GetUserInput(consoleName);
FileWrite(cfstdout, FLAGFALSE, "]\r\n", 3);
C2Cooked();
if (consoleName->used <= 1)
break;
cmdarg = consoleName->string;
gotoConsole = -1;
}
if (*pcCmd == 'd')
FilePrint(cfstdout, FLAGFALSE, "Disconnected %d users\n",

View File

@ -1,5 +1,5 @@
.\" $Id: console.man,v 1.42 2003/12/25 19:22:02 bryan Exp $
.TH CONSOLE 1 "2003/12/25" "conserver-8.1.1" "conserver"
.\" $Id: console.man,v 1.44 2004/03/11 16:23:29 bryan Exp $
.TH CONSOLE 1 "2004/03/11" "conserver-8.1.2" "conserver"
.SH NAME
console \- console server client program
.SH SYNOPSIS
@ -318,8 +318,8 @@ a command, or `!' for a remote port.
.TP
.I console-details
The details regarding the console.
The values here (all comma separated) depend on the type of the console.
Local devices will have values of the device file, baud rate, and
The values here (all comma-separated) depend on the type of the console.
Local devices will have values of the device file, baud rate/parity, and
file descriptor for the device.
Commands will have values of the command, the command's pid, the
pseudo-tty, and file descriptor for the pseudo-tty.
@ -347,7 +347,7 @@ that the server can open the file for read, but not write.
.TP
.I logfile-details
The details regarding the logging for the console.
The comma separated
The comma-separated
values will be the logfile, ``log'' or ``nolog'' (if logging is on
or not - toggled via ^EcL), ``act'' or ``noact'' (if activity logging is
enabled or not - the `a' timestamp option), the timestamp interval, and
@ -362,10 +362,10 @@ is at work, it will have the value of ``autoup'', otherwise it
will be ``noautoup''.
.TP
.I aliases
The console aliases are presented in a comma separated list.
The console aliases are presented in a comma-separated list.
.TP
.I options
The active options for the console are presented in a comma separated list.
The active options for the console are presented in a comma-separated list.
.TP
.I initcmd
The initcmd configuration option for the console.
@ -387,6 +387,12 @@ Commands are:
.sp
.PD 0
.TP 13
.B \.
disconnect
.TP
.B ;
disconnect and login to another console
.TP
.B a
attach read-write if nobody already is
.TP
@ -470,8 +476,6 @@ replay the last line only
send character having octal code
.IR ooo " (must"
specify three octal digits)
.IP \.
disconnect
.PD
.PP
If any other character is hit after the escape sequence, all three characters

View File

@ -88,15 +88,6 @@
#define const
#endif
#include <sys/cdefs.h>
#ifndef __NetBSD__
#if 1
static const char rcsid[] = "Id: chat.c,v 1.26 1999/12/23 01:39:54 paulus Exp ";
#else
__RCSID("$NetBSD: chat.c,v 1.25 2001/09/24 13:22:38 wiz Exp $");
#endif
#endif
#include <stdio.h>
#include <ctype.h>
#include <time.h>

View File

@ -4,7 +4,7 @@
#
%define pkg conserver
%define ver 8.1.1
%define ver 8.1.2
# define the name of the machine on which the main conserver
# daemon will be running if you don't want to use the default

View File

@ -1,7 +1,7 @@
PKG="conserver"
NAME="Console server and client"
CATEGORY="system"
VERSION="8.1.1"
VERSION="8.1.2"
DESC="Console server and client"
CLASSES=none
ARCH=sparc

View File

@ -1,17 +1,18 @@
[Enter `^Ec?' for help]
[help]
. disconnect a attach read/write
b send broadcast message c toggle flow control
d down a console e change escape sequence
f force attach read/write g group info
i information dump L toggle logging on/off
l? break sequence list l0 send break per config file
l1-9 send specific break sequence m display the message of the day
o (re)open the tty and log file p replay the last 60 lines
r replay the last 20 lines s spy read only
u show host status v show version info
w who is on this console x show console baud info
z suspend the connection | attach local command
<cr> ignore/abort command ? print this message
^R replay the last line \ooo send character by octal code
. disconnect ; switch to another console
a attach read/write b send broadcast message
c toggle flow control d down a console
e change escape sequence f force attach read/write
g group info i information dump
L toggle logging on/off l? break sequence list
l0 send break per config file l1-9 send specific break sequence
m display the message of the day o (re)open the tty and log file
p replay the last 60 lines r replay the last 20 lines
s spy read only u show host status
v show version info w who is on this console
x show console baud info z suspend the connection
| attach local command ? print this message
<cr> ignore/abort command ^R replay the last line
\ooo send character by octal code
[disconnect]

View File

@ -1,17 +1,18 @@
[Enter `^Ec?' for help]
[help]
. disconnect a attach read/write
b send broadcast message c toggle flow control
d down a console e change escape sequence
f force attach read/write g group info
i information dump L toggle logging on/off
l? break sequence list l0 send break per config file
l1-9 send specific break sequence m display the message of the day
o (re)open the tty and log file p replay the last 60 lines
r replay the last 20 lines s spy read only
u show host status v show version info
w who is on this console x show console baud info
z suspend the connection | attach local command
<cr> ignore/abort command ? print this message
^R replay the last line \ooo send character by octal code
. disconnect ; switch to another console
a attach read/write b send broadcast message
c toggle flow control d down a console
e change escape sequence f force attach read/write
g group info i information dump
L toggle logging on/off l? break sequence list
l0 send break per config file l1-9 send specific break sequence
m display the message of the day o (re)open the tty and log file
p replay the last 60 lines r replay the last 20 lines
s spy read only u show host status
v show version info w who is on this console
x show console baud info z suspend the connection
| attach local command ? print this message
<cr> ignore/abort command ^R replay the last line
\ooo send character by octal code
[disconnect]