Imported from conserver-8.1.3.tar.gz

This commit is contained in:
Bryan Stansell 2004-03-22 17:14:45 -08:00
parent aea0e2a547
commit 29b909ee59
19 changed files with 347 additions and 256 deletions

12
CHANGES
View File

@ -1,6 +1,14 @@
CHANGES
=======
version 8.1.3 (Mar 22, 2004):
- fixed small memory and file descriptor leak in client when
using '^Ec;'
- '^Ec;' now only disconnects from the previous console only
after a successfully move to a new console, allowing you to
abort the move - suggested by Christopher T. Beers
<ctbeers@syr.edu>
version 8.1.2 (Mar 11, 2004):
- better handling of client command (^Ec|) when user is bumped,
conserver is reconfigured, etc
@ -15,7 +23,7 @@ version 8.1.2 (Mar 11, 2004):
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
- marked various undocumented client commands as deprecated 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>
@ -690,5 +698,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.158 2004/03/11 16:31:27 bryan Exp $
# $Id: CHANGES,v 1.162 2004/03/23 00:55:04 bryan Exp $
#

View File

@ -10,6 +10,10 @@ Upgrading?
new features added to the client if you're considering *not*
upgrading.
Version 8.1.3
- The '^Ec;' sequence won't work correctly with 8.1.2 (where it
was introduced).
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
@ -270,5 +274,5 @@ Other Information And Gotchas
#
# $Id: INSTALL,v 1.36 2004/02/22 21:04:06 bryan Exp $
# $Id: INSTALL,v 1.37 2004/03/23 00:55:04 bryan Exp $
#

4
TODO
View File

@ -102,10 +102,10 @@ Bryan Stansell
- 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
- embedded 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.46 2004/03/11 16:45:57 bryan Exp $
# $Id: TODO,v 1.47 2004/03/12 17:34:49 bryan Exp $
#

5
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-03-03'
timestamp='2004-03-12'
# 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
@ -853,6 +853,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;

12
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-23'
timestamp='2004-03-12'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -237,7 +237,7 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32r | m68000 | m68k | m88k | mcore \
| m32r | m32rle | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@ -262,7 +262,7 @@ case $basic_machine in
| pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
@ -308,7 +308,7 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| m32r-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@ -336,7 +336,7 @@ case $basic_machine in
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
@ -1081,7 +1081,7 @@ case $basic_machine in
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)

View File

@ -1,5 +1,5 @@
.\" $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"
.TH CONSERVER.CF 5 "2004/02/24" "conserver-8.1.3" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)

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

View File

@ -181,11 +181,11 @@
<H3>Downloading</H3>
<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
<P>The current version, released on Mar 22, 2004, is <A
href="8.1.3.tar.gz">8.1.3.tar.gz</A>. You can get it via
<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=
"ftp://ftp.conserver.com/conserver/8.1.3.tar.gz">FTP</A>
or <A href="8.1.3.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.80 2004/03/10 02:55:45 bryan Exp $
* $Id: client.c,v 5.81 2004/03/20 14:40:40 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -379,7 +379,7 @@ typedef struct HLnode {
static HELP aHLTable[] = {
{WHEN_ALWAYS, ". disconnect"},
{WHEN_ALWAYS, "; switch to another console"},
{WHEN_ALWAYS, "; move to another console"},
{WHEN_ALWAYS, "a attach read/write"},
{WHEN_ALWAYS, "b send broadcast message"},
{WHEN_ATTACH, "c toggle flow control"},

View File

@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $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"
.\" $Id: conserver.man,v 1.43 2004/03/23 01:02:29 bryan Exp $
.TH CONSERVER 8 "2004/03/23" "conserver-8.1.3" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS
@ -334,7 +334,7 @@ Since this is
.I highly
environment-specific, conserver cannot do the check internally.
.RS
.TP 8
.TP 9
.I name
The name of the console.
.TP

View File

@ -1,5 +1,5 @@
/*
* $Id: cutil.c,v 1.115 2004/03/11 16:23:59 bryan Exp $
* $Id: cutil.c,v 1.116 2004/03/19 05:23:21 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -839,6 +839,9 @@ FileUnopen(cfp)
{
int retval = 0;
if (cfp == (CONSFILE *)0)
return 0;
switch (cfp->ftype) {
case simpleFile:
retval = cfp->fd;

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.289 2004/03/10 02:55:45 bryan Exp $
* $Id: group.c,v 5.291 2004/03/16 04:17:31 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -3264,8 +3264,7 @@ DoClientRead(pGE, pCLServing)
"%c%c", OB_IAC, OB_GOTO);
FileSetQuoteIAC(pCLServing->fd,
FLAGTRUE);
DisconnectClient(pGE, pCLServing,
(char *)0, FLAGFALSE);
goto bottomSuspend;
} else {
FileWrite(pCLServing->fd, FLAGFALSE,
"connected]\r\n", -1);
@ -3283,9 +3282,9 @@ DoClientRead(pGE, pCLServing)
"no drop line]\r\n", -1);
break;
#define DEPRECIATED FileWrite(pCLServing->fd, FLAGFALSE, "<use of DEPRECIATED (and undocumented) key> ", -1)
#define DEPRECATED FileWrite(pCLServing->fd, FLAGFALSE, "<use of DEPRECATED (and undocumented) key> ", -1)
case 'B':
DEPRECIATED;
DEPRECATED;
case 'b': /* broadcast message */
FileWrite(pCLServing->fd, FLAGFALSE,
"Enter message: ", -1);
@ -3293,28 +3292,28 @@ DoClientRead(pGE, pCLServing)
break;
case 'A':
DEPRECIATED;
DEPRECATED;
case 'a': /* attach */
CommandAttach(pGE, pCLServing, pCEServing,
tyme);
break;
case 'C':
DEPRECIATED;
DEPRECATED;
case 'c':
CommandChangeFlow(pGE, pCLServing,
pCEServing, tyme);
break;
case 'D':
DEPRECIATED;
DEPRECATED;
case 'd': /* down a console */
CommandDown(pGE, pCLServing, pCEServing,
tyme);
break;
case 'E':
DEPRECIATED;
DEPRECATED;
case 'e': /* redefine escape keys */
pCLServing->iState = S_CATTN;
FileWrite(pCLServing->fd, FLAGFALSE,
@ -3322,14 +3321,14 @@ DoClientRead(pGE, pCLServing)
break;
case 'F':
DEPRECIATED;
DEPRECATED;
case 'f': /* force attach */
CommandForce(pGE, pCLServing, pCEServing,
tyme);
break;
case 'G':
DEPRECIATED;
DEPRECATED;
case 'g': /* group info */
FilePrint(pCLServing->fd, FLAGFALSE,
"group %s]\r\n",
@ -3340,14 +3339,14 @@ DoClientRead(pGE, pCLServing)
case 'H':
case 'P': /* DEC vt100 pf1 */
DEPRECIATED;
DEPRECATED;
case 'h': /* help */
case '?':
HelpUser(pCLServing);
break;
case 'I':
DEPRECIATED;
DEPRECATED;
case 'i':
FileWrite(pCLServing->fd, FLAGFALSE,
"info]\r\n", -1);
@ -3383,7 +3382,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'O':
DEPRECIATED;
DEPRECATED;
case 'o': /* close and re-open line */
CommandOpen(pGE, pCLServing, pCEServing,
tyme);
@ -3396,7 +3395,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'R': /* DEC vt100 pf3 */
DEPRECIATED;
DEPRECATED;
case 'r': /* replay 20 lines */
FileWrite(pCLServing->fd, FLAGFALSE,
"replay]\r\n", -1);
@ -3410,7 +3409,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'S': /* DEC vt100 pf4 */
DEPRECIATED;
DEPRECATED;
case 's': /* spy mode */
pCLServing->fwantwr = 0;
if (!pCLServing->fwr) {
@ -3428,7 +3427,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'U':
DEPRECIATED;
DEPRECATED;
case 'u': /* hosts on server this */
FileWrite(pCLServing->fd, FLAGFALSE,
"hosts]\r\n", -1);
@ -3437,7 +3436,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'V':
DEPRECIATED;
DEPRECATED;
case 'v': /* version */
FilePrint(pCLServing->fd, FLAGFALSE,
"version `%s']\r\n",
@ -3445,7 +3444,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'W':
DEPRECIATED;
DEPRECATED;
case 'w': /* who */
FilePrint(pCLServing->fd, FLAGFALSE,
"who %s]\r\n",
@ -3455,7 +3454,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'X':
DEPRECIATED;
DEPRECATED;
case 'x':
FileWrite(pCLServing->fd, FLAGFALSE,
"examine]\r\n", -1);
@ -3479,13 +3478,14 @@ DoClientRead(pGE, pCLServing)
break;
case 'Z':
DEPRECIATED;
DEPRECATED;
case 'z': /* suspend the client */
case '\032':
FileSetQuoteIAC(pCLServing->fd, FLAGFALSE);
FilePrint(pCLServing->fd, FLAGFALSE,
"%c%c", OB_IAC, OB_SUSP);
FileSetQuoteIAC(pCLServing->fd, FLAGTRUE);
bottomSuspend:
pCLServing->fcon = 0;
pCLServing->iState = S_SUSP;
if (pCEServing->pCLwr == pCLServing) {
@ -3547,7 +3547,7 @@ DoClientRead(pGE, pCLServing)
break;
case 'Q': /* DEC vt100 PF2 */
DEPRECIATED;
DEPRECATED;
case '.': /* disconnect */
case '\004':
case '\003':

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.58 2004/02/17 15:34:42 bryan Exp $
* $Id: version.h,v 1.59 2004/03/16 04:17:31 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.2"
#define THIS_VERSION "conserver.com version 8.1.3"

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.157 2004/03/10 02:55:47 bryan Exp $
* $Id: console.c,v 5.161 2004/03/20 14:40:42 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -57,7 +57,10 @@ int disconnectCount = 0;
STRING *execCmd = (STRING *)0;
CONSFILE *execCmdFile = (CONSFILE *)0;
pid_t execCmdPid = 0;
int gotoConsole = 0;
CONSFILE *gotoConsole = (CONSFILE *)0;
CONSFILE *prevConsole = (CONSFILE *)0;
char *gotoName = (char *)0;
char *prevName = (char *)0;
#if HAVE_OPENSSL
SSL_CTX *ctx = (SSL_CTX *)0;
@ -553,6 +556,9 @@ DestroyDataStructures()
#endif
{
C2Cooked();
if (cfstdout != (CONSFILE *)0)
FileUnopen(cfstdout);
DestroyStrings();
}
char *
@ -888,9 +894,217 @@ DoExec(pcf)
}
}
void
#if PROTOTYPES
Interact(CONSFILE *pcf, char *pcMach)
#else
Interact(pcf, pcMach)
CONSFILE *pcf;
char *pcMach;
#endif
{
int i;
int nc;
fd_set rmask, wmask;
int justSuspended = 0;
static char acMesg[8192];
/* if this is true, it means we successfully moved to a new console
* so we need to close the old one.
*/
if (prevConsole != (CONSFILE *)0)
FileClose(&prevConsole);
if (prevName != (char *)0) {
free(prevName);
prevName = (char *)0;
}
/* this is only true in other parts of the code iff pcf == gotoConsole */
if (gotoConsole != (CONSFILE *)0) {
gotoConsole = (CONSFILE *)0;
FilePrint(cfstdout, FLAGFALSE, "[returning to `%s'", pcMach);
FileWrite(pcf, FLAGFALSE, "\n", 1);
}
C2Raw();
/* set socket to non-blocking */
SetFlags(FileFDNum(pcf), O_NONBLOCK, 0);
/* read from stdin and the socket (non-blocking!).
* rmask indicates which descriptors to read from,
* the others are not used, nor is the result from
* select, read, or write.
*/
FD_ZERO(&rinit);
FD_ZERO(&winit);
FD_SET(FileFDNum(pcf), &rinit);
FD_SET(0, &rinit);
if (maxfd < FileFDNum(pcf) + 1)
maxfd = FileFDNum(pcf) + 1;
for (;;) {
justSuspended = 0;
if (fSawReapVirt) {
fSawReapVirt = 0;
ReapVirt();
}
/* reset read mask and select on it
*/
rmask = rinit;
wmask = winit;
if (-1 ==
select(maxfd, &rmask, &wmask, (fd_set *)0,
(struct timeval *)0)) {
if (errno != EINTR) {
Error("Master(): select(): %s", strerror(errno));
break;
}
continue;
}
/* anything from execCmd */
if (execCmdFile != (CONSFILE *)0) {
if (FileCanRead(execCmdFile, &rmask, &wmask)) {
if ((nc =
FileRead(execCmdFile, acMesg, sizeof(acMesg))) < 0) {
FD_CLR(FileFDNum(execCmdFile), &rinit);
FD_CLR(FileFDOutNum(execCmdFile), &winit);
FileClose(&execCmdFile);
FileSetQuoteIAC(pcf, FLAGFALSE);
FilePrint(pcf, FLAGFALSE, "%c%c", OB_IAC, OB_ABRT);
FileSetQuoteIAC(pcf, FLAGTRUE);
} else {
if (fStrip) {
for (i = 0; i < nc; ++i)
acMesg[i] &= 127;
}
FileWrite(pcf, FLAGFALSE, acMesg, nc);
}
} else if (!FileBufEmpty(execCmdFile) &&
FileCanWrite(execCmdFile, &rmask, &wmask)) {
CONDDEBUG((1, "Interact(): flushing fd %d",
FileFDNum(execCmdFile)));
if (FileWrite(execCmdFile, FLAGFALSE, (char *)0, 0) < 0) {
/* -bryan */
break;
}
}
}
/* anything from socket? */
if (FileCanRead(pcf, &rmask, &wmask)) {
int l;
if ((nc = FileRead(pcf, acMesg, sizeof(acMesg))) < 0) {
/* if we got an error/eof after returning from suspend */
if (justSuspended) {
fprintf(stderr, "\n");
Error("lost connection");
}
break;
}
while ((l = ParseIACBuf(pcf, acMesg, &nc)) >= 0) {
if (l == 0) {
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);
#else
FileWrite(cfstdout, FLAGFALSE,
"stop not supported -- press any character to continue",
53);
#endif
} else if (FileSawQuoteGoto(pcf) == FLAGTRUE) {
gotoConsole = pcf;
if (gotoName != (char *)0)
free(gotoName);
if ((gotoName = StrDup(pcMach)) == (char *)0)
OutOfMem();
C2Cooked();
return;
}
} else {
if (FileSawQuoteAbrt(pcf) == FLAGTRUE) {
FD_CLR(FileFDNum(execCmdFile), &rinit);
FD_CLR(FileFDOutNum(execCmdFile), &winit);
FileClose(&execCmdFile);
kill(execCmdPid, SIGHUP);
}
}
continue;
}
if (fStrip) {
for (i = 0; i < l; ++i)
acMesg[i] &= 127;
}
FileWrite(cfstdout, FLAGFALSE, acMesg, l);
if (execCmdFile != (CONSFILE *)0) {
FileWrite(execCmdFile, FLAGFALSE, acMesg, l);
}
nc -= l;
MemMove(acMesg, acMesg + l, nc);
}
} else if (!FileBufEmpty(pcf) && FileCanWrite(pcf, &rmask, &wmask)) {
CONDDEBUG((1, "Interact(): flushing fd %d", FileFDNum(pcf)));
if (FileWrite(pcf, FLAGFALSE, (char *)0, 0) < 0) {
/* -bryan */
break;
}
}
/* anything from stdin? */
if (FD_ISSET(0, &rmask)) {
if ((nc = read(0, acMesg, sizeof(acMesg))) == 0) {
if (screwy)
break;
else {
FD_SET(0, &rinit);
continue;
}
}
if (execCmdFile == (CONSFILE *)0) {
if (fStrip) {
for (i = 0; i < nc; ++i)
acMesg[i] &= 127;
}
FileWrite(pcf, FLAGFALSE, acMesg, nc);
} else {
for (i = 0; i < nc; ++i) {
if (acMesg[i] == '\n' || acMesg[i] == '\r')
FilePrint(cfstdout, FLAGFALSE,
"[local command running - pid %lu]\r\n",
execCmdPid);
else if (acMesg[i] == 0x03) { /* ctrl-c */
kill(execCmdPid, SIGHUP);
FilePrint(cfstdout, FLAGFALSE,
"[local command sent SIGHUP - pid %lu]\r\n",
execCmdPid);
} else if (acMesg[i] == 0x1c) { /* ctrl-\ */
kill(execCmdPid, SIGKILL);
FilePrint(cfstdout, FLAGFALSE,
"[local command sent SIGKILL - pid %lu]\r\n",
execCmdPid);
}
}
}
}
}
C2Cooked();
if (fVerbose)
printf("Console %s closed.\n", pcMach);
}
/* interact with a group server (ksb)
*/
static int
void
#if PROTOTYPES
CallUp(CONSFILE *pcf, char *pcMaster, char *pcMach, char *pcHow,
char *result)
@ -900,15 +1114,9 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
char *pcMaster, *pcMach, *pcHow, *result;
#endif
{
int nc;
int fIn = '-';
fd_set rmask, wmask;
int i;
int justSuspended = 0;
char *r = (char *)0;
static char acMesg[8192];
gotoConsole = 0;
if (fVerbose) {
Msg("%s to %s (on %s)", pcHow, pcMach, pcMaster);
}
@ -1027,176 +1235,7 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
fflush(stdout);
fflush(stderr);
C2Raw();
/* set socket to non-blocking */
SetFlags(FileFDNum(pcf), O_NONBLOCK, 0);
/* read from stdin and the socket (non-blocking!).
* rmask indicates which descriptors to read from,
* the others are not used, nor is the result from
* select, read, or write.
*/
FD_ZERO(&rinit);
FD_ZERO(&winit);
FD_SET(FileFDNum(pcf), &rinit);
FD_SET(0, &rinit);
if (maxfd < FileFDNum(pcf) + 1)
maxfd = FileFDNum(pcf) + 1;
for (;;) {
justSuspended = 0;
if (fSawReapVirt) {
fSawReapVirt = 0;
ReapVirt();
}
/* reset read mask and select on it
*/
rmask = rinit;
wmask = winit;
if (-1 ==
select(maxfd, &rmask, &wmask, (fd_set *)0,
(struct timeval *)0)) {
if (errno != EINTR) {
Error("Master(): select(): %s", strerror(errno));
break;
}
continue;
}
/* anything from execCmd */
if (execCmdFile != (CONSFILE *)0) {
if (FileCanRead(execCmdFile, &rmask, &wmask)) {
if ((nc =
FileRead(execCmdFile, acMesg, sizeof(acMesg))) < 0) {
FD_CLR(FileFDNum(execCmdFile), &rinit);
FD_CLR(FileFDOutNum(execCmdFile), &winit);
FileClose(&execCmdFile);
FileSetQuoteIAC(pcf, FLAGFALSE);
FilePrint(pcf, FLAGFALSE, "%c%c", OB_IAC, OB_ABRT);
FileSetQuoteIAC(pcf, FLAGTRUE);
} else {
if (fStrip) {
for (i = 0; i < nc; ++i)
acMesg[i] &= 127;
}
FileWrite(pcf, FLAGFALSE, acMesg, nc);
}
} else if (!FileBufEmpty(execCmdFile) &&
FileCanWrite(execCmdFile, &rmask, &wmask)) {
CONDDEBUG((1, "CallUp(): flushing fd %d",
FileFDNum(execCmdFile)));
if (FileWrite(execCmdFile, FLAGFALSE, (char *)0, 0) < 0) {
/* -bryan */
break;
}
}
}
/* anything from socket? */
if (FileCanRead(pcf, &rmask, &wmask)) {
int l;
if ((nc = FileRead(pcf, acMesg, sizeof(acMesg))) < 0) {
/* if we got an error/eof after returning from suspend */
if (justSuspended) {
fprintf(stderr, "\n");
Error("lost connection");
}
break;
}
while ((l = ParseIACBuf(pcf, acMesg, &nc)) >= 0) {
if (l == 0) {
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);
#else
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;
}
if (fStrip) {
for (i = 0; i < l; ++i)
acMesg[i] &= 127;
}
FileWrite(cfstdout, FLAGFALSE, acMesg, l);
if (execCmdFile != (CONSFILE *)0) {
FileWrite(execCmdFile, FLAGFALSE, acMesg, l);
}
nc -= l;
MemMove(acMesg, acMesg + l, nc);
}
} else if (!FileBufEmpty(pcf) && FileCanWrite(pcf, &rmask, &wmask)) {
CONDDEBUG((1, "CallUp(): flushing fd %d", FileFDNum(pcf)));
if (FileWrite(pcf, FLAGFALSE, (char *)0, 0) < 0) {
/* -bryan */
break;
}
}
/* anything from stdin? */
if (FD_ISSET(0, &rmask)) {
if ((nc = read(0, acMesg, sizeof(acMesg))) == 0) {
if (screwy)
break;
else {
FD_SET(0, &rinit);
continue;
}
}
if (execCmdFile == (CONSFILE *)0) {
if (fStrip) {
for (i = 0; i < nc; ++i)
acMesg[i] &= 127;
}
FileWrite(pcf, FLAGFALSE, acMesg, nc);
} else {
for (i = 0; i < nc; ++i) {
if (acMesg[i] == '\n' || acMesg[i] == '\r')
FilePrint(cfstdout, FLAGFALSE,
"[local command running - pid %lu]\r\n",
execCmdPid);
else if (acMesg[i] == 0x03) { /* ctrl-c */
kill(execCmdPid, SIGHUP);
FilePrint(cfstdout, FLAGFALSE,
"[local command sent SIGHUP - pid %lu]\r\n",
execCmdPid);
} else if (acMesg[i] == 0x1c) { /* ctrl-\ */
kill(execCmdPid, SIGKILL);
FilePrint(cfstdout, FLAGFALSE,
"[local command sent SIGKILL - pid %lu]\r\n",
execCmdPid);
}
}
}
}
}
C2Cooked();
if (fVerbose)
printf("Console %s closed.\n", pcMach);
return 0;
Interact(pcf, pcMach);
}
/* shouldn't need more than 3 levels of commands (but alloc 4 just 'cause)
@ -1214,11 +1253,11 @@ char *cmdarg = (char *)0;
*/
int
#if PROTOTYPES
DoCmds(char *master, char *ports, int cmdi)
DoCmds(char *master, char *pports, int cmdi)
#else
DoCmds(master, ports, cmdi)
DoCmds(master, pports, cmdi)
char *master;
char *ports;
char *pports;
int cmdi;
#endif
{
@ -1229,6 +1268,11 @@ DoCmds(master, ports, cmdi)
unsigned short port;
char *result = (char *)0;
int len;
char *ports;
char *pcopy;
if ((pcopy = ports = StrDup(pports)) == (char *)0)
OutOfMem();
len = strlen(ports);
while (len > 0 && (ports[len - 1] == '\r' || ports[len - 1] == '\n'))
@ -1352,6 +1396,8 @@ DoCmds(master, ports, cmdi)
if (cmdi != 0) {
t = ReadReply(pcf, 0);
/* save the result */
if (result != (char *)0)
free(result);
if ((result = StrDup(t)) == (char *)0)
OutOfMem();
}
@ -1371,7 +1417,9 @@ DoCmds(master, ports, cmdi)
continue;
} else {
CallUp(pcf, server, cmdarg, cmds[0], result);
return 0;
if (pcf != gotoConsole)
FileClose(&pcf);
break;
}
} else if (cmds[cmdi][0] == 'q') {
t = ReadReply(pcf, 0);
@ -1388,6 +1436,8 @@ DoCmds(master, ports, cmdi)
if (cmdi == 0) {
int len;
/* if we hit bottom, this is where we get our results */
if (result != (char *)0)
free(result);
if ((result = StrDup(t)) == (char *)0)
OutOfMem();
len = strlen(result);
@ -1427,9 +1477,14 @@ DoCmds(master, ports, cmdi)
DoCmds(server, result, cmdi);
else if (cmdi > 0)
DoCmds(server, result, cmdi - 1);
free(result);
if (result != (char *)0)
free(result);
result = (char *)0;
}
if (result != (char *)0)
free(result);
free(pcopy);
return 0;
}
@ -1462,7 +1517,6 @@ main(argc, argv)
int i;
static STRING *textMsg = (STRING *)0;
int cmdi;
int retval;
static STRING *consoleName = (STRING *)0;
isMultiProc = 0; /* make sure stuff DOESN'T have the pid */
@ -1648,7 +1702,8 @@ main(argc, argv)
Error("missing console name");
Bye(EX_UNAVAILABLE);
}
cmdarg = argv[optind++];
if ((cmdarg = StrDup(argv[optind++])) == (char *)0)
OutOfMem();
} else if (*pcCmd == 't') {
if (optind >= argc) {
Error("missing message text");
@ -1737,35 +1792,53 @@ main(argc, argv)
}
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)
if (gotoConsole == (CONSFILE *)0)
DoCmds(pcInMaster, acPorts->string, cmdi);
else
Interact(gotoConsole, gotoName);
/* if we didn't ask for another console, done */
if (gotoConsole == (CONSFILE *)0 && prevConsole == (CONSFILE *)0)
break;
if (consoleName == (STRING *)0)
consoleName = AllocString();
C2Raw();
if (gotoConsole == -1)
FileWrite(cfstdout, FLAGFALSE, "[console: ", 10);
else
if (prevConsole == (CONSFILE *)0)
FileWrite(cfstdout, FLAGFALSE, "console: ", 9);
else
FileWrite(cfstdout, FLAGFALSE, "[console: ", 10);
GetUserInput(consoleName);
FileWrite(cfstdout, FLAGFALSE, "]\r\n", 3);
C2Cooked();
if (consoleName->used <= 1)
break;
cmdarg = consoleName->string;
gotoConsole = -1;
if (consoleName->used > 1) {
if (cmdarg != (char *)0)
free(cmdarg);
if ((cmdarg = StrDup(consoleName->string)) == (char *)0)
OutOfMem();
if (prevConsole == (CONSFILE *)0) {
prevConsole = gotoConsole;
gotoConsole = (CONSFILE *)0;
prevName = gotoName;
gotoName = (char *)0;
}
} else {
if (prevConsole != (CONSFILE *)0) {
gotoConsole = prevConsole;
prevConsole = (CONSFILE *)0;
gotoName = prevName;
prevName = (char *)0;
}
}
}
if (cmdarg != (char *)0)
free(cmdarg);
if (*pcCmd == 'd')
FilePrint(cfstdout, FLAGFALSE, "Disconnected %d users\n",
disconnectCount);
Bye(retval);
Bye(0);
return 0; /* noop - Bye() terminates us */
}

View File

@ -1,5 +1,5 @@
.\" $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"
.\" $Id: console.man,v 1.45 2004/03/20 14:40:42 bryan Exp $
.TH CONSOLE 1 "2004/03/20" "conserver-8.1.3" "conserver"
.SH NAME
console \- console server client program
.SH SYNOPSIS
@ -391,7 +391,7 @@ Commands are:
disconnect
.TP
.B ;
disconnect and login to another console
move to another console
.TP
.B a
attach read-write if nobody already is

View File

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

View File

@ -1,6 +1,6 @@
[Enter `^Ec?' for help]
[help]
. disconnect ; switch to another console
. disconnect ; move 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

View File

@ -1,6 +1,6 @@
[Enter `^Ec?' for help]
[help]
. disconnect ; switch to another console
. disconnect ; move 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