mirror of
https://github.com/bstansell/conserver.git
synced 2025-04-15 22:56:41 +00:00
Imported from conserver-8.0.2.tar.gz
This commit is contained in:
parent
de2e2fd33c
commit
66e0902358
18
CHANGES
18
CHANGES
@ -1,6 +1,22 @@
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
version 8.0.2 (Oct 5, 2003):
|
||||
- reworked the i/o calls to better buffer data
|
||||
- added console 'motd' option for holding a "message of the
|
||||
day", displayed to the client on attachment to console -
|
||||
suggested by Toby Gerhart <toby.gerhart@eds.com>
|
||||
- added ^Ecm client command for displaying MOTD and integrated
|
||||
it into the client console attachment sequence
|
||||
- now unallocate client lists when forking new child conserver
|
||||
processes
|
||||
- changed strdup() to local StrDup() so dmalloc can gracefully
|
||||
track changes
|
||||
- added a ^Ec; sequence to let client signal server when it's
|
||||
ready to see console data, otherwise a chatty console can
|
||||
cause the login sequence to fail and you can never attach to
|
||||
the console
|
||||
|
||||
version 8.0.1 (Sep 29, 2003):
|
||||
- fixed bug in access list parsing where multiple addresses per
|
||||
line can cause errors - reported by Jay McCanta
|
||||
@ -540,5 +556,5 @@ before version 6.05:
|
||||
and enhancements of various types were applied.
|
||||
|
||||
#
|
||||
# $Id: CHANGES,v 1.109 2003-09-29 08:41:20-07 bryan Exp $
|
||||
# $Id: CHANGES,v 1.115 2003-10-05 18:04:09-07 bryan Exp $
|
||||
#
|
||||
|
11
INSTALL
11
INSTALL
@ -10,6 +10,15 @@ Upgrading?
|
||||
new features added to the client if you're considering *not*
|
||||
upgrading.
|
||||
|
||||
Version 8.0.2
|
||||
|
||||
- I've added a '^Ec;' sequence to allow the client to signal the
|
||||
server as to when it's ready to see console data. Without
|
||||
this, verbose consoles will prevent clients from attaching
|
||||
(the client sees unexpected data). An 8.0.2 client should be
|
||||
compatible with an 8.0.1 server, but an 8.0.1 client is not
|
||||
compatible with an 8.0.2 server.
|
||||
|
||||
Version 8.0.1
|
||||
|
||||
- There's a slight client/server protocol change to implement
|
||||
@ -246,5 +255,5 @@ Other Information And Gotchas
|
||||
|
||||
|
||||
#
|
||||
# $Id: INSTALL,v 1.33 2003-09-28 17:50:05-07 bryan Exp $
|
||||
# $Id: INSTALL,v 1.34 2003-10-03 10:52:31-07 bryan Exp $
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $Id: conserver.cf.man,v 1.42 2003-09-28 12:23:04-07 bryan Exp $
|
||||
.TH CONSERVER.CF 5 "2003-09-28" "conserver-8.0.1" "conserver"
|
||||
.\" $Id: conserver.cf.man,v 1.43 2003-10-02 19:01:05-07 bryan Exp $
|
||||
.TH CONSERVER.CF 5 "2003-10-02" "conserver-8.0.2" "conserver"
|
||||
.SH NAME
|
||||
conserver.cf \- console configuration file for
|
||||
.BR conserver (8)
|
||||
@ -456,6 +456,16 @@ The host may be specified by
|
||||
or using the address
|
||||
.IR ipaddr .
|
||||
.TP
|
||||
.B motd
|
||||
.RI [ " message "
|
||||
| "" ]
|
||||
.br
|
||||
Set the "message of the day" for the console to
|
||||
.IR message ,
|
||||
which gets displayed when a client attaches to the console.
|
||||
If the null string (``""'') is used, the MOTD is unset and
|
||||
no message will occur.
|
||||
.TP
|
||||
.B options
|
||||
.RI [ " option" ,...
|
||||
| "" ]
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $Id: conserver.passwd.man,v 1.9 2003-07-04 13:20:52-07 bryan Exp $
|
||||
.TH CONSERVER.PASSWD 5 "2003-07-04" "conserver-8.0.1" "conserver"
|
||||
.TH CONSERVER.PASSWD 5 "2003-07-04" "conserver-8.0.2" "conserver"
|
||||
.SH NAME
|
||||
conserver.passwd \- user access information for
|
||||
.BR conserver (8)
|
||||
|
@ -183,11 +183,11 @@
|
||||
|
||||
<H3>Downloading</H3>
|
||||
|
||||
<P>The current version, released on Sep 29, 2003, is <A
|
||||
href="8.0.1.tar.gz">8.0.1.tar.gz</A>. You can get it via
|
||||
<P>The current version, released on Oct 5, 2003, is <A
|
||||
href="8.0.2.tar.gz">8.0.2.tar.gz</A>. You can get it via
|
||||
<A href=
|
||||
"ftp://ftp.conserver.com/conserver/8.0.1.tar.gz">FTP</A>
|
||||
or <A href="8.0.1.tar.gz">HTTP</A>. See the <A href=
|
||||
"ftp://ftp.conserver.com/conserver/8.0.2.tar.gz">FTP</A>
|
||||
or <A href="8.0.2.tar.gz">HTTP</A>. See the <A href=
|
||||
"CHANGES">CHANGES</A> file for information on the latest
|
||||
updates.</P>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: access.c,v 5.66 2003-08-15 14:24:39-07 bryan Exp $
|
||||
* $Id: access.c,v 5.67 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -241,7 +241,7 @@ SetDefAccess(pAddr, pHost)
|
||||
addr = inet_ntoa(*pAddr);
|
||||
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
if ((a->pcwho = strdup(addr)) == (char *)0)
|
||||
if ((a->pcwho = StrDup(addr)) == (char *)0)
|
||||
OutOfMem();
|
||||
a->ctrust = 'a';
|
||||
a->pACnext = pACList;
|
||||
@ -258,7 +258,7 @@ SetDefAccess(pAddr, pHost)
|
||||
|
||||
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
if ((a->pcwho = strdup(pcDomain)) == (char *)0)
|
||||
if ((a->pcwho = StrDup(pcDomain)) == (char *)0)
|
||||
OutOfMem();
|
||||
a->ctrust = 'a';
|
||||
a->pACnext = pACList;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: client.c,v 5.70 2003-09-28 08:42:06-07 bryan Exp $
|
||||
* $Id: client.c,v 5.72 2003-10-02 18:49:13-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -78,9 +78,10 @@ FindWrite(pCE)
|
||||
pCL->fwantwr = 0;
|
||||
pCL->fwr = 1;
|
||||
if (pCE->nolog) {
|
||||
FileWrite(pCL->fd, "\r\n[attached (nologging)]\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached (nologging)]\r\n",
|
||||
-1);
|
||||
} else {
|
||||
FileWrite(pCL->fd, "\r\n[attached]\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached]\r\n", -1);
|
||||
}
|
||||
TagLogfileAct(pCE, "%s attached", pCL->acid->string);
|
||||
pCE->pCLwr = pCL;
|
||||
@ -130,7 +131,8 @@ Replay(fdLog, fdOut, iBack)
|
||||
#endif
|
||||
|
||||
if ((CONSFILE *)0 == fdLog) {
|
||||
FileWrite(fdOut, "[no log file on this console]\r\n", -1);
|
||||
FileWrite(fdOut, FLAGFALSE, "[no log file on this console]\r\n",
|
||||
-1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -311,8 +313,8 @@ Replay(fdLog, fdOut, iBack)
|
||||
if ((char *)0 != s) {
|
||||
*s = '\000';
|
||||
}
|
||||
FileWrite(fdOut, lines[i].line->string, -1);
|
||||
FileWrite(fdOut, " .. ", -1);
|
||||
FileWrite(fdOut, FLAGTRUE, lines[i].line->string, -1);
|
||||
FileWrite(fdOut, FLAGTRUE, " .. ", -1);
|
||||
|
||||
/* build the end string by removing the leading "[-- MARK -- "
|
||||
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
|
||||
@ -323,12 +325,13 @@ Replay(fdLog, fdOut, iBack)
|
||||
if ((char *)0 != s) {
|
||||
*s = '\000';
|
||||
}
|
||||
FileWrite(fdOut, lines[i].mark_end->string + mark_len, -1);
|
||||
FileWrite(fdOut, " -- MARK --]\r\n", -1);
|
||||
FileWrite(fdOut, FLAGTRUE,
|
||||
lines[i].mark_end->string + mark_len, -1);
|
||||
FileWrite(fdOut, FLAGFALSE, " -- MARK --]\r\n", -1);
|
||||
u = lines[i].mark_end->used;
|
||||
s = lines[i].mark_end->string;
|
||||
} else
|
||||
FileWrite(fdOut, lines[i].line->string, -1);
|
||||
FileWrite(fdOut, FLAGFALSE, lines[i].line->string, -1);
|
||||
}
|
||||
|
||||
common_exit:
|
||||
@ -381,6 +384,7 @@ static HELP aHLTable[] = {
|
||||
{WHEN_ATTACH, "l? break sequence list"},
|
||||
{WHEN_ATTACH, "l0 send break per config file"},
|
||||
{WHEN_ATTACH, "l1-9 send specific break sequence"},
|
||||
{WHEN_ALWAYS, "m display the message of the day"},
|
||||
{WHEN_ALWAYS, "o (re)open the tty and log file"},
|
||||
{WHEN_ALWAYS, "p replay the last 60 lines"},
|
||||
{WHEN_ALWAYS, "r replay the last 20 lines"},
|
||||
@ -424,10 +428,10 @@ HelpUser(pCL)
|
||||
|
||||
iCmp = WHEN_ALWAYS | WHEN_SPY;
|
||||
if (pCL->fwr) {
|
||||
FileWrite(pCL->fd, acH1, sizeof(acH1) - 1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acH1, sizeof(acH1) - 1);
|
||||
iCmp |= WHEN_ATTACH;
|
||||
} else {
|
||||
FileWrite(pCL->fd, acH2, sizeof(acH2) - 1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acH2, sizeof(acH2) - 1);
|
||||
}
|
||||
if ('\033' == pCL->ic[0] && 'O' == pCL->ic[1]) {
|
||||
iCmp |= WHEN_VT100;
|
||||
@ -445,12 +449,12 @@ HelpUser(pCL)
|
||||
}
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
BuildString((char *)0, acLine);
|
||||
continue;
|
||||
} else {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
BuildString((char *)0, acLine);
|
||||
}
|
||||
}
|
||||
@ -459,15 +463,16 @@ HelpUser(pCL)
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
if (acLine->used > HALFLINE) {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
BuildString((char *)0, acLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (acLine->used != 0) {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
}
|
||||
FileWrite(pCL->fd, FLAGFALSE, (char *)0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -493,7 +498,8 @@ ClientAccessOk(pCL)
|
||||
request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0);
|
||||
fromhost(&request);
|
||||
if (!hosts_access(&request)) {
|
||||
FileWrite(pCL->fd, "access from your host refused\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE,
|
||||
"access from your host refused\r\n", -1);
|
||||
retval = 0;
|
||||
goto setpeer;
|
||||
}
|
||||
@ -503,13 +509,14 @@ ClientAccessOk(pCL)
|
||||
so = sizeof(in_port);
|
||||
if (-1 ==
|
||||
(getpeer = getpeername(cfd, (struct sockaddr *)&in_port, &so))) {
|
||||
FileWrite(pCL->fd, "getpeername failed\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE, "getpeername failed\r\n", -1);
|
||||
retval = 0;
|
||||
goto setpeer;
|
||||
}
|
||||
pCL->caccess = AccType(&in_port.sin_addr, &peername);
|
||||
if (pCL->caccess == 'r') {
|
||||
FileWrite(pCL->fd, "access from your host refused\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
|
||||
-1);
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: consent.c,v 5.127 2003-09-28 10:37:20-07 bryan Exp $
|
||||
* $Id: consent.c,v 5.128 2003-09-30 13:14:04-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -260,12 +260,13 @@ StopInit(pCE)
|
||||
return;
|
||||
|
||||
if (pCE->initpid != 0) {
|
||||
Verbose("[%s] initcmd terminated: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
CONDDEBUG((1, "StopInit(): sending initcmd pid %lu signal %d",
|
||||
(unsigned long)pCE->initpid, SIGHUP));
|
||||
kill(pCE->initpid, SIGHUP);
|
||||
pCE->initpid = 0;
|
||||
Verbose("[%s] initcmd terminated: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
TagLogfileAct(pCE, "initcmd terminated");
|
||||
CONDDEBUG((1, "StopInit(): sending initcmd pid %lu signal %d",
|
||||
(unsigned long)pCE->initpid, SIGHUP));
|
||||
}
|
||||
|
||||
if (pCE->initfile != (CONSFILE *)0) {
|
||||
@ -360,6 +361,7 @@ StartInit(pCE)
|
||||
}
|
||||
Verbose("[%s] initcmd started: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
TagLogfileAct(pCE, "initcmd started");
|
||||
FD_SET(pin[0], &rinit);
|
||||
if (maxfd < pin[0] + 1)
|
||||
maxfd = pin[0] + 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: consent.h,v 5.47 2003-09-28 08:43:04-07 bryan Exp $
|
||||
* $Id: consent.h,v 5.48 2003-10-02 18:49:03-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -98,6 +98,7 @@ typedef struct consent { /* console information */
|
||||
unsigned short breakNum; /* break type [1-9] */
|
||||
char *logfile; /* logfile */
|
||||
char *initcmd; /* initcmd command */
|
||||
char *motd; /* motd */
|
||||
/* timestamp stuff */
|
||||
int mark; /* Mark (chime) interval */
|
||||
long nextMark; /* Next mark (chime) time */
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
|
||||
.\" $Id: conserver.man,v 1.38 2003-09-22 08:33:41-07 bryan Exp $
|
||||
.TH CONSERVER 8 "2003-09-22" "conserver-8.0.1" "conserver"
|
||||
.TH CONSERVER 8 "2003-09-22" "conserver-8.0.2" "conserver"
|
||||
.SH NAME
|
||||
conserver \- console server daemon
|
||||
.SH SYNOPSIS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fallback.c,v 5.58 2003-08-15 08:18:26-07 bryan Exp $
|
||||
* $Id: fallback.c,v 5.59 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -261,7 +261,7 @@ FallBack(slave, sfd)
|
||||
}
|
||||
if ((*slave) != (char *)0)
|
||||
free(*slave);
|
||||
if (((*slave) = strdup(pcTSlave->string))
|
||||
if (((*slave) = StrDup(pcTSlave->string))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
return fd;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.c,v 5.160 2003-09-29 07:01:35-07 bryan Exp $
|
||||
* $Id: main.c,v 5.161 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -1179,13 +1179,13 @@ main(argc, argv)
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if ((optConf->secondaryport = strdup(optarg)) == (char *)0)
|
||||
if ((optConf->secondaryport = StrDup(optarg)) == (char *)0)
|
||||
OutOfMem();
|
||||
break;
|
||||
case 'c':
|
||||
#if HAVE_OPENSSL
|
||||
if ((optConf->sslcredentials =
|
||||
strdup(optarg)) == (char *)0)
|
||||
StrDup(optarg)) == (char *)0)
|
||||
OutOfMem();
|
||||
#endif
|
||||
break;
|
||||
@ -1213,7 +1213,7 @@ main(argc, argv)
|
||||
fNoinit = 1;
|
||||
break;
|
||||
case 'L':
|
||||
if ((optConf->logfile = strdup(optarg)) == (char *)0)
|
||||
if ((optConf->logfile = StrDup(optarg)) == (char *)0)
|
||||
OutOfMem();
|
||||
break;
|
||||
case 'm':
|
||||
@ -1239,11 +1239,11 @@ main(argc, argv)
|
||||
optConf->reinitcheck = atoi(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
if ((optConf->primaryport = strdup(optarg)) == (char *)0)
|
||||
if ((optConf->primaryport = StrDup(optarg)) == (char *)0)
|
||||
OutOfMem();
|
||||
break;
|
||||
case 'P':
|
||||
if ((optConf->passwdfile = strdup(optarg)) == (char *)0)
|
||||
if ((optConf->passwdfile = StrDup(optarg)) == (char *)0)
|
||||
OutOfMem();
|
||||
break;
|
||||
case 'R':
|
||||
@ -1356,11 +1356,11 @@ main(argc, argv)
|
||||
|
||||
/* set up the port to bind to */
|
||||
if (optConf->primaryport != (char *)0)
|
||||
config->primaryport = strdup(optConf->primaryport);
|
||||
config->primaryport = StrDup(optConf->primaryport);
|
||||
else if (pConfig->primaryport != (char *)0)
|
||||
config->primaryport = strdup(pConfig->primaryport);
|
||||
config->primaryport = StrDup(pConfig->primaryport);
|
||||
else
|
||||
config->primaryport = strdup(DEFPORT);
|
||||
config->primaryport = StrDup(DEFPORT);
|
||||
if (config->primaryport == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -1387,11 +1387,11 @@ main(argc, argv)
|
||||
|
||||
/* set up the secondary port to bind to */
|
||||
if (optConf->secondaryport != (char *)0)
|
||||
config->secondaryport = strdup(optConf->secondaryport);
|
||||
config->secondaryport = StrDup(optConf->secondaryport);
|
||||
else if (pConfig->secondaryport != (char *)0)
|
||||
config->secondaryport = strdup(pConfig->secondaryport);
|
||||
config->secondaryport = StrDup(pConfig->secondaryport);
|
||||
else
|
||||
config->secondaryport = strdup(DEFBASEPORT);
|
||||
config->secondaryport = StrDup(DEFBASEPORT);
|
||||
if (config->secondaryport == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -1417,20 +1417,20 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
if (optConf->passwdfile != (char *)0)
|
||||
config->passwdfile = strdup(optConf->passwdfile);
|
||||
config->passwdfile = StrDup(optConf->passwdfile);
|
||||
else if (pConfig->passwdfile != (char *)0)
|
||||
config->passwdfile = strdup(pConfig->passwdfile);
|
||||
config->passwdfile = StrDup(pConfig->passwdfile);
|
||||
else
|
||||
config->passwdfile = strdup(PASSWDFILE);
|
||||
config->passwdfile = StrDup(PASSWDFILE);
|
||||
if (config->passwdfile == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
if (optConf->logfile != (char *)0)
|
||||
config->logfile = strdup(optConf->logfile);
|
||||
config->logfile = StrDup(optConf->logfile);
|
||||
else if (pConfig->logfile != (char *)0)
|
||||
config->logfile = strdup(pConfig->logfile);
|
||||
config->logfile = StrDup(pConfig->logfile);
|
||||
else
|
||||
config->logfile = strdup(LOGFILEPATH);
|
||||
config->logfile = StrDup(LOGFILEPATH);
|
||||
if (config->logfile == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.c,v 5.115 2003-09-29 08:39:13-07 bryan Exp $
|
||||
* $Id: master.c,v 5.117 2003-10-03 07:23:37-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -42,7 +42,8 @@
|
||||
|
||||
static sig_atomic_t fSawQuit = 0, fSawHUP = 0, fSawUSR2 = 0, fSawUSR1 =
|
||||
0, fSawCHLD = 0;
|
||||
static CONSCLIENT *pCLfree = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCLmfree = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCLmall = (CONSCLIENT *)0;
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_CLIENT_CONNECTION
|
||||
static unsigned long dmallocMarkClientConnection = 0;
|
||||
#endif
|
||||
@ -331,25 +332,27 @@ CommandCall(pCL, args)
|
||||
}
|
||||
switch (found) {
|
||||
case 0:
|
||||
FilePrint(pCL->fd, "console `%s' not found\r\n", args);
|
||||
FilePrint(pCL->fd, FLAGFALSE, "console `%s' not found\r\n",
|
||||
args);
|
||||
break;
|
||||
case 1:
|
||||
if ((REMOTE *)0 != pRCFound) {
|
||||
if (config->redirect != FLAGTRUE) {
|
||||
FilePrint(pCL->fd,
|
||||
FilePrint(pCL->fd, FLAGFALSE,
|
||||
"automatic redirection disabled - console on master `%s'\r\n",
|
||||
pRCFound->rhost);
|
||||
} else {
|
||||
FilePrint(pCL->fd, "@%s\r\n", pRCFound->rhost);
|
||||
FilePrint(pCL->fd, FLAGFALSE, "@%s\r\n",
|
||||
pRCFound->rhost);
|
||||
}
|
||||
} else {
|
||||
FilePrint(pCL->fd, "%hu\r\n", prnum);
|
||||
FilePrint(pCL->fd, FLAGFALSE, "%hu\r\n", prnum);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
found = strlen(ambiguous);
|
||||
ambiguous[found - 2] = '\000';
|
||||
FilePrint(pCL->fd,
|
||||
FilePrint(pCL->fd, FLAGFALSE,
|
||||
"ambiguous console abbreviation, `%s'\r\n\tchoices are %s\r\n",
|
||||
args, ambiguous);
|
||||
break;
|
||||
@ -390,8 +393,8 @@ DropMasterClient(pCLServing, force)
|
||||
}
|
||||
*(pCLServing->ppCLbscan) = pCLServing->pCLscan;
|
||||
/* put on the free list */
|
||||
pCLServing->pCLnext = pCLfree;
|
||||
pCLfree = pCLServing;
|
||||
pCLServing->pCLnext = pCLmfree;
|
||||
pCLmfree = pCLServing;
|
||||
|
||||
/* we didn't touch pCLServing->pCLscan so the loop works */
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_CLIENT_CONNECTION
|
||||
@ -436,13 +439,14 @@ DoNormalRead(pCLServing)
|
||||
if (pCLServing->iState == S_PASSWD) {
|
||||
if (CheckPasswd(pCLServing, pCLServing->accmd->string) !=
|
||||
AUTH_SUCCESS) {
|
||||
FileWrite(pCLServing->fd, "invalid password\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"invalid password\r\n", -1);
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
}
|
||||
Verbose("<master> login %s", pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, "ok\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
pCLServing->iState = S_NORMAL;
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
continue;
|
||||
@ -484,16 +488,17 @@ DoNormalRead(pCLServing)
|
||||
for (ppc =
|
||||
(pCLServing->iState == S_IDENT ? apcHelp1 : apcHelp2);
|
||||
(char *)0 != *ppc; ++ppc) {
|
||||
FileWrite(pCLServing->fd, *ppc, -1);
|
||||
FileWrite(pCLServing->fd, FLAGTRUE, *ppc, -1);
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, (char *)0, 0);
|
||||
} else if (strcmp(pcCmd, "exit") == 0) {
|
||||
FileWrite(pCLServing->fd, "goodbye\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "goodbye\r\n", -1);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
#if HAVE_OPENSSL
|
||||
} else if (pCLServing->iState == S_IDENT &&
|
||||
strcmp(pcCmd, "ssl") == 0) {
|
||||
FileWrite(pCLServing->fd, "ok\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
if (!AttemptSSL(pCLServing)) {
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
@ -504,11 +509,12 @@ DoNormalRead(pCLServing)
|
||||
#if HAVE_OPENSSL
|
||||
if (config->sslrequired == FLAGTRUE &&
|
||||
FileGetType(pCLServing->fd) != SSLSocket) {
|
||||
FileWrite(pCLServing->fd, "encryption required\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"encryption required\r\n", -1);
|
||||
} else {
|
||||
#endif
|
||||
if (pcArgs == (char *)0) {
|
||||
FileWrite(pCLServing->fd,
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"login requires argument\r\n", -1);
|
||||
} else {
|
||||
BuildString((char *)0, pCLServing->username);
|
||||
@ -523,10 +529,10 @@ DoNormalRead(pCLServing)
|
||||
pCLServing->iState = S_NORMAL;
|
||||
Verbose("<master> login %s",
|
||||
pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, "ok\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
} else {
|
||||
FilePrint(pCLServing->fd, "passwd? %s\r\n",
|
||||
myHostname);
|
||||
FilePrint(pCLServing->fd, FLAGFALSE,
|
||||
"passwd? %s\r\n", myHostname);
|
||||
pCLServing->iState = S_PASSWD;
|
||||
}
|
||||
}
|
||||
@ -543,52 +549,60 @@ DoNormalRead(pCLServing)
|
||||
if (-1 ==
|
||||
getsockname(FileFDNum(pCLServing->fd),
|
||||
(struct sockaddr *)&lcl, &so)) {
|
||||
FileWrite(pCLServing->fd,
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"getsockname failed, try again later\r\n",
|
||||
-1);
|
||||
Error("Master(): getsockname(%u): %s",
|
||||
FileFDNum(pCLServing->fd), strerror(errno));
|
||||
Bye(EX_OSERR);
|
||||
}
|
||||
FilePrint(pCLServing->fd, "@%s", inet_ntoa(lcl.sin_addr));
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
|
||||
inet_ntoa(lcl.sin_addr));
|
||||
iSep = 0;
|
||||
}
|
||||
if (config->redirect == FLAGTRUE) {
|
||||
REMOTE *pRC;
|
||||
for (pRC = pRCUniq; (REMOTE *)0 != pRC; pRC = pRC->pRCuniq) {
|
||||
FilePrint(pCLServing->fd, ":@%s" + iSep, pRC->rhost);
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, ":@%s" + iSep,
|
||||
pRC->rhost);
|
||||
iSep = 0;
|
||||
}
|
||||
}
|
||||
FileWrite(pCLServing->fd, "\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "pid") == 0) {
|
||||
FilePrint(pCLServing->fd, "%lu\r\n", (unsigned long)thepid);
|
||||
FilePrint(pCLServing->fd, FLAGFALSE, "%lu\r\n",
|
||||
(unsigned long)thepid);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "version") == 0) {
|
||||
FilePrint(pCLServing->fd, "version `%s'\r\n", THIS_VERSION);
|
||||
FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n",
|
||||
THIS_VERSION);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "quit") == 0) {
|
||||
if (ConsentFindUser(pADList, pCLServing->username->string) !=
|
||||
(CONSENTUSERS *)0 ||
|
||||
ConsentFindUser(pADList, "*") != (CONSENTUSERS *)0) {
|
||||
Verbose("quit command by %s", pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, "ok -- terminated\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- terminated\r\n", -1);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
kill(thepid, SIGTERM);
|
||||
return;
|
||||
} else
|
||||
FileWrite(pCLServing->fd, "unauthorized command\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "restart") == 0) {
|
||||
if (ConsentFindUser(pADList, pCLServing->username->string) !=
|
||||
(CONSENTUSERS *)0 ||
|
||||
ConsentFindUser(pADList, "*") != (CONSENTUSERS *)0) {
|
||||
FileWrite(pCLServing->fd, "ok -- restarting\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- restarting\r\n", -1);
|
||||
Verbose("restart command by %s", pCLServing->acid->string);
|
||||
kill(thepid, SIGHUP);
|
||||
} else
|
||||
FileWrite(pCLServing->fd, "unauthorized command\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "groups") == 0) {
|
||||
int iSep = 1;
|
||||
@ -597,19 +611,21 @@ DoNormalRead(pCLServing)
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
|
||||
if (0 == pGE->imembers)
|
||||
continue;
|
||||
FilePrint(pCLServing->fd, ":%hu" + iSep, pGE->port);
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, ":%hu" + iSep,
|
||||
pGE->port);
|
||||
iSep = 0;
|
||||
}
|
||||
FileWrite(pCLServing->fd, "\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "call") == 0) {
|
||||
if (pcArgs == (char *)0)
|
||||
FileWrite(pCLServing->fd, "call requires argument\r\n",
|
||||
-1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"call requires argument\r\n", -1);
|
||||
else
|
||||
CommandCall(pCLServing, pcArgs);
|
||||
} else {
|
||||
FileWrite(pCLServing->fd, "unknown command\r\n", -1);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "unknown command\r\n",
|
||||
-1);
|
||||
}
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
}
|
||||
@ -633,7 +649,6 @@ Master()
|
||||
FILE *fp;
|
||||
CONSCLIENT *pCLServing = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCL = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCLall = (CONSCLIENT *)0;
|
||||
|
||||
|
||||
/* set up signal handler */
|
||||
@ -656,13 +671,13 @@ Master()
|
||||
SimpleSignal(SIGINT, FlagSawINT);
|
||||
|
||||
/* prime the free connection slots */
|
||||
if ((pCLfree = (CONSCLIENT *)calloc(1, sizeof(CONSCLIENT)))
|
||||
if ((pCLmfree = (CONSCLIENT *)calloc(1, sizeof(CONSCLIENT)))
|
||||
== (CONSCLIENT *)0)
|
||||
OutOfMem();
|
||||
pCLfree->accmd = AllocString();
|
||||
pCLfree->peername = AllocString();
|
||||
pCLfree->username = AllocString();
|
||||
pCLfree->acid = AllocString();
|
||||
pCLmfree->accmd = AllocString();
|
||||
pCLmfree->peername = AllocString();
|
||||
pCLmfree->username = AllocString();
|
||||
pCLmfree->acid = AllocString();
|
||||
|
||||
/* set up port for master to listen on
|
||||
*/
|
||||
@ -731,7 +746,7 @@ Master()
|
||||
ReReadCfg(msfd);
|
||||
/* fix up the client descriptors since ReReadCfg() doesn't
|
||||
* see them like it can in the child processes */
|
||||
for (pCL = pCLall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) {
|
||||
for (pCL = pCLmall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) {
|
||||
FD_SET(FileFDNum(pCL->fd), &rinit);
|
||||
if (maxfd < FileFDNum(pCL->fd) + 1)
|
||||
maxfd = FileFDNum(pCL->fd) + 1;
|
||||
@ -768,7 +783,7 @@ Master()
|
||||
}
|
||||
|
||||
/* anything on a connection? */
|
||||
for (pCLServing = pCLall; (CONSCLIENT *)0 != pCLServing;
|
||||
for (pCLServing = pCLmall; (CONSCLIENT *)0 != pCLServing;
|
||||
pCLServing = pCLServing->pCLscan) {
|
||||
switch (pCLServing->ioState) {
|
||||
#if HAVE_OPENSSL
|
||||
@ -791,7 +806,9 @@ Master()
|
||||
FileCanWrite(pCLServing->fd, &rmask, &wmask)) {
|
||||
CONDDEBUG((1, "Master(): flushing fd %d",
|
||||
FileFDNum(pCLServing->fd)));
|
||||
if (FileWrite(pCLServing->fd, (char *)0, 0) < 0) {
|
||||
if (FileWrite
|
||||
(pCLServing->fd, FLAGFALSE, (char *)0,
|
||||
0) < 0) {
|
||||
DropMasterClient(pCLServing, FLAGTRUE);
|
||||
break;
|
||||
}
|
||||
@ -823,7 +840,7 @@ Master()
|
||||
so = sizeof(struct sockaddr_in);
|
||||
for (cfd = 0; cfd == 0;) {
|
||||
cfd =
|
||||
accept(msfd, (struct sockaddr *)&pCLfree->cnct_port, &so);
|
||||
accept(msfd, (struct sockaddr *)&pCLmfree->cnct_port, &so);
|
||||
if (cfd < 0 && errno == EINTR)
|
||||
cfd = 0;
|
||||
}
|
||||
@ -838,11 +855,11 @@ Master()
|
||||
|
||||
/* set to non-blocking and wrap in a File object */
|
||||
if (SetFlags(cfd, O_NONBLOCK, 0))
|
||||
pCLfree->fd = FileOpenFD(cfd, simpleSocket);
|
||||
pCLmfree->fd = FileOpenFD(cfd, simpleSocket);
|
||||
else
|
||||
pCLfree->fd = (CONSFILE *)0;
|
||||
pCLmfree->fd = (CONSFILE *)0;
|
||||
|
||||
if ((CONSFILE *)0 == pCLfree->fd) {
|
||||
if ((CONSFILE *)0 == pCLmfree->fd) {
|
||||
Error("Master(): FileOpenFD(%u): %s", cfd, strerror(errno));
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_CLIENT_CONNECTION
|
||||
CONDDEBUG((1, "Master(): dmalloc / MarkClientConnection"));
|
||||
@ -852,27 +869,27 @@ Master()
|
||||
}
|
||||
|
||||
/* remove from the free list */
|
||||
pCL = pCLfree;
|
||||
pCLfree = pCL->pCLnext;
|
||||
pCL = pCLmfree;
|
||||
pCLmfree = pCL->pCLnext;
|
||||
|
||||
/* add another if we ran out */
|
||||
if (pCLfree == (CONSCLIENT *)0) {
|
||||
if ((pCLfree = (CONSCLIENT *)calloc(1, sizeof(CONSCLIENT)))
|
||||
if (pCLmfree == (CONSCLIENT *)0) {
|
||||
if ((pCLmfree = (CONSCLIENT *)calloc(1, sizeof(CONSCLIENT)))
|
||||
== (CONSCLIENT *)0)
|
||||
OutOfMem();
|
||||
pCLfree->accmd = AllocString();
|
||||
pCLfree->peername = AllocString();
|
||||
pCLfree->username = AllocString();
|
||||
pCLfree->acid = AllocString();
|
||||
pCLmfree->accmd = AllocString();
|
||||
pCLmfree->peername = AllocString();
|
||||
pCLmfree->username = AllocString();
|
||||
pCLmfree->acid = AllocString();
|
||||
}
|
||||
|
||||
/* link into all clients list */
|
||||
pCL->pCLscan = pCLall;
|
||||
pCL->ppCLbscan = &pCLall;
|
||||
pCL->pCLscan = pCLmall;
|
||||
pCL->ppCLbscan = &pCLmall;
|
||||
if ((CONSCLIENT *)0 != pCL->pCLscan) {
|
||||
pCL->pCLscan->ppCLbscan = &pCL->pCLscan;
|
||||
}
|
||||
pCLall = pCL;
|
||||
pCLmall = pCL;
|
||||
|
||||
FD_SET(cfd, &rinit);
|
||||
if (maxfd < cfd + 1)
|
||||
@ -888,16 +905,16 @@ Master()
|
||||
if (ClientAccessOk(pCL)) {
|
||||
pCL->ioState = ISNORMAL;
|
||||
/* say hi to start */
|
||||
FileWrite(pCL->fd, "ok\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
} else
|
||||
DropMasterClient(pCL, FLAGFALSE);
|
||||
}
|
||||
|
||||
/* clean up the free list */
|
||||
while (pCLfree != (CONSCLIENT *)0) {
|
||||
pCL = pCLfree->pCLnext;
|
||||
DestroyClient(pCLfree);
|
||||
pCLfree = pCL;
|
||||
while (pCLmfree != (CONSCLIENT *)0) {
|
||||
pCL = pCLmfree->pCLnext;
|
||||
DestroyClient(pCLmfree);
|
||||
pCLmfree = pCL;
|
||||
}
|
||||
|
||||
unlink(PIDFILE);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.h,v 5.16 2003-03-06 10:13:41-08 bryan Exp $
|
||||
* $Id: master.h,v 5.17 2003-10-03 07:23:37-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -37,5 +37,7 @@
|
||||
/*
|
||||
* stuff the master process needs
|
||||
*/
|
||||
extern CONSCLIENT *pCLmall;
|
||||
extern CONSCLIENT *pCLmfree;
|
||||
extern void Master PARAMS((void));
|
||||
extern void SignalKids PARAMS((int));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: readcfg.c,v 5.140 2003-09-28 09:32:55-07 bryan Exp $
|
||||
* $Id: readcfg.c,v 5.144 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -111,7 +111,7 @@ AddUserList(id)
|
||||
if ((u = (NAMES *)calloc(1, sizeof(NAMES)))
|
||||
== (NAMES *)0)
|
||||
OutOfMem();
|
||||
if ((u->name = strdup(id))
|
||||
if ((u->name = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
u->next = userList;
|
||||
@ -625,6 +625,8 @@ DestroyParserDefaultOrConsole(c, ph, pt)
|
||||
free(c->logfile);
|
||||
if (c->initcmd != (char *)0)
|
||||
free(c->initcmd);
|
||||
if (c->motd != (char *)0)
|
||||
free(c->motd);
|
||||
if (c->execSlave != (char *)0)
|
||||
free(c->execSlave);
|
||||
if (c->wbuf != (STRING *)0)
|
||||
@ -702,37 +704,43 @@ ApplyDefault(d, c)
|
||||
if (d->host != (char *)0) {
|
||||
if (c->host != (char *)0)
|
||||
free(c->host);
|
||||
if ((c->host = strdup(d->host)) == (char *)0)
|
||||
if ((c->host = StrDup(d->host)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->master != (char *)0) {
|
||||
if (c->master != (char *)0)
|
||||
free(c->master);
|
||||
if ((c->master = strdup(d->master)) == (char *)0)
|
||||
if ((c->master = StrDup(d->master)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->exec != (char *)0) {
|
||||
if (c->exec != (char *)0)
|
||||
free(c->exec);
|
||||
if ((c->exec = strdup(d->exec)) == (char *)0)
|
||||
if ((c->exec = StrDup(d->exec)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->device != (char *)0) {
|
||||
if (c->device != (char *)0)
|
||||
free(c->device);
|
||||
if ((c->device = strdup(d->device)) == (char *)0)
|
||||
if ((c->device = StrDup(d->device)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->logfile != (char *)0) {
|
||||
if (c->logfile != (char *)0)
|
||||
free(c->logfile);
|
||||
if ((c->logfile = strdup(d->logfile)) == (char *)0)
|
||||
if ((c->logfile = StrDup(d->logfile)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->initcmd != (char *)0) {
|
||||
if (c->initcmd != (char *)0)
|
||||
free(c->initcmd);
|
||||
if ((c->initcmd = strdup(d->initcmd)) == (char *)0)
|
||||
if ((c->initcmd = StrDup(d->initcmd)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->motd != (char *)0) {
|
||||
if (c->motd != (char *)0)
|
||||
free(c->motd);
|
||||
if ((c->motd = StrDup(d->motd)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (d->ro != (CONSENTUSERS *)0) {
|
||||
@ -770,7 +778,7 @@ DefaultBegin(id)
|
||||
== (CONSENT *)0)
|
||||
OutOfMem();
|
||||
|
||||
if ((parserDefaultTemp->server = strdup(id))
|
||||
if ((parserDefaultTemp->server = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -918,7 +926,7 @@ ProcessDevice(c, id)
|
||||
}
|
||||
if ((id == (char *)0) || (*id == '\000'))
|
||||
return;
|
||||
if ((c->device = strdup(id))
|
||||
if ((c->device = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -951,7 +959,7 @@ ProcessExec(c, id)
|
||||
if (id == (char *)0 || id[0] == '\000') {
|
||||
return;
|
||||
}
|
||||
if ((c->exec = strdup(id))
|
||||
if ((c->exec = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1008,7 +1016,7 @@ ProcessHost(c, id)
|
||||
}
|
||||
if ((id == (char *)0) || (*id == '\000'))
|
||||
return;
|
||||
if ((c->host = strdup(id))
|
||||
if ((c->host = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1074,16 +1082,16 @@ ProcessLogfile(c, id)
|
||||
if (id == (char *)0 || id[0] == '\000') {
|
||||
return;
|
||||
}
|
||||
if ((c->logfile = strdup(id))
|
||||
if ((c->logfile = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ProcessRuninit(CONSENT *c, char *id)
|
||||
ProcessInitcmd(CONSENT *c, char *id)
|
||||
#else
|
||||
ProcessRuninit(c, id)
|
||||
ProcessInitcmd(c, id)
|
||||
CONSENT *c;
|
||||
char *id;
|
||||
#endif
|
||||
@ -1095,7 +1103,28 @@ ProcessRuninit(c, id)
|
||||
if (id == (char *)0 || id[0] == '\000') {
|
||||
return;
|
||||
}
|
||||
if ((c->initcmd = strdup(id))
|
||||
if ((c->initcmd = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ProcessMOTD(CONSENT *c, char *id)
|
||||
#else
|
||||
ProcessMOTD(c, id)
|
||||
CONSENT *c;
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
if (c->motd != (char *)0) {
|
||||
free(c->motd);
|
||||
c->motd = (char *)0;
|
||||
}
|
||||
if (id == (char *)0 || id[0] == '\000') {
|
||||
return;
|
||||
}
|
||||
if ((c->motd = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1114,14 +1143,26 @@ DefaultItemLogfile(id)
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DefaultItemRuninit(char *id)
|
||||
DefaultItemInitcmd(char *id)
|
||||
#else
|
||||
DefaultItemRuninit(id)
|
||||
DefaultItemInitcmd(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "DefaultItemRuninit(%s) [%s:%d]", id, file, line));
|
||||
ProcessRuninit(parserDefaultTemp, id);
|
||||
CONDDEBUG((1, "DefaultItemInitcmd(%s) [%s:%d]", id, file, line));
|
||||
ProcessInitcmd(parserDefaultTemp, id);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DefaultItemMOTD(char *id)
|
||||
#else
|
||||
DefaultItemMOTD(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "DefaultItemMOTD(%s) [%s:%d]", id, file, line));
|
||||
ProcessMOTD(parserDefaultTemp, id);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1139,7 +1180,7 @@ ProcessMaster(c, id)
|
||||
}
|
||||
if ((id == (char *)0) || (*id == '\000'))
|
||||
return;
|
||||
if ((c->master = strdup(id))
|
||||
if ((c->master = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1583,7 +1624,7 @@ ConsoleBegin(id)
|
||||
"*")) != (CONSENT *)0) {
|
||||
ApplyDefault(c, parserConsoleTemp);
|
||||
}
|
||||
if ((parserConsoleTemp->server = strdup(id))
|
||||
if ((parserConsoleTemp->server = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1738,7 +1779,7 @@ ExpandLogfile(c, id)
|
||||
*amp = '&';
|
||||
}
|
||||
tmp = BuildTmpString(p);
|
||||
if ((c->logfile = strdup(tmp))
|
||||
if ((c->logfile = StrDup(tmp))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1766,10 +1807,10 @@ ConsoleAdd(c)
|
||||
if ((pRCTemp = (REMOTE *)calloc(1, sizeof(REMOTE)))
|
||||
== (REMOTE *)0)
|
||||
OutOfMem();
|
||||
if ((pRCTemp->rhost = strdup(c->master))
|
||||
if ((pRCTemp->rhost = StrDup(c->master))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
if ((pRCTemp->rserver = strdup(c->server))
|
||||
if ((pRCTemp->rserver = StrDup(c->server))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
pRCTemp->aliases = c->aliases;
|
||||
@ -2127,6 +2168,7 @@ ConsoleAdd(c)
|
||||
}
|
||||
|
||||
/* and now the rest (minus the "runtime" members - see below) */
|
||||
SwapStr(pCEmatch->motd, c->motd);
|
||||
pCEmatch->activitylog = c->activitylog;
|
||||
pCEmatch->breaklog = c->breaklog;
|
||||
pCEmatch->mark = c->mark;
|
||||
@ -2316,7 +2358,7 @@ ConsoleDestroy()
|
||||
continue;
|
||||
pCL->fro = access;
|
||||
if (access) {
|
||||
FileWrite(pCL->fd,
|
||||
FileWrite(pCL->fd, FLAGFALSE,
|
||||
"[Conserver reconfigured - r/w access removed]\r\n",
|
||||
-1);
|
||||
if (pCL->fwr) {
|
||||
@ -2333,7 +2375,7 @@ ConsoleDestroy()
|
||||
FindWrite(pCE);
|
||||
}
|
||||
} else {
|
||||
FileWrite(pCL->fd,
|
||||
FileWrite(pCL->fd, FLAGFALSE,
|
||||
"[Conserver reconfigured - r/w access granted]\r\n",
|
||||
-1);
|
||||
}
|
||||
@ -2403,7 +2445,7 @@ ConsoleItemAliases(id)
|
||||
}
|
||||
if ((name = (NAMES *)calloc(1, sizeof(NAMES))) == (NAMES *)0)
|
||||
OutOfMem();
|
||||
if ((name->name = strdup(token)) == (char *)0)
|
||||
if ((name->name = StrDup(token)) == (char *)0)
|
||||
OutOfMem();
|
||||
name->next = parserConsoleTemp->aliases;
|
||||
parserConsoleTemp->aliases = name;
|
||||
@ -2508,14 +2550,26 @@ ConsoleItemLogfile(id)
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConsoleItemRuninit(char *id)
|
||||
ConsoleItemInitcmd(char *id)
|
||||
#else
|
||||
ConsoleItemRuninit(id)
|
||||
ConsoleItemInitcmd(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConsoleItemRuninit(%s) [%s:%d]", id, file, line));
|
||||
ProcessRuninit(parserConsoleTemp, id);
|
||||
CONDDEBUG((1, "ConsoleItemInitcmd(%s) [%s:%d]", id, file, line));
|
||||
ProcessInitcmd(parserConsoleTemp, id);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConsoleItemMOTD(char *id)
|
||||
#else
|
||||
ConsoleItemMOTD(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConsoleItemMOTD(%s) [%s:%d]", id, file, line));
|
||||
ProcessMOTD(parserConsoleTemp, id);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2713,7 +2767,7 @@ AccessAddACL(pa, access)
|
||||
== (ACCESS *)0)
|
||||
OutOfMem();
|
||||
*new = *access;
|
||||
if ((new->pcwho = strdup(access->pcwho))
|
||||
if ((new->pcwho = StrDup(access->pcwho))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
/* link into the list at the end */
|
||||
@ -3007,7 +3061,7 @@ AccessProcessACL(trust, acl)
|
||||
OutOfMem();
|
||||
pa->ctrust = trust;
|
||||
pa->isCIDR = isCIDR;
|
||||
if ((pa->pcwho = strdup(token))
|
||||
if ((pa->pcwho = StrDup(token))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -3078,6 +3132,8 @@ DestroyConfig(c)
|
||||
free(c->logfile);
|
||||
if (c->initcmd != (char *)0)
|
||||
free(c->initcmd);
|
||||
if (c->motd != (char *)0)
|
||||
free(c->motd);
|
||||
if (c->passwdfile != (char *)0)
|
||||
free(c->passwdfile);
|
||||
if (c->primaryport != (char *)0)
|
||||
@ -3143,6 +3199,12 @@ ConfigEnd()
|
||||
pConfig->initcmd = parserConfigTemp->initcmd;
|
||||
parserConfigTemp->initcmd = (char *)0;
|
||||
}
|
||||
if (parserConfigTemp->motd != (char *)0) {
|
||||
if (pConfig->motd != (char *)0)
|
||||
free(pConfig->motd);
|
||||
pConfig->motd = parserConfigTemp->motd;
|
||||
parserConfigTemp->motd = (char *)0;
|
||||
}
|
||||
if (parserConfigTemp->passwdfile != (char *)0) {
|
||||
if (pConfig->passwdfile != (char *)0)
|
||||
free(pConfig->passwdfile);
|
||||
@ -3289,7 +3351,7 @@ ConfigItemLogfile(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->logfile = strdup(id))
|
||||
if ((parserConfigTemp->logfile = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3310,7 +3372,7 @@ ConfigItemPasswordfile(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->passwdfile = strdup(id))
|
||||
if ((parserConfigTemp->passwdfile = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3331,7 +3393,7 @@ ConfigItemPrimaryport(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->primaryport = strdup(id))
|
||||
if ((parserConfigTemp->primaryport = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3395,7 +3457,7 @@ ConfigItemSecondaryport(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->secondaryport = strdup(id))
|
||||
if ((parserConfigTemp->secondaryport = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3417,7 +3479,7 @@ ConfigItemSslcredentials(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->sslcredentials = strdup(id))
|
||||
if ((parserConfigTemp->sslcredentials = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3455,13 +3517,14 @@ ITEM keyDefault[] = {
|
||||
/* {"flow", DefaultItemFlow}, */
|
||||
{"host", DefaultItemHost},
|
||||
{"include", DefaultItemInclude},
|
||||
{"initcmd", DefaultItemInitcmd},
|
||||
{"logfile", DefaultItemLogfile},
|
||||
{"master", DefaultItemMaster},
|
||||
{"motd", DefaultItemMOTD},
|
||||
{"options", DefaultItemOptions},
|
||||
{"parity", DefaultItemParity},
|
||||
{"port", DefaultItemPort},
|
||||
{"ro", DefaultItemRo},
|
||||
{"initcmd", DefaultItemRuninit},
|
||||
{"rw", DefaultItemRw},
|
||||
{"timestamp", DefaultItemTimestamp},
|
||||
{"type", DefaultItemType},
|
||||
@ -3477,13 +3540,14 @@ ITEM keyConsole[] = {
|
||||
/* {"flow", ConsoleItemFlow}, */
|
||||
{"host", ConsoleItemHost},
|
||||
{"include", ConsoleItemInclude},
|
||||
{"initcmd", ConsoleItemInitcmd},
|
||||
{"logfile", ConsoleItemLogfile},
|
||||
{"master", ConsoleItemMaster},
|
||||
{"motd", ConsoleItemMOTD},
|
||||
{"options", ConsoleItemOptions},
|
||||
{"parity", ConsoleItemParity},
|
||||
{"port", ConsoleItemPort},
|
||||
{"ro", ConsoleItemRo},
|
||||
{"initcmd", ConsoleItemRuninit},
|
||||
{"rw", ConsoleItemRw},
|
||||
{"timestamp", ConsoleItemTimestamp},
|
||||
{"type", ConsoleItemType},
|
||||
@ -4005,7 +4069,7 @@ ReReadCfg(fd)
|
||||
strcmp(pConfig->logfile, config->logfile) != 0)) {
|
||||
if (config->logfile != (char *)0)
|
||||
free(config->logfile);
|
||||
if ((config->logfile = strdup(pConfig->logfile))
|
||||
if ((config->logfile = StrDup(pConfig->logfile))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
ReopenLogfile();
|
||||
@ -4022,7 +4086,7 @@ ReReadCfg(fd)
|
||||
strcmp(pConfig->passwdfile, config->passwdfile) != 0)) {
|
||||
if (config->passwdfile != (char *)0)
|
||||
free(config->passwdfile);
|
||||
if ((config->passwdfile = strdup(pConfig->passwdfile))
|
||||
if ((config->passwdfile = StrDup(pConfig->passwdfile))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
/* gets used on-the-fly */
|
||||
@ -4071,7 +4135,7 @@ ReReadCfg(fd)
|
||||
strcasecmp(pConfig->primaryport, config->primaryport) != 0)) {
|
||||
if (config->primaryport != (char *)0)
|
||||
free(config->primaryport);
|
||||
if ((config->primaryport = strdup(pConfig->primaryport))
|
||||
if ((config->primaryport = StrDup(pConfig->primaryport))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `primaryport' config option changed - you must restart for it to take effect");
|
||||
@ -4083,7 +4147,7 @@ ReReadCfg(fd)
|
||||
config->secondaryport) != 0)) {
|
||||
if (config->secondaryport != (char *)0)
|
||||
free(config->secondaryport);
|
||||
if ((config->secondaryport = strdup(pConfig->secondaryport))
|
||||
if ((config->secondaryport = StrDup(pConfig->secondaryport))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `secondaryport' config option changed - you must restart for it to take effect");
|
||||
@ -4096,7 +4160,7 @@ ReReadCfg(fd)
|
||||
config->sslcredentials) != 0)) {
|
||||
if (config->sslcredentials != (char *)0)
|
||||
free(config->sslcredentials);
|
||||
if ((config->sslcredentials = strdup(pConfig->sslcredentials))
|
||||
if ((config->sslcredentials = StrDup(pConfig->sslcredentials))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `sslcredentials' config option changed - you must restart for it to take effect");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: readcfg.h,v 5.32 2003-09-28 08:54:16-07 bryan Exp $
|
||||
* $Id: readcfg.h,v 5.33 2003-10-02 18:53:48-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -12,6 +12,7 @@ typedef struct config {
|
||||
FLAG daemonmode;
|
||||
char *logfile;
|
||||
char *initcmd;
|
||||
char *motd;
|
||||
char *passwdfile;
|
||||
char *primaryport;
|
||||
FLAG redirect;
|
||||
|
148
conserver/util.c
148
conserver/util.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: util.c,v 1.99 2003-09-28 08:51:52-07 bryan Exp $
|
||||
* $Id: util.c,v 1.102 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -1012,9 +1012,15 @@ FileRead(cfp, buf, len)
|
||||
if (tmpString == (STRING *)0)
|
||||
tmpString = AllocString();
|
||||
BuildString((char *)0, tmpString);
|
||||
FmtCtlStr(buf, retval > 30 ? 30 : retval, tmpString);
|
||||
CONDDEBUG((2, "FileRead(): read `%s' from fd %d",
|
||||
tmpString->string, cfp->fd));
|
||||
if (retval > 30) {
|
||||
FmtCtlStr(buf, 30, tmpString);
|
||||
CONDDEBUG((2, "FileRead(): read `%s'... from fd %d",
|
||||
tmpString->string, cfp->fd));
|
||||
} else {
|
||||
FmtCtlStr(buf, retval, tmpString);
|
||||
CONDDEBUG((2, "FileRead(): read `%s' from fd %d",
|
||||
tmpString->string, cfp->fd));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CONDDEBUG((2,
|
||||
@ -1027,10 +1033,11 @@ FileRead(cfp, buf, len)
|
||||
/* returns: -1 on error or eof, >= 0 for valid reads */
|
||||
int
|
||||
#if PROTOTYPES
|
||||
FileWrite(CONSFILE *cfp, char *buf, int len)
|
||||
FileWrite(CONSFILE *cfp, FLAG bufferonly, char *buf, int len)
|
||||
#else
|
||||
FileWrite(cfp, buf, len)
|
||||
FileWrite(cfp, bufferonly, buf, len)
|
||||
CONSFILE *cfp;
|
||||
FLAG bufferonly;
|
||||
char *buf;
|
||||
int len;
|
||||
#endif
|
||||
@ -1053,14 +1060,23 @@ FileWrite(cfp, buf, len)
|
||||
if (tmpString == (STRING *)0)
|
||||
tmpString = AllocString();
|
||||
BuildString((char *)0, tmpString);
|
||||
FmtCtlStr(buf, len > 30 ? 30 : len, tmpString);
|
||||
CONDDEBUG((2, "FileWrite(): sending `%s' to fd %d",
|
||||
tmpString->string, fdout));
|
||||
if (len > 30) {
|
||||
FmtCtlStr(buf, 30, tmpString);
|
||||
CONDDEBUG((2, "FileWrite(): sending `%s'... to fd %d",
|
||||
tmpString->string, fdout));
|
||||
} else {
|
||||
FmtCtlStr(buf, len, tmpString);
|
||||
CONDDEBUG((2, "FileWrite(): sending `%s' to fd %d",
|
||||
tmpString->string, fdout));
|
||||
}
|
||||
}
|
||||
/* save the data */
|
||||
if (len > 0 && buf != (char *)0)
|
||||
BuildStringN(buf, len, cfp->wbuf);
|
||||
|
||||
if (bufferonly == FLAGTRUE)
|
||||
return 0;
|
||||
|
||||
/* point at the local data */
|
||||
buf = cfp->wbuf->string;
|
||||
len = cfp->wbuf->used - 1;
|
||||
@ -1253,12 +1269,12 @@ FileBufEmpty(cfp)
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
VWrite(CONSFILE *cfp, STRING *str, unsigned which, char *fmt, va_list ap)
|
||||
VWrite(CONSFILE *cfp, FLAG bufferonly, STRING *str, char *fmt, va_list ap)
|
||||
#else
|
||||
VWrite(cfp, str, which, fmt, ap)
|
||||
VWrite(cfp, bufferonly, str, fmt, ap)
|
||||
CONSFILE *cfp;
|
||||
FLAG bufferonly;
|
||||
STRING *str;
|
||||
unsigned which;
|
||||
char *fmt;
|
||||
va_list ap;
|
||||
#endif
|
||||
@ -1266,41 +1282,28 @@ VWrite(cfp, str, which, fmt, ap)
|
||||
int s, l, e;
|
||||
char c;
|
||||
static STRING *msg = (STRING *)0;
|
||||
static STRING *output = (STRING *)0;
|
||||
static short flong, fneg;
|
||||
|
||||
if (fmt == (char *)0)
|
||||
if (fmt == (char *)0 || (cfp == (CONSFILE *)0 && str == (STRING *)0))
|
||||
return;
|
||||
switch (which) {
|
||||
case 0:
|
||||
if (cfp == (CONSFILE *)0)
|
||||
return;
|
||||
break;
|
||||
case 1:
|
||||
if (str == (STRING *)0)
|
||||
return;
|
||||
BuildString((char *)0, str);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg == (STRING *)0)
|
||||
msg = AllocString();
|
||||
if (output == (STRING *)0)
|
||||
output = AllocString();
|
||||
|
||||
BuildString((char *)0, output);
|
||||
|
||||
fneg = flong = 0;
|
||||
for (e = s = l = 0; (c = fmt[s + l]) != '\000'; l++) {
|
||||
if (c == '%') {
|
||||
if (e) {
|
||||
e = 0;
|
||||
if (which == 0)
|
||||
FileWrite(cfp, "%", 1);
|
||||
else if (which == 1)
|
||||
BuildStringChar('%', str);
|
||||
BuildStringChar('%', output);
|
||||
} else {
|
||||
e = 1;
|
||||
if (which == 0)
|
||||
FileWrite(cfp, fmt + s, l);
|
||||
else if (which == 1)
|
||||
BuildStringN(fmt + s, l, str);
|
||||
BuildStringN(fmt + s, l, output);
|
||||
s += l;
|
||||
l = 0;
|
||||
}
|
||||
@ -1320,17 +1323,11 @@ VWrite(cfp, str, which, fmt, ap)
|
||||
continue;
|
||||
case 'c':
|
||||
cc = (char)va_arg(ap, int);
|
||||
if (which == 0)
|
||||
FileWrite(cfp, &cc, 1);
|
||||
else if (which == 1)
|
||||
BuildStringChar(cc, str);
|
||||
BuildStringChar(cc, output);
|
||||
break;
|
||||
case 's':
|
||||
p = va_arg(ap, char *);
|
||||
if (which == 0)
|
||||
FileWrite(cfp, p, -1);
|
||||
else if (which == 1)
|
||||
BuildString(p, str);
|
||||
BuildString(p, output);
|
||||
break;
|
||||
case 'd':
|
||||
i = (flong ? va_arg(ap, long) : (long)va_arg(ap, int));
|
||||
@ -1361,16 +1358,10 @@ VWrite(cfp, str, which, fmt, ap)
|
||||
msg->string[u - i - 1] = temp;
|
||||
}
|
||||
if (fneg) {
|
||||
if (which == 0)
|
||||
FileWrite(cfp, "-", 1);
|
||||
else if (which == 1)
|
||||
BuildStringChar('-', str);
|
||||
BuildStringChar('-', output);
|
||||
fneg = 0;
|
||||
}
|
||||
if (which == 0)
|
||||
FileWrite(cfp, msg->string, msg->used - 1);
|
||||
else if (which == 1)
|
||||
BuildString(msg->string, str);
|
||||
BuildString(msg->string, output);
|
||||
break;
|
||||
default:
|
||||
Error
|
||||
@ -1383,11 +1374,17 @@ VWrite(cfp, str, which, fmt, ap)
|
||||
e = flong = 0;
|
||||
}
|
||||
}
|
||||
if (l) {
|
||||
if (which == 0)
|
||||
FileWrite(cfp, fmt + s, l);
|
||||
else if (which == 1)
|
||||
BuildStringN(fmt + s, l, str);
|
||||
if (l)
|
||||
BuildStringN(fmt + s, l, output);
|
||||
|
||||
if (str != (STRING *)0)
|
||||
BuildString((char *)0, str);
|
||||
|
||||
if (output->used > 1) {
|
||||
if (str != (STRING *)0)
|
||||
BuildStringN(output->string, output->used - 1, str);
|
||||
if (cfp != (CONSFILE *)0)
|
||||
FileWrite(cfp, bufferonly, output->string, output->used - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1407,7 +1404,7 @@ BuildStringPrint(str, fmt, va_alist)
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
VWrite((CONSFILE *)0, str, 1, fmt, ap);
|
||||
VWrite((CONSFILE *)0, FLAGFALSE, str, fmt, ap);
|
||||
va_end(ap);
|
||||
if (str == (STRING *)0)
|
||||
return (char *)0;
|
||||
@ -1417,23 +1414,25 @@ BuildStringPrint(str, fmt, va_alist)
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
FileVWrite(CONSFILE *cfp, char *fmt, va_list ap)
|
||||
FileVWrite(CONSFILE *cfp, FLAG bufferonly, char *fmt, va_list ap)
|
||||
#else
|
||||
FileVWrite(cfp, fmt, ap)
|
||||
FileVWrite(cfp, bufferonly, fmt, ap)
|
||||
CONSFILE *cfp;
|
||||
FLAG bufferonly;
|
||||
char *fmt;
|
||||
va_list ap;
|
||||
#endif
|
||||
{
|
||||
VWrite(cfp, (STRING *)0, 0, fmt, ap);
|
||||
VWrite(cfp, bufferonly, (STRING *)0, fmt, ap);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
FilePrint(CONSFILE *cfp, char *fmt, ...)
|
||||
FilePrint(CONSFILE *cfp, FLAG bufferonly, char *fmt, ...)
|
||||
#else
|
||||
FilePrint(cfp, fmt, va_alist)
|
||||
FilePrint(cfp, bufferonly, fmt, va_alist)
|
||||
CONSFILE *cfp;
|
||||
FLAG bufferonly;
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
@ -1444,7 +1443,7 @@ FilePrint(cfp, fmt, va_alist)
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
FileVWrite(cfp, fmt, ap);
|
||||
FileVWrite(cfp, bufferonly, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@ -1915,3 +1914,28 @@ SetFlags(fd, s, c)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *
|
||||
#if PROTOTYPES
|
||||
StrDup(char *msg)
|
||||
#else
|
||||
StrDup(msg)
|
||||
char *msg;
|
||||
#endif
|
||||
{
|
||||
int len;
|
||||
char *buf;
|
||||
|
||||
if (msg == (char *)0)
|
||||
return (char *)0;
|
||||
len = strlen(msg) + 1;
|
||||
buf = malloc(len);
|
||||
if (buf == (char *)0)
|
||||
return (char *)0;
|
||||
#if HAVE_MEMCPY
|
||||
memcpy(buf, msg, len);
|
||||
#else
|
||||
bcopy(msg, buf, len);
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: util.h,v 1.53 2003-09-28 08:45:31-07 bryan Exp $
|
||||
* $Id: util.h,v 1.55 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -102,9 +102,9 @@ extern CONSFILE *FileOpenPipe PARAMS((int, int));
|
||||
extern CONSFILE *FileOpen PARAMS((const char *, int, int));
|
||||
extern int FileClose PARAMS((CONSFILE **));
|
||||
extern int FileRead PARAMS((CONSFILE *, void *, int));
|
||||
extern int FileWrite PARAMS((CONSFILE *, char *, int));
|
||||
extern void FileVWrite PARAMS((CONSFILE *, char *, va_list));
|
||||
extern void FilePrint PARAMS((CONSFILE *, char *, ...));
|
||||
extern int FileWrite PARAMS((CONSFILE *, FLAG, char *, int));
|
||||
extern void FileVWrite PARAMS((CONSFILE *, FLAG, char *, va_list));
|
||||
extern void FilePrint PARAMS((CONSFILE *, FLAG, char *, ...));
|
||||
extern int FileStat PARAMS((CONSFILE *, struct stat *));
|
||||
extern int FileSeek PARAMS((CONSFILE *, off_t, int));
|
||||
extern int FileSend PARAMS((CONSFILE *, const void *, size_t, int));
|
||||
@ -134,6 +134,7 @@ extern int FileCanRead PARAMS((CONSFILE *, fd_set *, fd_set *));
|
||||
extern int FileCanWrite PARAMS((CONSFILE *, fd_set *, fd_set *));
|
||||
extern int FileBufEmpty PARAMS((CONSFILE *));
|
||||
extern int SetFlags PARAMS((int, int, int));
|
||||
extern char *StrDup PARAMS((char *));
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *FileGetSSL PARAMS((CONSFILE *));
|
||||
extern void FileSetSSL PARAMS((CONSFILE *, SSL *));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: version.h,v 1.47 2003-09-28 13:34:49-07 bryan Exp $
|
||||
* $Id: version.h,v 1.48 2003-10-05 17:04:09-07 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.0.1"
|
||||
#define THIS_VERSION "conserver.com version 8.0.2"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: console.c,v 5.141 2003-09-29 08:36:06-07 bryan Exp $
|
||||
* $Id: console.c,v 5.147 2003-10-03 15:21:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -586,7 +586,7 @@ ReadReply(fd)
|
||||
if (toEOF) /* if toEOF, read until EOF */
|
||||
continue;
|
||||
if ((result->used > 1) &&
|
||||
(result->string[result->used - 2] == '\n'))
|
||||
strchr(result->string, '\n') != (char *)0)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
@ -695,6 +695,7 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
fd_set rmask, rinit;
|
||||
int i;
|
||||
int justProcessedUrg = 0;
|
||||
char *r = (char *)0;
|
||||
|
||||
if (fVerbose) {
|
||||
Msg("%s to %s (on %s)", pcHow, pcMach, pcMaster);
|
||||
@ -755,7 +756,7 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
printf("o\' to open console line]\n");
|
||||
}
|
||||
} else {
|
||||
FilePrint(cfstdout, "%s: %s", pcMach, result);
|
||||
FilePrint(cfstdout, FLAGFALSE, "%s: %s", pcMach, result);
|
||||
Bye(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@ -766,13 +767,11 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
chAttn = DEFATTN;
|
||||
chEsc = DEFESC;
|
||||
} else {
|
||||
char *r;
|
||||
/* tell the conserver to change escape sequences, assume OK
|
||||
* (we'll find out soon enough)
|
||||
*/
|
||||
sprintf(acMesg, "%c%ce%c%c", DEFATTN, DEFESC, chAttn, chEsc);
|
||||
FileWrite(pcf, acMesg, 5);
|
||||
/* -bryan */
|
||||
FileWrite(pcf, FLAGFALSE, acMesg, 5);
|
||||
r = ReadReply(pcf, 0);
|
||||
if (strncmp(r, "[redef:", 7) != 0) {
|
||||
Error("protocol botch on redef of escape sequence");
|
||||
@ -785,6 +784,19 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
PutCtlc(chEsc, stdout);
|
||||
printf("?\' for help]\n");
|
||||
|
||||
/* try and display the MOTD */
|
||||
FilePrint(pcf, FLAGFALSE, "%c%cm", chAttn, chEsc);
|
||||
r = ReadReply(pcf, 0);
|
||||
if (strncmp(r, "[unknown", 8) != 0 &&
|
||||
strncmp(r, "[-- MOTD --]", 12) != 0)
|
||||
FileWrite(cfstdout, FLAGFALSE, r, -1);
|
||||
|
||||
FilePrint(pcf, FLAGFALSE, "%c%c;", chAttn, chEsc);
|
||||
r = ReadReply(pcf, 0);
|
||||
if (strncmp(r, "[unknown", 8) != 0 &&
|
||||
strncmp(r, "[connected]", 11) != 0)
|
||||
FileWrite(cfstdout, FLAGFALSE, r, -1);
|
||||
|
||||
/* if the host is not down, finish the connection, and force
|
||||
* the correct attachment for the user
|
||||
*/
|
||||
@ -795,14 +807,14 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
}
|
||||
} else if (fIn != (*pcHow == 'f' ? 'a' : *pcHow)) {
|
||||
sprintf(acMesg, "%c%c%c", chAttn, chEsc, *pcHow);
|
||||
FileWrite(pcf, acMesg, 3);
|
||||
FileWrite(pcf, FLAGFALSE, acMesg, 3);
|
||||
}
|
||||
if (fReplay) {
|
||||
sprintf(acMesg, "%c%cr", chAttn, chEsc);
|
||||
FileWrite(pcf, acMesg, 3);
|
||||
FileWrite(pcf, FLAGFALSE, acMesg, 3);
|
||||
} else if (fVerbose) {
|
||||
sprintf(acMesg, "%c%c\022", chAttn, chEsc);
|
||||
FileWrite(pcf, acMesg, 3);
|
||||
FileWrite(pcf, FLAGFALSE, acMesg, 3);
|
||||
}
|
||||
}
|
||||
fflush(stdout);
|
||||
@ -853,7 +865,7 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
for (i = 0; i < nc; ++i)
|
||||
acMesg[i] &= 127;
|
||||
}
|
||||
FileWrite(cfstdout, acMesg, nc);
|
||||
FileWrite(cfstdout, FLAGFALSE, acMesg, nc);
|
||||
}
|
||||
|
||||
/* anything from stdin? */
|
||||
@ -870,7 +882,7 @@ CallUp(pcf, pcMaster, pcMach, pcHow, result)
|
||||
for (i = 0; i < nc; ++i)
|
||||
acMesg[i] &= 127;
|
||||
}
|
||||
FileWrite(pcf, acMesg, nc);
|
||||
FileWrite(pcf, FLAGFALSE, acMesg, nc);
|
||||
}
|
||||
}
|
||||
C2Cooked();
|
||||
@ -944,11 +956,11 @@ DoCmds(master, ports, cmdi)
|
||||
t = ReadReply(pcf, 0);
|
||||
if (strcmp(t, "ok\r\n") != 0) {
|
||||
FileClose(&pcf);
|
||||
FilePrint(cfstdout, "%s: %s", server, t);
|
||||
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, t);
|
||||
continue;
|
||||
}
|
||||
#if HAVE_OPENSSL
|
||||
FileWrite(pcf, "ssl\r\n", 5);
|
||||
FileWrite(pcf, FLAGFALSE, "ssl\r\n", 5);
|
||||
t = ReadReply(pcf, 0);
|
||||
if (strcmp(t, "ok\r\n") == 0) {
|
||||
AttemptSSL(pcf);
|
||||
@ -964,7 +976,7 @@ DoCmds(master, ports, cmdi)
|
||||
BuildTmpString("login ");
|
||||
BuildTmpString(pcUser);
|
||||
t = BuildTmpString("\r\n");
|
||||
FileWrite(pcf, t, -1);
|
||||
FileWrite(pcf, FLAGFALSE, t, -1);
|
||||
|
||||
t = ReadReply(pcf, 0);
|
||||
if (strncmp(t, "passwd?", 7) == 0) {
|
||||
@ -994,10 +1006,11 @@ DoCmds(master, ports, cmdi)
|
||||
BuildString(pass, tmpString);
|
||||
BuildString("\r\n", tmpString);
|
||||
}
|
||||
FileWrite(pcf, tmpString->string, tmpString->used - 1);
|
||||
FileWrite(pcf, FLAGFALSE, tmpString->string,
|
||||
tmpString->used - 1);
|
||||
t = ReadReply(pcf, 0);
|
||||
if (strcmp(t, "ok\r\n") != 0) {
|
||||
FilePrint(cfstdout, "%s: %s", server, t);
|
||||
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, t);
|
||||
if (++count < 3) {
|
||||
BuildString((char *)0, tmpString);
|
||||
goto attemptLogin;
|
||||
@ -1015,9 +1028,9 @@ DoCmds(master, ports, cmdi)
|
||||
* have an arg (always true if it's 'call'), then send the arg
|
||||
*/
|
||||
if ((cmdi == 0 || cmds[cmdi][0] == 'c') && cmdarg != (char *)0)
|
||||
FilePrint(pcf, "%s %s\r\n", cmds[cmdi], cmdarg);
|
||||
FilePrint(pcf, FLAGFALSE, "%s %s\r\n", cmds[cmdi], cmdarg);
|
||||
else
|
||||
FilePrint(pcf, "%s\r\n", cmds[cmdi]);
|
||||
FilePrint(pcf, FLAGFALSE, "%s\r\n", cmds[cmdi]);
|
||||
|
||||
/* if we haven't gone down the stack, do "normal" stuff.
|
||||
* if we did hit the bottom, we send the exit\r\n now so
|
||||
@ -1026,7 +1039,7 @@ DoCmds(master, ports, cmdi)
|
||||
if (cmdi != 0) {
|
||||
t = ReadReply(pcf, 0);
|
||||
/* save the result */
|
||||
if ((result = strdup(t)) == (char *)0)
|
||||
if ((result = StrDup(t)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
@ -1040,7 +1053,7 @@ DoCmds(master, ports, cmdi)
|
||||
Bye(EX_SOFTWARE);
|
||||
}
|
||||
} else if (result[0] != '[') { /* did we not get a connection? */
|
||||
FilePrint(cfstdout, "%s: %s", server, result);
|
||||
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, result);
|
||||
FileClose(&pcf);
|
||||
continue;
|
||||
} else {
|
||||
@ -1054,20 +1067,20 @@ DoCmds(master, ports, cmdi)
|
||||
}
|
||||
} else if (cmds[cmdi][0] == 'q') {
|
||||
t = ReadReply(pcf, 0);
|
||||
FileWrite(cfstdout, t, -1);
|
||||
FileWrite(cfstdout, FLAGFALSE, t, -1);
|
||||
if (t[0] != 'o' || t[1] != 'k') {
|
||||
FileWrite(pcf, "exit\r\n", 6);
|
||||
FileWrite(pcf, FLAGFALSE, "exit\r\n", 6);
|
||||
t = ReadReply(pcf, 1);
|
||||
}
|
||||
} else {
|
||||
/* all done */
|
||||
FileWrite(pcf, "exit\r\n", 6);
|
||||
FileWrite(pcf, FLAGFALSE, "exit\r\n", 6);
|
||||
t = ReadReply(pcf, cmdi == 0 ? 1 : 0);
|
||||
|
||||
if (cmdi == 0) {
|
||||
int len;
|
||||
/* if we hit bottom, this is where we get our results */
|
||||
if ((result = strdup(t)) == (char *)0)
|
||||
if ((result = StrDup(t)) == (char *)0)
|
||||
OutOfMem();
|
||||
len = strlen(result);
|
||||
if (len > 8 &&
|
||||
@ -1081,9 +1094,9 @@ DoCmds(master, ports, cmdi)
|
||||
*/
|
||||
if (cmds[0][0] == 'd') {
|
||||
if (result[0] != 'o' || result[1] != 'k') {
|
||||
FileWrite(cfstdout, server, -1);
|
||||
FileWrite(cfstdout, ": ", 2);
|
||||
FileWrite(cfstdout, result, len);
|
||||
FileWrite(cfstdout, FLAGTRUE, server, -1);
|
||||
FileWrite(cfstdout, FLAGTRUE, ": ", 2);
|
||||
FileWrite(cfstdout, FLAGFALSE, result, len);
|
||||
} else {
|
||||
disconnectCount += atoi(result + 19);
|
||||
}
|
||||
@ -1091,10 +1104,10 @@ DoCmds(master, ports, cmdi)
|
||||
(result[0] != 'o' || result[1] != 'k')) {
|
||||
/* did a 'master' before this or doing a 'disconnect' */
|
||||
if (cmds[1][0] == 'm' || cmds[0][0] == 'd') {
|
||||
FileWrite(cfstdout, server, -1);
|
||||
FileWrite(cfstdout, ": ", 2);
|
||||
FileWrite(cfstdout, FLAGTRUE, server, -1);
|
||||
FileWrite(cfstdout, FLAGTRUE, ": ", 2);
|
||||
}
|
||||
FileWrite(cfstdout, result, len);
|
||||
FileWrite(cfstdout, FLAGFALSE, result, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1413,7 +1426,8 @@ main(argc, argv)
|
||||
retval = DoCmds(pcInMaster, acPorts->string, cmdi);
|
||||
|
||||
if (*pcCmd == 'd')
|
||||
FilePrint(cfstdout, "Disconnected %d users\n", disconnectCount);
|
||||
FilePrint(cfstdout, FLAGFALSE, "Disconnected %d users\n",
|
||||
disconnectCount);
|
||||
|
||||
Bye(retval);
|
||||
return 0; /* noop - Bye() terminates us */
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $Id: console.man,v 1.36 2003-09-28 15:30:52-07 bryan Exp $
|
||||
.TH CONSOLE 1 "2003-09-28" "conserver-8.0.1" "conserver"
|
||||
.\" $Id: console.man,v 1.37 2003-10-02 19:00:45-07 bryan Exp $
|
||||
.TH CONSOLE 1 "2003-10-02" "conserver-8.0.2" "conserver"
|
||||
.SH NAME
|
||||
console \- console server client program
|
||||
.SH SYNOPSIS
|
||||
@ -414,6 +414,9 @@ send the break sequence associated with this console
|
||||
.B l1-9
|
||||
send the specific break sequence
|
||||
.TP
|
||||
.B m
|
||||
display the "message of the day"
|
||||
.TP
|
||||
.B o
|
||||
close (if open) and reopen the line (to clear errors (silo overflows))
|
||||
and the log file
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
%define pkg conserver
|
||||
%define ver conserver-8.0.1
|
||||
%define ver conserver-8.0.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
|
||||
|
@ -1,7 +1,7 @@
|
||||
PKG="conserver"
|
||||
NAME="Console server and client"
|
||||
CATEGORY="system"
|
||||
VERSION="conserver-8.0.1"
|
||||
VERSION="conserver-8.0.2"
|
||||
DESC="Console server and client"
|
||||
CLASSES=none
|
||||
ARCH=sparc
|
||||
|
@ -6,11 +6,12 @@
|
||||
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 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
|
||||
<cr> ignore/abort command ? print this message
|
||||
^R replay the last line \ooo send character by octal code
|
||||
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 <cr> ignore/abort command
|
||||
? print this message ^R replay the last line
|
||||
\ooo send character by octal code
|
||||
[disconnect]
|
||||
|
@ -6,11 +6,12 @@
|
||||
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 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
|
||||
<cr> ignore/abort command ? print this message
|
||||
^R replay the last line \ooo send character by octal code
|
||||
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 <cr> ignore/abort command
|
||||
? print this message ^R replay the last line
|
||||
\ooo send character by octal code
|
||||
[disconnect]
|
||||
|
Loading…
x
Reference in New Issue
Block a user