Imported from conserver-8.1.11.tar.gz

This commit is contained in:
Bryan Stansell 2004-11-09 01:34:27 -08:00
parent 4ce124e121
commit 892f52dbd4
24 changed files with 277 additions and 180 deletions

21
CHANGES
View File

@ -1,9 +1,24 @@
CHANGES
=======
version 8.1.11 (Nov 9, 2004):
- fixed array bounds and stack tromping - reported by Emmett
Hogan <hogan@bigcityit.com>
- most recent client to ask for read-write now gets it (used to
be first client to connect)
- client read-write mode now separate from console up/down state
- 'make autologin.install' now compiles autologin - reported by
Graham Merrill <teddgram@sbcglobal.net>
- new 'autocomplete' option for controlling shortest-prefix
console name matching (which has always been on)
- client now blocks on ^Eco, waiting for status of connection
- added 'a' and 'A' for upper and lowercase alphanumeric
(0-9a-z) conversions to the *subst config items - based on
patch by Jonathan Chen <jon+conserver@spock.org>
version 8.1.10 (Sep 21, 2004):
- fix "forwarding level too deep" issue with '^Ec;' - reported by Han
Pilmeyer <han.pilmeyer@hp.com>
- fix "forwarding level too deep" issue with '^Ec;' - reported
by Han Pilmeyer <han.pilmeyer@hp.com>
version 8.1.9 (Jul 14, 2004):
- fixed bug processing access lists when duplicates exist in the
@ -773,5 +788,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.193 2004/09/21 23:45:20 bryan Exp $
# $Id: CHANGES,v 1.196 2004/11/09 09:01:41 bryan Exp $
#

4
TODO
View File

@ -100,6 +100,8 @@ Bryan Stansell
- send sequences to console on client connect? (to repaint screen,
for example) : John Cagle <jcagle@gmail.com>
- uucp locks : Sebastian Zagrodzki <sebek@heron.net.icm.edu.pl>
#
# $Id: TODO,v 1.51 2004/09/21 23:45:30 bryan Exp $
# $Id: TODO,v 1.52 2004/11/06 01:03:36 bryan Exp $
#

View File

@ -45,7 +45,7 @@ clean:
distclean: clean
rm -f Makefile
install:
install: autologin
$(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) autologin $(DESTDIR)$(bindir)

9
config.guess vendored
View File

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
timestamp='2004-09-07'
timestamp='2004-10-25'
# 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
@ -342,7 +342,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
esac ;;
@ -1247,7 +1247,10 @@ EOF
A*) echo alpha-dec-vms && exit 0 ;;
I*) echo ia64-dec-vms && exit 0 ;;
V*) echo vax-dec-vms && exit 0 ;;
esac
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.cf.man,v 1.68 2004/07/14 05:28:42 bryan Exp $
.TH CONSERVER.CF 5 "2004/07/14" "conserver-8.1.10" "conserver"
.\" $Id: conserver.cf.man,v 1.69 2004/11/06 00:20:30 bryan Exp $
.TH CONSERVER.CF 5 "2004/11/06" "conserver-8.1.11" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)
@ -507,8 +507,9 @@ characters, padded with 0s if
.I n
begins with a 0, and space characters otherwise.
.I f
must be either `d', `x' or `X', specifying a decimal, lower-case
hexadecimal, or an uppercase hexadecimal conversion.
must be either `d', `x', `X', `a', or `A', specifying a decimal, lowercase
hexadecimal (0-9a-f), uppercase hexadecimal (0-9A-F), lowercase
alphanumeric (0-9a-z), or uppercase alphanumeric (0-9A-Z) conversion.
If the null string (``\f3""\fP'') is used, no replacements will be done.
.TP
\f3exec\fP \f2command|\f3""\fP

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.10" "conserver"
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.1.11" "conserver"
.SH NAME
conserver.passwd \- user access information for
.BR conserver (8)

View File

@ -161,7 +161,7 @@
He isn't actively developing it, however, according to
the website. Next, there's Kevin Braunsdorf's version at
<A href=
"ftp://ftp.physics.purdue.edu/pub/pundits/">ftp://ftp.physics.purdue.edu/pub/pundits/</A>.
"http://www.npcguild.org/software/pundits/">http://www.npcguild.org/software/pundits/</A>.
It doesn't look like Kevin is working on his thread ony
more either. No new versions have been out since August
2000 (version 8.5), but maybe this info will be out of
@ -183,11 +183,11 @@
<H3>Downloading</H3>
<P>The current version, released on Sep 21, 2004, is <A
href="8.1.10.tar.gz">8.1.10.tar.gz</A>. You can get it
<P>The current version, released on Nov 9, 2004, is <A
href="8.1.11.tar.gz">8.1.11.tar.gz</A>. You can get it
via <A href=
"ftp://ftp.conserver.com/conserver/8.1.10.tar.gz">FTP</A>
or <A href="8.1.10.tar.gz">HTTP</A>. See the <A href=
"ftp://ftp.conserver.com/conserver/8.1.11.tar.gz">FTP</A>
or <A href="8.1.11.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.84 2004/05/28 16:39:51 bryan Exp $
* $Id: client.c,v 5.85 2004/10/25 07:18:18 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -67,9 +67,7 @@ FindWrite(pCE)
* most recent or some such... I guess it doesn't matter that
* much.
*/
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly ||
!(pCE->fup && pCE->ioState == ISNORMAL &&
pCE->initfile == (CONSFILE *)0))
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly)
return;
for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
@ -89,6 +87,25 @@ FindWrite(pCE)
}
}
void
#if PROTOTYPES
BumpClient(CONSENT *pCE, char *message)
#else
BumpClient(pCE, message)
CONSENT *pCE;
char *message;
#endif
{
if ((CONSCLIENT *)0 == pCE->pCLwr)
return;
if ((char *)0 != message)
FileWrite(pCE->pCLwr->fd, FLAGFALSE, message, -1);
pCE->pCLwr->fwantwr = 0;
pCE->pCLwr->fwr = 0;
pCE->pCLwr = (CONSCLIENT *)0;
}
/* replay last iBack lines of the log file upon connect to console (ksb)
*
* NB: we know the console might be spewing when the replay happens,

View File

@ -1,5 +1,5 @@
/*
* $Id: client.h,v 5.36 2003/12/25 19:22:00 bryan Exp $
* $Id: client.h,v 5.38 2004/10/25 07:18:18 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -58,6 +58,7 @@ typedef struct client { /* Connection Information: */
short fwantwr; /* (client) wants to write */
short fro; /* read-only permission */
short fecho; /* echo commands (not set by machines) */
short fiwait; /* client wanting for console init */
STRING *acid; /* login and location of client */
STRING *peername; /* location of client */
STRING *username; /* login of client */
@ -88,3 +89,4 @@ extern void Replay PARAMS((CONSENT *, CONSFILE *, int));
extern void HelpUser PARAMS((CONSCLIENT *));
extern void FindWrite PARAMS((CONSENT *));
extern int ClientAccessOk PARAMS((CONSCLIENT *));
extern void BumpClient PARAMS((CONSENT *, char *));

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.140 2004/06/03 21:53:59 bryan Exp $
* $Id: consent.c,v 5.144 2004/10/25 07:25:35 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -324,20 +324,6 @@ StartInit(pCE)
StopInit(pCE);
}
if (pCE->pCLwr != (CONSCLIENT *)0) {
CONSCLIENT *pCL = pCE->pCLwr;
pCL->fwr = 0;
pCL->fwantwr = 1;
/*
FileWrite(pCL->fd,
"[forced to `spy' mode by initialization command]\r\n",
-1);
TagLogfileAct(pCE, "initialization command bumped %s",
pCL->acid->string);
*/
pCE->pCLwr = (CONSCLIENT *)0;
}
/* pin[0] = parent read, pin[1] = child write */
if (pipe(pin) != 0) {
Error("[%s] StartInit(): pipe(): %s", pCE->server,
@ -606,6 +592,39 @@ VirtDev(pCE)
return -1;
}
char *
#if PROTOTYPES
ConsState(CONSENT *pCE)
#else
ConsState(pCE)
CONSENT *pCE;
#endif
{
if (!pCE->fup)
return "down";
if (pCE->initfile != (CONSFILE *)0)
return "initializing";
switch (pCE->ioState) {
case ISNORMAL:
return "up";
case INCONNECT:
return "connecting";
case ISDISCONNECTED:
return "disconnected";
#if HAVE_OPENSSL
case INSSLACCEPT:
return "SSL_accept";
case INSSLSHUTDOWN:
return "SSL_shutdown";
#endif
case ISFLUSHING:
return "flushing";
}
return "in unknown state";
}
/* down a console, virtual or real (ksb)
*
* this should be kept pretty simple, 'cause the config file reading code
@ -843,15 +862,14 @@ ConsInit(pCE)
if (ret == 0) {
pCE->ioState = ISNORMAL;
pCE->stateTimer = 0;
pCE->fup = 1;
} else {
pCE->ioState = INCONNECT;
pCE->stateTimer = time((time_t *)0) + CONNECTTIMEOUT;
if (timers[T_STATE] == (time_t)0 ||
timers[T_STATE] > pCE->stateTimer)
timers[T_STATE] = pCE->stateTimer;
pCE->fup = 1;
}
pCE->fup = 1;
break;
case DEVICE:
if (-1 ==
@ -929,11 +947,11 @@ ConsInit(pCE)
}
if (pCE->downHard == FLAGTRUE) {
if (pCE->ioState == ISNORMAL)
if (pCE->ioState == ISNORMAL) {
Msg("[%s] console up", pCE->server);
else
pCE->downHard = FLAGFALSE;
} else
Msg("[%s] console initializing", pCE->server);
pCE->downHard = FLAGFALSE;
}
#if HAVE_GETTIMEOFDAY
if (gettimeofday(&tv, (void *)0) == 0)

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.h,v 5.58 2004/06/01 23:45:47 bryan Exp $
* $Id: consent.h,v 5.59 2004/10/25 07:18:18 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -178,3 +178,4 @@ extern REMOTE *FindUniq PARAMS((REMOTE *));
extern void DestroyRemoteConsole PARAMS((REMOTE *));
extern void StartInit PARAMS((CONSENT *));
extern void StopInit PARAMS((CONSENT *));
extern char *ConsState PARAMS((CONSENT *));

View File

@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.50 2004/06/08 16:19:46 bryan Exp $
.TH CONSERVER 8 "2004/06/08" "conserver-8.1.10" "conserver"
.TH CONSERVER 8 "2004/06/08" "conserver-8.1.11" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS

View File

@ -1,5 +1,5 @@
/*
* $Id: cutil.c,v 1.118 2004/05/25 00:38:15 bryan Exp $
* $Id: cutil.c,v 1.121 2004/11/09 08:37:05 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -3092,7 +3092,7 @@ ProcessSubst(s, repl, str, name, id)
* you could pass all arguments in...then both types of actions occur.
*/
char *p;
char *repfmt[255];
char *repfmt[256];
unsigned short repnum;
int i;
@ -3151,7 +3151,8 @@ ProcessSubst(s, repl, str, name, id)
goto subst_err;
break;
case REP_INT:
if (*p == 'd' || *p == 'x' || *p == 'X') {
if (*p == 'd' || *p == 'x' || *p == 'X' || *p == 'a' ||
*p == 'A') {
if (s->tokens[(unsigned)(*(repfmt[repnum]))] !=
ISNUMBER)
goto subst_err;
@ -3251,20 +3252,27 @@ ProcessSubst(s, repl, str, name, id)
case 'X':
base = 16;
break;
case 'a':
case 'A':
base = 36;
break;
default:
return;
}
while (port >= base) {
if (port % base >= 10)
BuildStringChar((port % base) - 10 +
(*c == 'x' ? 'a' : 'A'), num);
((*c == 'x' ||
*c == 'a') ? 'a' : 'A'),
num);
else
BuildStringChar((port % base) + '0', num);
port /= base;
}
if (port >= 10)
BuildStringChar(port - 10 +
(*c == 'x' ? 'a' : 'A'), num);
((*c == 'x' ||
*c == 'a') ? 'a' : 'A'), num);
else
BuildStringChar(port + '0', num);

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.305 2004/07/14 05:28:42 bryan Exp $
* $Id: group.c,v 5.311 2004/10/25 07:25:35 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -89,6 +89,29 @@ time_t timers[T_MAX];
static unsigned long dmallocMarkClientConnection = 0;
#endif
void
#if PROTOTYPES
SendIWaitClientsMsg(CONSENT *pCE, char *message)
#else
SendIWaitClientsMsg(pCE, message)
CONSENT *pCE;
char *message;
#endif
{
CONSCLIENT *pCL;
if ((CONSENT *)0 == pCE) {
return;
}
for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
if (pCL->fcon && pCL->fiwait) {
pCL->fiwait = 0;
FileWrite(pCL->fd, FLAGFALSE, message, -1);
}
}
}
void
#if PROTOTYPES
SendClientsMsg(CONSENT *pCE, char *message)
@ -184,6 +207,47 @@ AbortAnyClientExec(pCL)
}
}
void
#if PROTOTYPES
ClientWantsWrite(CONSCLIENT *pCL)
#else
ClientWantsWrite(pCL)
CONSCLIENT *pCL;
#endif
{
CONSENT *pCE;
if ((CONSCLIENT *)0 == pCL)
return;
if (pCL->fwr)
return;
pCL->fwr = 0;
pCL->fwantwr = 1;
pCE = pCL->pCEto;
if ((CONSENT *)0 == pCE)
return;
/* promote the client to the top of the list
* (which allows them to be picked first for
* aquiring read-write access)
* first by extracting...
*/
if ((CONSCLIENT *)0 != pCL->pCLnext) {
pCL->pCLnext->ppCLbnext = pCL->ppCLbnext;
}
*(pCL->ppCLbnext) = pCL->pCLnext;
/* now by inserting...
*/
pCL->pCLnext = pCE->pCLon;
pCL->ppCLbnext = &pCE->pCLon;
if ((CONSCLIENT *)0 != pCL->pCLnext) {
pCL->pCLnext->ppCLbnext = &pCL->pCLnext;
}
pCE->pCLon = pCL;
}
void
#if PROTOTYPES
DisconnectClient(GRPENT *pGE, CONSCLIENT *pCL, char *message, FLAG force)
@ -234,14 +298,12 @@ DisconnectClient(pGE, pCL, message, force)
* and turn logging back on...
*/
if (pCL->fwr) {
pCL->fwr = 0;
pCL->fwantwr = 0;
BumpClient(pCEServing, (char *)0);
TagLogfileAct(pCEServing, "%s detached", pCL->acid->string);
if (pCEServing->nolog) {
pCEServing->nolog = 0;
TagLogfile(pCEServing, "Console logging restored (logout)");
}
pCEServing->pCLwr = (CONSCLIENT *)0;
FindWrite(pCEServing);
}
@ -502,6 +564,7 @@ DestroyConsent(pGE, pCE)
FD_CLR(FileFDNum(pCL->fd), &winit);
FileClose(&pCL->fd);
if (pCL->fwr) {
BumpClient(pCE, (char *)0);
TagLogfileAct(pCE, "%s detached", pCL->acid->string);
if (pCE->nolog) {
pCE->nolog = 0;
@ -864,14 +927,6 @@ ConsoleError(pCE)
CONSENT *pCE;
#endif
{
/* If someone was writing, they fall back to read-only */
if (pCE->pCLwr != (CONSCLIENT *)0) {
pCE->pCLwr->fwr = 0;
pCE->pCLwr->fwantwr = 1;
TagLogfileAct(pCE, "%s detached", pCE->pCLwr->acid->string);
pCE->pCLwr = (CONSCLIENT *)0;
}
if (pCE->autoreinit != FLAGTRUE) {
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
} else {
@ -880,9 +935,7 @@ ConsoleError(pCE)
ConsInit(pCE);
/* If we didn't succeed, try again later */
if (pCE->fup)
FindWrite(pCE);
else
if (!pCE->fup)
pCE->autoReUp = 1;
}
}
@ -1063,9 +1116,7 @@ ReUp(pGE, automatic)
ConsInit(pCE);
if (updateDelay)
UpdateDelay(pCE);
if (pCE->fup)
FindWrite(pCE);
else if (automatic > 0)
if (!pCE->fup && automatic > 0)
pCE->autoReUp = autoReUp;
}
} while (retry);
@ -1470,7 +1521,6 @@ ReapVirt(pGE)
TagLogfileAct(pCE, "initcmd terminated");
pCE->initpid = 0;
StopInit(pCE);
FindWrite(pCE);
break;
}
@ -1482,15 +1532,6 @@ ReapVirt(pGE)
if (WIFSIGNALED(UWbuf))
Msg("[%s] signal(%d)", pCE->server, WTERMSIG(UWbuf));
/* If someone was writing, they fall back to read-only */
if (pCE->pCLwr != (CONSCLIENT *)0) {
pCE->pCLwr->fwr = 0;
pCE->pCLwr->fwantwr = 1;
TagLogfileAct(pCE, "%s detached",
pCE->pCLwr->acid->string);
pCE->pCLwr = (CONSCLIENT *)0;
}
if (pCE->autoreinit != FLAGTRUE &&
!(WIFEXITED(UWbuf) && WEXITSTATUS(UWbuf) == 0)) {
ConsDown(pCE, FLAGTRUE, FLAGFALSE);
@ -1500,9 +1541,7 @@ ReapVirt(pGE)
ConsInit(pCE);
/* If we didn't succeed, try again later */
if (pCE->fup)
FindWrite(pCE);
else
if (!pCE->fup)
pCE->autoReUp = 1;
}
break;
@ -1844,19 +1883,13 @@ CommandAttach(pGE, pCLServing, pCEServing, tyme)
{
CONSCLIENT *pCL;
ClientWantsWrite(pCLServing);
if (pCEServing->fronly) {
FileWrite(pCLServing->fd, FLAGFALSE, "console is read-only]\r\n",
-1);
} else if (pCEServing->initfile != (CONSFILE *)0 ||
pCEServing->ioState == INCONNECT) {
FileWrite(pCLServing->fd, FLAGFALSE,
"read-only -- initializing]\r\n", -1);
pCLServing->fwantwr = 1;
} else if (pCLServing->fro) {
FileWrite(pCLServing->fd, FLAGFALSE, "read-only]\r\n", -1);
} else if (!(pCEServing->fup && pCEServing->ioState == ISNORMAL)) {
FileWrite(pCLServing->fd, FLAGFALSE,
"line to console is down]\r\n", -1);
} else if ((CONSCLIENT *)0 == (pCL = pCEServing->pCLwr)) {
pCEServing->pCLwr = pCLServing;
pCLServing->fwr = 1;
@ -1875,7 +1908,6 @@ CommandAttach(pGE, pCLServing, pCEServing, tyme)
FileWrite(pCLServing->fd, FLAGFALSE, "ok]\r\n", -1);
}
} else {
pCLServing->fwantwr = 1;
FilePrint(pCLServing->fd, FLAGFALSE, "no, %s is attached]\r\n",
pCL->acid->string);
}
@ -1940,15 +1972,7 @@ CommandDown(pGE, pCLServing, pCEServing, tyme)
{
CONSCLIENT *pCL;
/* if client is read-only OR
* console is read-only OR
* (console is up, normal state, and not running command AND
* client isn't the writer)
* then just pop out an "error" message
*/
if (pCLServing->fro || pCEServing->fronly ||
(pCEServing->fup && pCEServing->ioState == ISNORMAL &&
pCEServing->initfile == (CONSFILE *)0 && !pCLServing->fwr)) {
if (!pCLServing->fwr) {
FileWrite(pCLServing->fd, FLAGFALSE, "attach to down line]\r\n",
-1);
return;
@ -1958,9 +1982,6 @@ CommandDown(pGE, pCLServing, pCEServing, tyme)
return;
}
pCLServing->fwr = 0;
pCEServing->pCLwr = (CONSCLIENT *)0;
TagLogfileAct(pCEServing, "%s detached", pCLServing->acid->string);
ConsDown(pCEServing, FLAGFALSE, FLAGFALSE);
FileWrite(pCLServing->fd, FLAGFALSE, "line down]\r\n", -1);
@ -2034,23 +2055,15 @@ CommandForce(pGE, pCLServing, pCEServing, tyme)
{
CONSCLIENT *pCL;
ClientWantsWrite(pCLServing);
if (pCLServing->fro) {
FileWrite(pCLServing->fd, FLAGFALSE, "read-only]\r\n", -1);
return;
} else if (pCEServing->initfile != (CONSFILE *)0 ||
pCEServing->ioState == INCONNECT) {
FileWrite(pCLServing->fd, FLAGFALSE,
"read-only -- initializing]\r\n", -1);
pCLServing->fwantwr = 1;
return;
} else if (pCEServing->fronly) {
FileWrite(pCLServing->fd, FLAGFALSE, "console is read-only]\r\n",
-1);
return;
} else if (!(pCEServing->fup && pCEServing->ioState == ISNORMAL)) {
FileWrite(pCLServing->fd, FLAGFALSE,
"line to console is down]\r\n", -1);
return;
}
if ((CONSCLIENT *)0 != (pCL = pCEServing->pCLwr)) {
if (pCL == pCLServing) {
@ -2062,8 +2075,6 @@ CommandForce(pGE, pCLServing, pCEServing, tyme)
}
return;
}
pCL->fwr = 0;
pCL->fwantwr = 1;
if (pCEServing->nolog) {
FilePrint(pCLServing->fd, FLAGFALSE,
"bumped %s (nologging)]\r\n", pCL->acid->string);
@ -2072,6 +2083,8 @@ CommandForce(pGE, pCLServing, pCEServing, tyme)
pCL->acid->string);
}
AbortAnyClientExec(pCL);
BumpClient(pCEServing, (char *)0);
ClientWantsWrite(pCL);
if (pCL->fcon)
FilePrint(pCL->fd, FLAGFALSE,
"\r\n[forced to `spy' mode by %s]\r\n",
@ -2315,15 +2328,7 @@ CommandOpen(pGE, pCLServing, pCEServing, tyme)
{
CONSCLIENT *pCL;
/* if client is read-only OR
* console is read-only OR
* (console is up, normal state, and not running command AND
* client isn't the writer)
* then just pop out an "error" message
*/
if (pCLServing->fro || pCEServing->fronly ||
(pCEServing->fup && pCEServing->ioState == ISNORMAL &&
pCEServing->initfile == (CONSFILE *)0 && !pCLServing->fwr)) {
if (!pCLServing->fwr) {
FileWrite(pCLServing->fd, FLAGFALSE, "attach to reopen]\r\n", -1);
return;
}
@ -2331,26 +2336,27 @@ CommandOpen(pGE, pCLServing, pCEServing, tyme)
* change fd's
*/
ConsInit(pCEServing);
if (pCEServing->initfile != (CONSFILE *)0 ||
pCEServing->ioState == INCONNECT) {
FileWrite(pCLServing->fd, FLAGFALSE,
"read-only -- initializing]\r\n", -1);
} else if (!(pCEServing->fup && pCEServing->ioState == ISNORMAL)) {
FileWrite(pCLServing->fd, FLAGFALSE,
"line to console is down]\r\n", -1);
if (pCEServing->fup &&
(pCEServing->initfile != (CONSFILE *)0 ||
pCEServing->ioState == INCONNECT)) {
FileWrite(pCLServing->fd, FLAGFALSE, "connecting...", -1);
pCLServing->fiwait = 1;
} else if (pCEServing->fronly) {
FileWrite(pCLServing->fd, FLAGFALSE, "up read-only]\r\n", -1);
FilePrint(pCLServing->fd, FLAGFALSE, "%s -- read-only]\r\n",
pCEServing->fup ? "up" : "down");
} else if ((CONSCLIENT *)0 == (pCL = pCEServing->pCLwr)) {
pCEServing->pCLwr = pCLServing;
pCLServing->fwr = 1;
FileWrite(pCLServing->fd, FLAGFALSE, "up -- attached]\r\n", -1);
FilePrint(pCLServing->fd, FLAGFALSE, "%s -- attached]\r\n",
pCEServing->fup ? "up" : "down");
TagLogfileAct(pCEServing, "%s attached", pCLServing->acid->string);
} else if (pCL == pCLServing) {
FileWrite(pCLServing->fd, FLAGFALSE, "up]\r\n", -1);
FilePrint(pCLServing->fd, FLAGFALSE, "%s]\r\n",
pCEServing->fup ? "up" : "down");
TagLogfileAct(pCEServing, "%s attached", pCLServing->acid->string);
} else {
FilePrint(pCLServing->fd, FLAGFALSE, "up, %s is attached]\r\n",
pCL->acid->string);
FilePrint(pCLServing->fd, FLAGFALSE, "%s, %s is attached]\r\n",
pCEServing->fup ? "up" : "down", pCL->acid->string);
}
}
@ -2430,7 +2436,7 @@ DoConsoleRead(pCEServing)
/* read terminal line */
if ((nr =
FileRead(pCEServing->cofile, acInOrig, sizeof(acInOrig))) < 0) {
Error("[%s] read failure", pCEServing->server);
Error("[%s] read failure: unexpected EOF", pCEServing->server);
ConsoleError(pCEServing);
return;
}
@ -2623,7 +2629,6 @@ DoCommandRead(pCEServing)
if ((nr =
FileRead(pCEServing->initfile, acInOrig, sizeof(acInOrig))) < 0) {
StopInit(pCEServing);
FindWrite(pCEServing);
return;
}
CONDDEBUG((1, "DoCommandRead(): read %d bytes from fd %d", nr, fd));
@ -3027,18 +3032,6 @@ DoClientRead(pGE, pCLServing)
if (pCEServing->fronly) {
FileWrite(pCLServing->fd, FLAGFALSE,
"[console is read-only]\r\n", -1);
} else if (pCEServing->initfile != (CONSFILE *)0 ||
pCEServing->ioState == INCONNECT) {
pCLServing->fwantwr = 1;
FileWrite(pCLServing->fd, FLAGFALSE,
"[read-only -- initializing]\r\n",
-1);
} else
if (!
(pCEServing->fup &&
pCEServing->ioState == ISNORMAL)) {
FileWrite(pCLServing->fd, FLAGFALSE,
"[line to console is down]\r\n", -1);
} else if (((CONSCLIENT *)0 == pCEServing->pCLwr)
&& !pCLServing->fro) {
pCEServing->pCLwr = pCLServing;
@ -3050,7 +3043,7 @@ DoClientRead(pGE, pCLServing)
TagLogfileAct(pCEServing, "%s attached",
pCLServing->acid->string);
} else {
pCLServing->fwantwr = 1;
ClientWantsWrite(pCLServing);
FileWrite(pCLServing->fd, FLAGFALSE,
"[spy]\r\n", -1);
}
@ -3232,9 +3225,7 @@ DoClientRead(pGE, pCLServing)
continue;
case S_SUSP:
if (!
(pCEServing->fup &&
pCEServing->ioState == ISNORMAL)) {
if (!pCEServing->fup) {
FileWrite(pCLServing->fd, FLAGFALSE,
" -- line down]\r\n", -1);
} else if (pCEServing->fronly) {
@ -3276,7 +3267,10 @@ DoClientRead(pGE, pCLServing)
case S_CEXEC:
/* if we can write, write to slave tty
*/
if (pCLServing->fwr) {
if (pCEServing->fup &&
pCEServing->initfile == (CONSFILE *)0 &&
pCEServing->ioState == ISNORMAL &&
pCLServing->fwr && !pCLServing->fiwait) {
PutConsole(pCEServing, acIn[i], 1);
continue;
}
@ -3285,10 +3279,17 @@ DoClientRead(pGE, pCLServing)
* (LLL nice to put chars out as ^Ec, rather
* than octal escapes, but....)
*/
if ('\r' == acIn[i] || '\n' == acIn[i]) {
if (!pCLServing->fiwait &&
('\r' == acIn[i] || '\n' == acIn[i])) {
char *m = "";
if (pCLServing->fwr)
m = ConsState(pCEServing);
else
m = "read-only";
FilePrint(pCLServing->fd, FLAGFALSE,
"[read-only -- use %s %s ? for help]\r\n",
FmtCtl(pCLServing->ic[0], acA1),
"[%s -- use %s %s ? for help]\r\n",
m, FmtCtl(pCLServing->ic[0],
acA1),
FmtCtl(pCLServing->ic[1], acA2));
}
continue;
@ -3396,6 +3397,21 @@ DoClientRead(pGE, pCLServing)
case S_CMD: /* have 1/2 of the escape sequence */
pCLServing->iState = S_NORMAL;
switch (acIn[i]) {
case '=':
if (!pCLServing->fcon) {
char *m = ConsState(pCEServing);
if (strcmp(m,"up") == 0)
FileWrite(pCLServing->fd,
FLAGFALSE, "up]\r\n",
-1);
else
FilePrint(pCLServing->fd,
FLAGFALSE,
"`%s' -- console is %s]\r\n",
pCEServing->server, m);
} else
goto unknownchar;
break;
case ';':
if (pCLServing->fcon) {
FileSetQuoteIAC(pCLServing->fd,
@ -3557,10 +3573,9 @@ DoClientRead(pGE, pCLServing)
"ok]\r\n", -1);
break;
}
pCLServing->fwr = 0;
BumpClient(pCEServing, (char *)0);
TagLogfileAct(pCEServing, "%s detached",
pCLServing->acid->string);
pCEServing->pCLwr = (CONSCLIENT *)0;
FindWrite(pCEServing);
FileWrite(pCLServing->fd, FLAGFALSE,
"spying]\r\n", -1);
@ -3629,13 +3644,12 @@ DoClientRead(pGE, pCLServing)
pCLServing->fcon = 0;
pCLServing->iState = S_SUSP;
if (pCEServing->pCLwr == pCLServing) {
pCLServing->fwr = 0;
pCLServing->fwantwr = 0;
pCEServing->pCLwr = (CONSCLIENT *)0;
BumpClient(pCEServing, (char *)0);
TagLogfileAct(pCEServing,
"%s detached",
pCLServing->acid->
string);
FindWrite(pCEServing);
}
break;
@ -3724,6 +3738,7 @@ DoClientRead(pGE, pCLServing)
break;
default: /* unknown sequence */
unknownchar:
#if USE_EXTENDED_MESSAGES
FilePrint(pCLServing->fd, FLAGFALSE,
"unknown -- use `?'%s]\r\n",
@ -3992,7 +4007,6 @@ FlushConsole(pCEServing)
timers[T_CIDLE] = pCEServing->lastWrite + pCEServing->idletimeout;
}
/* routine used by the child processes. (ksb/fine)
* Most of it is escape sequence parsing.
* fine:
@ -4189,6 +4203,7 @@ Kiddie(pGE, sfd)
pCEServing->stateTimer = (time_t)0;
if (pCEServing->ioState != INCONNECT)
continue;
SendIWaitClientsMsg(pCEServing, "down]\r\n");
Error("[%s] connect timeout: forcing down",
pCEServing->server);
/* can't use ConsoleError() here otherwise we could reinit
@ -4334,6 +4349,7 @@ Kiddie(pGE, sfd)
pCEServing->server, cofile,
strerror(errno));
/* no ConsoleError() for same reason as above */
SendIWaitClientsMsg(pCEServing, "down]\r\n");
ConsDown(pCEServing, FLAGTRUE, FLAGTRUE);
break;
}
@ -4342,6 +4358,7 @@ Kiddie(pGE, sfd)
pCEServing->server, cofile,
strerror(flags));
/* no ConsoleError() for same reason as above */
SendIWaitClientsMsg(pCEServing, "down]\r\n");
ConsDown(pCEServing, FLAGTRUE, FLAGTRUE);
break;
}
@ -4368,6 +4385,11 @@ Kiddie(pGE, sfd)
timers[T_CIDLE] =
pCEServing->lastWrite +
pCEServing->idletimeout;
if (pCEServing->downHard == FLAGTRUE) {
Msg("[%s] console up", pCEServing->server);
pCEServing->downHard = FLAGFALSE;
}
SendIWaitClientsMsg(pCEServing, "up]\r\n");
StartInit(pCEServing);
}
break;

View File

@ -1,5 +1,5 @@
/*
* $Id: group.h,v 5.46 2004/05/25 00:38:15 bryan Exp $
* $Id: group.h,v 5.47 2004/10/10 18:46:15 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -81,6 +81,7 @@ extern int ClientAccess PARAMS((CONSENT *, char *));
extern void DestroyClient PARAMS((CONSCLIENT *));
extern int CheckPasswd PARAMS((CONSCLIENT *, char *));
extern void DeUtmp PARAMS((GRPENT *, int));
extern void ClientWantsWrite PARAMS((CONSCLIENT *));
#if HAVE_OPENSSL
extern int AttemptSSL PARAMS((CONSCLIENT *));
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.c,v 5.180 2004/07/14 05:28:42 bryan Exp $
* $Id: readcfg.c,v 5.181 2004/10/25 07:18:19 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -3003,8 +3003,7 @@ ConsoleDestroy()
"[Conserver reconfigured - r/w access removed]\r\n",
-1);
if (pCL->fwr) {
pCL->fwr = 0;
pCL->fwantwr = 0;
BumpClient(pCE, (char *)0);
TagLogfileAct(pCE, "%s detached",
pCL->acid->string);
if (pCE->nolog) {
@ -3012,7 +3011,6 @@ ConsoleDestroy()
TagLogfile(pCE,
"Console logging restored (bumped)");
}
pCE->pCLwr = (CONSCLIENT *)0;
FindWrite(pCE);
}
} else {

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.66 2004/09/21 23:47:14 bryan Exp $
* $Id: version.h,v 1.70 2004/11/09 08:24:01 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.10"
#define THIS_VERSION "conserver.com version 8.1.11"

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.168 2004/09/21 23:45:53 bryan Exp $
* $Id: console.c,v 5.169 2004/10/25 07:18:20 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -1394,6 +1394,13 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
}
}
/* try to grok the state of the console */
FilePrint(pcf, FLAGFALSE, "%c%c=", chAttn, chEsc);
r = ReadReply(pcf, 0);
if (strncmp(r, "[unknown", 8) != 0 &&
strncmp(r, "[up]", 4) != 0)
FileWrite(cfstdout, FLAGFALSE, r, -1);
printf("[Enter `");
PutCtlc(chAttn, stdout);
PutCtlc(chEsc, stdout);

View File

@ -1,5 +1,5 @@
.\" $Id: console.man,v 1.55 2004/07/14 05:28:42 bryan Exp $
.TH CONSOLE 1 "2004/07/14" "conserver-8.1.10" "conserver"
.TH CONSOLE 1 "2004/07/14" "conserver-8.1.11" "conserver"
.SH NAME
console \- console server client program
.SH SYNOPSIS

View File

@ -4,7 +4,7 @@
#
%define pkg conserver
%define ver 8.1.10
%define ver 8.1.11
# 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.10"
VERSION="8.1.11"
DESC="Console server and client"
CLASSES=none
ARCH=sparc

View File

@ -33,7 +33,7 @@ dotest()
mv test.out results/test$testnum
else
if [ -f results/test$testnum ]; then
if diff -i test.out results/test$testnum >test$testnum.diff 2>&1; then
if diff -i results/test$testnum >test$testnum.diff test.out 2>&1; then
echo "succeeded"
rm -f test$testnum.diff
else
@ -89,7 +89,7 @@ dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -u | sed -e
dotest 'c?c.'
dotest 'cl?c.'
dotest 'cdc.'
dotest 'coc.'
dotest 'cocacoc.'
dotest EVAL "echo 'tu.' | ../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -e 'tu' shell"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -R | sed -e 's/ [^ ]*$//'"

View File

@ -1,4 +1,6 @@
console: shell is down
[`shell' -- console is down]
[Enter `^Ec?' for help]
[up -- attached]
[up]
[ok]
[up]
[disconnect]

View File

@ -1,4 +1,4 @@
console: shell is down
[`shell' -- console is down]
[Enter `^Ec?' for help]
[up -- attached]
[up]
[disconnect]