mirror of
https://github.com/bstansell/conserver.git
synced 2025-06-24 17:55:08 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
92cf41a9f2 | |||
1c188a41d6 | |||
aeb8ac0057 | |||
66e0902358 |
48
CHANGES
48
CHANGES
@ -1,6 +1,52 @@
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
version 8.0.5 (Oct 31,2003):
|
||||
- added 'loghostnames' config option (default is on) to log
|
||||
client hostnames instead of ip addresses (like pre-8.0.0) -
|
||||
suggested by Han Pilmeyer <han@zk3.dec.com>
|
||||
- fixed bug where 'daemonmode' config file option wasn't being
|
||||
used
|
||||
- fixed potential logfile (-L) opening problem processing SIGHUP
|
||||
- fixed various potential conserver.cf issues with 'config'
|
||||
block values processing SIGHUP
|
||||
- added 'setproctitle' config option (default is off) to enable
|
||||
changing the process title to contain runtime information -
|
||||
patch by Dmitry Morozovsky <marck@rinet.ru>
|
||||
|
||||
version 8.0.4 (Oct 10, 2003):
|
||||
- fixed client rejection bug that can nearly never happen -
|
||||
reported by Han Pilmeyer <han@zk3.dec.com>
|
||||
- fixed bug where client is reconnected to the previous console
|
||||
when non-exact console names are used - reported by Rolf
|
||||
Petter Halle <rph@online.no>
|
||||
- fixed bug where exact matchs on a remote console name never
|
||||
happened - reported by Toby Gerhart <toby.gerhart@eds.com>
|
||||
- fixed bug where SIGHUP fails to update console aliases -
|
||||
reported by Han Pilmeyer <han@zk3.dec.com>
|
||||
|
||||
version 8.0.3 (Oct 6, 2003):
|
||||
- the SIGHUP process fails to pick up changes to certain fields
|
||||
because of a horribly broken SwapStr() function [broken in
|
||||
all previous 8.0.x versions] - reported by Toby Gerhart
|
||||
<toby.gerhart@eds.com>
|
||||
|
||||
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 +586,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.120 2003-10-31 10:04:12-08 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 $
|
||||
#
|
||||
|
5
TODO
5
TODO
@ -80,6 +80,9 @@ Bryan Stansell
|
||||
- show attach/detach events to/of spy console clients : Greg A. Woods
|
||||
<woods@planix.com>
|
||||
|
||||
- redefine client escape sequence in conserver.cf : Toby Gerhart
|
||||
<toby.gerhart@eds.com>
|
||||
|
||||
#
|
||||
# $Id: TODO,v 1.37 2003-09-28 12:23:23-07 bryan Exp $
|
||||
# $Id: TODO,v 1.38 2003-10-31 09:53:46-08 bryan Exp $
|
||||
#
|
||||
|
@ -144,6 +144,9 @@
|
||||
/* Define to 1 if you have the `setpgrp' function. */
|
||||
#undef HAVE_SETPGRP
|
||||
|
||||
/* Define to 1 if you have the `setproctitle' function. */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define to 1 if you have the `setsid' function. */
|
||||
#undef HAVE_SETSID
|
||||
|
||||
|
3
configure
vendored
3
configure
vendored
@ -6155,7 +6155,8 @@ done
|
||||
|
||||
|
||||
|
||||
for ac_func in getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton
|
||||
|
||||
for ac_func in getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
|
@ -498,7 +498,7 @@ AC_CHECK_HEADERS(pty.h libutil.h util.h)
|
||||
AC_CHECK_LIB(util, openpty)
|
||||
AC_CHECK_FUNCS(openpty)
|
||||
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton)
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle)
|
||||
AC_FUNC_SETPGRP
|
||||
AC_CHECK_FUNC(strcasecmp,
|
||||
[AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])],
|
||||
|
@ -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.44 2003-10-31 09:54:19-08 bryan Exp $
|
||||
.TH CONSERVER.CF 5 "2003-10-31" "conserver-8.0.5" "conserver"
|
||||
.SH NAME
|
||||
conserver.cf \- console configuration file for
|
||||
.BR conserver (8)
|
||||
@ -316,6 +316,16 @@ Set the base port number used by child processes (see the
|
||||
.B \-b
|
||||
command-line flag).
|
||||
.TP
|
||||
.B setproctitle
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not the process title shows master/group functionality
|
||||
as well as the port number the process is listening on and how many
|
||||
consoles it is managing.
|
||||
The operating system must support the
|
||||
.BR setproctitle ()
|
||||
call.
|
||||
.TP
|
||||
.B sslcredentials
|
||||
.I filename
|
||||
.br
|
||||
@ -456,6 +466,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.5" "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 31,2003, is <A
|
||||
href="8.0.5.tar.gz">8.0.5.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.5.tar.gz">FTP</A>
|
||||
or <A href="8.0.5.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.68 2003-10-19 22:52:21-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -151,8 +151,15 @@ AccType(addr, peername)
|
||||
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
|
||||
pACtmp->ctrust));
|
||||
if (pACtmp->isCIDR != 0) {
|
||||
if (AddrCmp(addr, pACtmp->pcwho) == 0)
|
||||
if (AddrCmp(addr, pACtmp->pcwho) == 0) {
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
}
|
||||
return pACtmp->ctrust;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -178,8 +185,15 @@ AccType(addr, peername)
|
||||
#else
|
||||
bcmp(&(addr->s_addr), he->h_addr_list[a], he->h_length)
|
||||
#endif
|
||||
== 0)
|
||||
== 0) {
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
}
|
||||
return pACtmp->ctrust;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,6 +235,12 @@ AccType(addr, peername)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
}
|
||||
return config->defaultaccess;
|
||||
}
|
||||
|
||||
@ -241,7 +261,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 +278,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: client.h,v 5.32 2003-09-28 08:41:20-07 bryan Exp $
|
||||
* $Id: client.h,v 5.33 2003-10-10 03:28:49-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -63,7 +63,6 @@ typedef struct client { /* Connection Information: */
|
||||
time_t typetym; /* time of last keystroke */
|
||||
char actym[32]; /* pre-formatted time */
|
||||
struct consent
|
||||
*pCEwant, /* what machine we would like to be on */
|
||||
*pCEto; /* host a client gets output from */
|
||||
struct client
|
||||
**ppCLbscan, /* back link for scan ptr */
|
||||
|
@ -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.5" "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
131
conserver/main.c
131
conserver/main.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.c,v 5.160 2003-09-29 07:01:35-07 bryan Exp $
|
||||
* $Id: main.c,v 5.163 2003-10-31 09:55:04-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -49,11 +49,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fDaemon = 0, fReopen =
|
||||
int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fReopen =
|
||||
0, fNoautoreup = 0, fSyntaxOnly = 0;
|
||||
|
||||
char chDefAcc = 'r';
|
||||
|
||||
char *pcConfig = CONFIGFILE;
|
||||
int isMaster = 1;
|
||||
int cMaxMemb = MAXMEMB;
|
||||
@ -64,6 +62,17 @@ static STRING *startedMsg = (STRING *)0;
|
||||
CONFIG *optConf = (CONFIG *)0;
|
||||
CONFIG *config = (CONFIG *)0;
|
||||
char *interface = (char *)0;
|
||||
CONFIG defConfig =
|
||||
{ (STRING *)0, 'r', FLAGFALSE, LOGFILEPATH, PASSWDFILE, DEFPORT,
|
||||
FLAGTRUE,
|
||||
FLAGTRUE, 0, DEFBASEPORT
|
||||
#if HAVE_SETPROCTITLE
|
||||
, FLAGFALSE
|
||||
#endif
|
||||
#if HAVE_OPENSSL
|
||||
, (char *)0, FLAGTRUE
|
||||
#endif
|
||||
};
|
||||
|
||||
struct sockaddr_in in_port;
|
||||
|
||||
@ -383,10 +392,23 @@ ReopenLogfile()
|
||||
* after that, all bets are off...probably not see the errors (well,
|
||||
* aside from the tail of the old logfile, if it was rolled).
|
||||
*/
|
||||
if (!fDaemon || config->logfile == (char *)0)
|
||||
if (config->daemonmode != FLAGTRUE)
|
||||
return;
|
||||
|
||||
close(1);
|
||||
|
||||
/* so, if we aren't in daemon mode, we just return before closing
|
||||
* anything. if we are, there are two possibilities. first, if
|
||||
* logfile is set, we close fd 1, open a file, etc. all should be
|
||||
* well. if logfile isn't set, we end up closing fd 1 and 2 and
|
||||
* returning (in case the logfile was set and then unset [config
|
||||
* file change]).
|
||||
*/
|
||||
if (config->logfile == (char *)0) {
|
||||
close(2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (1 != open(config->logfile, O_WRONLY | O_CREAT | O_APPEND, 0644)) {
|
||||
tag = 0;
|
||||
Error("ReopenLogfile(): open(%s): %s", config->logfile,
|
||||
@ -555,17 +577,18 @@ Version()
|
||||
isMultiProc = 0;
|
||||
|
||||
Msg("%s", THIS_VERSION);
|
||||
Msg("default access type `%c'", chDefAcc);
|
||||
Msg("default access type `%c'", defConfig.defaultaccess);
|
||||
Msg("default escape sequence `%s%s'", FmtCtl(DEFATTN, acA1),
|
||||
FmtCtl(DEFESC, acA2));
|
||||
Msg("default configuration in `%s'", CONFIGFILE);
|
||||
Msg("default password in `%s'", PASSWDFILE);
|
||||
Msg("default logfile is `%s'", LOGFILEPATH);
|
||||
Msg("default password in `%s'", defConfig.passwdfile);
|
||||
Msg("default logfile is `%s'", defConfig.logfile);
|
||||
Msg("default pidfile is `%s'", PIDFILE);
|
||||
Msg("default limit is %d member%s per group", MAXMEMB,
|
||||
MAXMEMB == 1 ? "" : "s");
|
||||
Msg("default primary port referenced as `%s'", DEFPORT);
|
||||
Msg("default secondary base port referenced as `%s'", DEFBASEPORT);
|
||||
Msg("default primary port referenced as `%s'", defConfig.primaryport);
|
||||
Msg("default secondary base port referenced as `%s'",
|
||||
defConfig.secondaryport);
|
||||
|
||||
BuildString((char *)0, acA1);
|
||||
if (optionlist[0] == (char *)0)
|
||||
@ -1126,9 +1149,9 @@ main(argc, argv)
|
||||
|
||||
thepid = getpid();
|
||||
if ((char *)0 == (progname = strrchr(argv[0], '/'))) {
|
||||
progname = argv[0];
|
||||
progname = StrDup(argv[0]);
|
||||
} else {
|
||||
++progname;
|
||||
progname = StrDup(++progname);
|
||||
}
|
||||
|
||||
setpwent();
|
||||
@ -1179,21 +1202,21 @@ 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;
|
||||
case 'C':
|
||||
pcConfig = optarg;
|
||||
pcConfig = StrDup(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
fDaemon = 1;
|
||||
optConf->daemonmode = FLAGTRUE;
|
||||
break;
|
||||
case 'D':
|
||||
fDebug++;
|
||||
@ -1213,7 +1236,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':
|
||||
@ -1225,7 +1248,7 @@ main(argc, argv)
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
interface = optarg;
|
||||
interface = StrDup(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
/* noop now */
|
||||
@ -1239,11 +1262,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 +1379,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(defConfig.primaryport);
|
||||
if (config->primaryport == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -1387,11 +1410,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(defConfig.secondaryport);
|
||||
if (config->secondaryport == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -1417,20 +1440,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(defConfig.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(defConfig.logfile);
|
||||
if (config->logfile == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -1439,21 +1462,35 @@ main(argc, argv)
|
||||
else if (pConfig->reinitcheck != 0)
|
||||
config->reinitcheck = pConfig->reinitcheck;
|
||||
else
|
||||
config->reinitcheck = 0;
|
||||
config->reinitcheck = defConfig.reinitcheck;
|
||||
|
||||
if (optConf->defaultaccess != '\000')
|
||||
config->defaultaccess = optConf->defaultaccess;
|
||||
else if (pConfig->defaultaccess != '\000')
|
||||
config->defaultaccess = pConfig->defaultaccess;
|
||||
else
|
||||
config->defaultaccess = chDefAcc;
|
||||
config->defaultaccess = defConfig.defaultaccess;
|
||||
|
||||
if (optConf->daemonmode != FLAGUNKNOWN)
|
||||
config->daemonmode = optConf->daemonmode;
|
||||
else if (pConfig->daemonmode != FLAGUNKNOWN)
|
||||
config->daemonmode = pConfig->daemonmode;
|
||||
else
|
||||
config->daemonmode = defConfig.daemonmode;
|
||||
|
||||
if (optConf->redirect != FLAGUNKNOWN)
|
||||
config->redirect = optConf->redirect;
|
||||
else if (pConfig->redirect != FLAGUNKNOWN)
|
||||
config->redirect = pConfig->redirect;
|
||||
else
|
||||
config->redirect = FLAGTRUE;
|
||||
config->redirect = defConfig.redirect;
|
||||
|
||||
if (optConf->loghostnames != FLAGUNKNOWN)
|
||||
config->loghostnames = optConf->loghostnames;
|
||||
else if (pConfig->loghostnames != FLAGUNKNOWN)
|
||||
config->loghostnames = pConfig->loghostnames;
|
||||
else
|
||||
config->loghostnames = defConfig.loghostnames;
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
if (optConf->sslrequired != FLAGUNKNOWN)
|
||||
@ -1461,14 +1498,14 @@ main(argc, argv)
|
||||
else if (pConfig->sslrequired != FLAGUNKNOWN)
|
||||
config->sslrequired = pConfig->sslrequired;
|
||||
else
|
||||
config->sslrequired = FLAGTRUE;
|
||||
config->sslrequired = defConfig.sslrequired;
|
||||
|
||||
if (optConf->sslcredentials != (char *)0)
|
||||
config->sslcredentials = optConf->sslcredentials;
|
||||
config->sslcredentials = StrDup(optConf->sslcredentials);
|
||||
else if (pConfig->sslcredentials != (char *)0)
|
||||
config->sslcredentials = pConfig->sslcredentials;
|
||||
config->sslcredentials = StrDup(pConfig->sslcredentials);
|
||||
else
|
||||
config->sslcredentials = (char *)0;
|
||||
config->sslcredentials = StrDup(defConfig.sslcredentials);
|
||||
#endif
|
||||
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
|
||||
@ -1483,7 +1520,7 @@ main(argc, argv)
|
||||
SetupSSL();
|
||||
#endif
|
||||
|
||||
if (fDaemon)
|
||||
if (config->daemonmode == FLAGTRUE)
|
||||
Daemonize();
|
||||
|
||||
/* if no one can use us we need to come up with a default
|
||||
@ -1503,6 +1540,20 @@ main(argc, argv)
|
||||
(unsigned long)pGE->pid, pGE->port);
|
||||
}
|
||||
|
||||
#if HAVE_SETPROCTITLE
|
||||
if (config->setproctitle == FLAGTRUE) {
|
||||
REMOTE *pRC;
|
||||
GRPENT *pGE;
|
||||
int local = 0, remote = 0;
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext)
|
||||
local += pGE->imembers;
|
||||
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext)
|
||||
remote++;
|
||||
setproctitle("master: port %hu, %d local, %d remote", bindPort,
|
||||
local, remote);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fVerbose) {
|
||||
ACCESS *pACtmp;
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *)0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.h,v 5.49 2003-06-15 19:50:28-07 bryan Exp $
|
||||
* $Id: main.h,v 5.50 2003-10-19 22:52:37-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -47,6 +47,7 @@ extern struct sockaddr_in in_port;
|
||||
extern int isMaster;
|
||||
extern CONFIG *optConf;
|
||||
extern CONFIG *config;
|
||||
extern CONFIG defConfig;
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL_CTX *ctx;
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.c,v 5.115 2003-09-29 08:39:13-07 bryan Exp $
|
||||
* $Id: master.c,v 5.118 2003-10-10 03:29:21-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
|
||||
@ -230,6 +231,28 @@ SignalKids(arg)
|
||||
}
|
||||
}
|
||||
|
||||
REMOTE *
|
||||
#if PROTOTYPES
|
||||
FindRemoteConsole(char *args)
|
||||
#else
|
||||
FindRemoteConsole(args)
|
||||
char *args;
|
||||
#endif
|
||||
{
|
||||
REMOTE *pRC;
|
||||
NAMES *name;
|
||||
|
||||
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) {
|
||||
if (strcasecmp(args, pRC->rserver) == 0)
|
||||
return pRC;
|
||||
for (name = pRC->aliases; name != (NAMES *)0; name = name->next) {
|
||||
if (strcasecmp(args, name->name) == 0)
|
||||
return pRC;
|
||||
}
|
||||
}
|
||||
return pRC;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
CommandCall(CONSCLIENT *pCL, char *args)
|
||||
@ -262,9 +285,7 @@ CommandCall(pCL, args)
|
||||
}
|
||||
if (config->redirect == FLAGTRUE ||
|
||||
(config->redirect != FLAGTRUE && found == 0)) {
|
||||
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) {
|
||||
if (strcasecmp(args, pRC->rserver) != 0)
|
||||
continue;
|
||||
if ((pRC = FindRemoteConsole(args)) != (REMOTE *)0) {
|
||||
ambiguous = BuildTmpString(pRC->rserver);
|
||||
ambiguous = BuildTmpString(", ");
|
||||
++found;
|
||||
@ -331,25 +352,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 +413,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 +459,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 +508,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 +529,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 +549,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 +569,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 +631,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 +669,6 @@ Master()
|
||||
FILE *fp;
|
||||
CONSCLIENT *pCLServing = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCL = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCLall = (CONSCLIENT *)0;
|
||||
|
||||
|
||||
/* set up signal handler */
|
||||
@ -656,13 +691,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 +766,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 +803,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 +826,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 +860,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 +875,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 +889,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 +925,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.148 2003-10-31 09:55:55-08 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,8 +625,18 @@ 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);
|
||||
while (c->aliases != (NAMES *)0) {
|
||||
NAMES *name;
|
||||
name = c->aliases->next;
|
||||
if (c->aliases->name != (char *)0)
|
||||
free(c->aliases->name);
|
||||
free(c->aliases);
|
||||
c->aliases = name;
|
||||
}
|
||||
if (c->wbuf != (STRING *)0)
|
||||
DestroyString(c->wbuf);
|
||||
free(c);
|
||||
@ -702,37 +712,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 +786,7 @@ DefaultBegin(id)
|
||||
== (CONSENT *)0)
|
||||
OutOfMem();
|
||||
|
||||
if ((parserDefaultTemp->server = strdup(id))
|
||||
if ((parserDefaultTemp->server = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -918,7 +934,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 +967,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 +1024,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 +1090,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 +1111,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 +1151,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 +1188,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 +1632,7 @@ ConsoleBegin(id)
|
||||
"*")) != (CONSENT *)0) {
|
||||
ApplyDefault(c, parserConsoleTemp);
|
||||
}
|
||||
if ((parserConsoleTemp->server = strdup(id))
|
||||
if ((parserConsoleTemp->server = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1695,17 +1744,17 @@ ConsoleAbort()
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
SwapStr(char *s1, char *s2)
|
||||
SwapStr(char **s1, char **s2)
|
||||
#else
|
||||
SwapStr(s1, s2)
|
||||
char *s1;
|
||||
char *s2;
|
||||
char **s1;
|
||||
char **s2;
|
||||
#endif
|
||||
{
|
||||
char *s;
|
||||
s = s1;
|
||||
s1 = s2;
|
||||
s2 = s;
|
||||
s = *s1;
|
||||
*s1 = *s2;
|
||||
*s2 = s;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1738,7 +1787,7 @@ ExpandLogfile(c, id)
|
||||
*amp = '&';
|
||||
}
|
||||
tmp = BuildTmpString(p);
|
||||
if ((c->logfile = strdup(tmp))
|
||||
if ((c->logfile = StrDup(tmp))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -1766,10 +1815,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;
|
||||
@ -2005,24 +2054,24 @@ ConsoleAdd(c)
|
||||
}
|
||||
if (pCEmatch->logfile != (char *)0 && c->logfile != (char *)0) {
|
||||
if (strcmp(pCEmatch->logfile, c->logfile) != 0) {
|
||||
SwapStr(pCEmatch->logfile, c->logfile);
|
||||
SwapStr(&pCEmatch->logfile, &c->logfile);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->logfile != (char *)0 ||
|
||||
c->logfile != (char *)0) {
|
||||
SwapStr(pCEmatch->logfile, c->logfile);
|
||||
SwapStr(&pCEmatch->logfile, &c->logfile);
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->initcmd != (char *)0 && c->initcmd != (char *)0) {
|
||||
if (strcmp(pCEmatch->initcmd, c->initcmd) != 0) {
|
||||
SwapStr(pCEmatch->initcmd, c->initcmd);
|
||||
SwapStr(&pCEmatch->initcmd, &c->initcmd);
|
||||
/* only trigger reinit if we're running the old command */
|
||||
if (pCEmatch->initpid != 0)
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->initcmd != (char *)0 ||
|
||||
c->initcmd != (char *)0) {
|
||||
SwapStr(pCEmatch->initcmd, c->initcmd);
|
||||
SwapStr(&pCEmatch->initcmd, &c->initcmd);
|
||||
/* only trigger reinit if we're running the old command */
|
||||
if (pCEmatch->initpid != 0)
|
||||
closeMatch = 0;
|
||||
@ -2032,12 +2081,12 @@ ConsoleAdd(c)
|
||||
case EXEC:
|
||||
if (pCEmatch->exec != (char *)0 && c->exec != (char *)0) {
|
||||
if (strcmp(pCEmatch->exec, c->exec) != 0) {
|
||||
SwapStr(pCEmatch->exec, c->exec);
|
||||
SwapStr(&pCEmatch->exec, &c->exec);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->exec != (char *)0 ||
|
||||
c->exec != (char *)0) {
|
||||
SwapStr(pCEmatch->exec, c->exec);
|
||||
SwapStr(&pCEmatch->exec, &c->exec);
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->ixany != c->ixany) {
|
||||
@ -2063,12 +2112,12 @@ ConsoleAdd(c)
|
||||
if (pCEmatch->device != (char *)0 &&
|
||||
c->device != (char *)0) {
|
||||
if (strcmp(pCEmatch->device, c->device) != 0) {
|
||||
SwapStr(pCEmatch->device, c->device);
|
||||
SwapStr(&pCEmatch->device, &c->device);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->device != (char *)0 ||
|
||||
c->device != (char *)0) {
|
||||
SwapStr(pCEmatch->device, c->device);
|
||||
SwapStr(&pCEmatch->device, &c->device);
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->baud != c->baud) {
|
||||
@ -2109,12 +2158,12 @@ ConsoleAdd(c)
|
||||
case HOST:
|
||||
if (pCEmatch->host != (char *)0 && c->host != (char *)0) {
|
||||
if (strcasecmp(pCEmatch->host, c->host) != 0) {
|
||||
SwapStr(pCEmatch->host, c->host);
|
||||
SwapStr(&pCEmatch->host, &c->host);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->host != (char *)0 ||
|
||||
c->host != (char *)0) {
|
||||
SwapStr(pCEmatch->host, c->host);
|
||||
SwapStr(&pCEmatch->host, &c->host);
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->port != c->port) {
|
||||
@ -2127,6 +2176,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;
|
||||
@ -2137,6 +2187,16 @@ ConsoleAdd(c)
|
||||
pCEmatch->reinitoncc = c->reinitoncc;
|
||||
pCEmatch->autoreinit = c->autoreinit;
|
||||
pCEmatch->unloved = c->unloved;
|
||||
while (pCEmatch->aliases != (NAMES *)0) {
|
||||
NAMES *name;
|
||||
name = pCEmatch->aliases->next;
|
||||
if (pCEmatch->aliases->name != (char *)0)
|
||||
free(pCEmatch->aliases->name);
|
||||
free(pCEmatch->aliases);
|
||||
pCEmatch->aliases = name;
|
||||
}
|
||||
pCEmatch->aliases = c->aliases;
|
||||
c->aliases = (NAMES *)0;
|
||||
|
||||
/* we have to override the ro/rw lists... */
|
||||
/* so first destroy the existing (which point to freed space anyway) */
|
||||
@ -2316,7 +2376,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 +2393,7 @@ ConsoleDestroy()
|
||||
FindWrite(pCE);
|
||||
}
|
||||
} else {
|
||||
FileWrite(pCL->fd,
|
||||
FileWrite(pCL->fd, FLAGFALSE,
|
||||
"[Conserver reconfigured - r/w access granted]\r\n",
|
||||
-1);
|
||||
}
|
||||
@ -2403,7 +2463,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 +2568,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 +2785,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 +3079,7 @@ AccessProcessACL(trust, acl)
|
||||
OutOfMem();
|
||||
pa->ctrust = trust;
|
||||
pa->isCIDR = isCIDR;
|
||||
if ((pa->pcwho = strdup(token))
|
||||
if ((pa->pcwho = StrDup(token))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
@ -3076,8 +3148,6 @@ DestroyConfig(c)
|
||||
return;
|
||||
if (c->logfile != (char *)0)
|
||||
free(c->logfile);
|
||||
if (c->initcmd != (char *)0)
|
||||
free(c->initcmd);
|
||||
if (c->passwdfile != (char *)0)
|
||||
free(c->passwdfile);
|
||||
if (c->primaryport != (char *)0)
|
||||
@ -3137,12 +3207,6 @@ ConfigEnd()
|
||||
pConfig->logfile = parserConfigTemp->logfile;
|
||||
parserConfigTemp->logfile = (char *)0;
|
||||
}
|
||||
if (parserConfigTemp->initcmd != (char *)0) {
|
||||
if (pConfig->initcmd != (char *)0)
|
||||
free(pConfig->initcmd);
|
||||
pConfig->initcmd = parserConfigTemp->initcmd;
|
||||
parserConfigTemp->initcmd = (char *)0;
|
||||
}
|
||||
if (parserConfigTemp->passwdfile != (char *)0) {
|
||||
if (pConfig->passwdfile != (char *)0)
|
||||
free(pConfig->passwdfile);
|
||||
@ -3161,6 +3225,8 @@ ConfigEnd()
|
||||
pConfig->daemonmode = parserConfigTemp->daemonmode;
|
||||
if (parserConfigTemp->redirect != FLAGUNKNOWN)
|
||||
pConfig->redirect = parserConfigTemp->redirect;
|
||||
if (parserConfigTemp->loghostnames != FLAGUNKNOWN)
|
||||
pConfig->loghostnames = parserConfigTemp->loghostnames;
|
||||
if (parserConfigTemp->reinitcheck != 0)
|
||||
pConfig->reinitcheck = parserConfigTemp->reinitcheck;
|
||||
if (parserConfigTemp->secondaryport != (char *)0) {
|
||||
@ -3289,7 +3355,7 @@ ConfigItemLogfile(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->logfile = strdup(id))
|
||||
if ((parserConfigTemp->logfile = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3310,7 +3376,7 @@ ConfigItemPasswordfile(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->passwdfile = strdup(id))
|
||||
if ((parserConfigTemp->passwdfile = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3331,7 +3397,7 @@ ConfigItemPrimaryport(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->primaryport = strdup(id))
|
||||
if ((parserConfigTemp->primaryport = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
@ -3348,6 +3414,18 @@ ConfigItemRedirect(id)
|
||||
ProcessYesNo(id, &(parserConfigTemp->redirect));
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemLoghostnames(char *id)
|
||||
#else
|
||||
ConfigItemLoghostnames(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemLoghostnames(%s) [%s:%d]", id, file, line));
|
||||
ProcessYesNo(id, &(parserConfigTemp->loghostnames));
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemReinitcheck(char *id)
|
||||
@ -3395,12 +3473,11 @@ ConfigItemSecondaryport(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->secondaryport = strdup(id))
|
||||
if ((parserConfigTemp->secondaryport = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemSslcredentials(char *id)
|
||||
@ -3410,6 +3487,7 @@ ConfigItemSslcredentials(id)
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslcredentials(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_OPENSSL
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
if (parserConfigTemp->sslcredentials != (char *)0) {
|
||||
free(parserConfigTemp->sslcredentials);
|
||||
@ -3417,9 +3495,14 @@ ConfigItemSslcredentials(id)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->sslcredentials = strdup(id))
|
||||
if ((parserConfigTemp->sslcredentials = StrDup(id))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
#else
|
||||
Error
|
||||
("sslcredentials ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -3431,9 +3514,32 @@ ConfigItemSslrequired(id)
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslrequired(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_OPENSSL
|
||||
ProcessYesNo(id, &(parserConfigTemp->sslrequired));
|
||||
}
|
||||
#else
|
||||
Error
|
||||
("sslrequired ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemSetproctitle(char *id)
|
||||
#else
|
||||
ConfigItemSetproctitle(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSetproctitle(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_SETPROCTITLE
|
||||
ProcessYesNo(id, &(parserConfigTemp->setproctitle));
|
||||
#else
|
||||
Error
|
||||
("setproctitle ignored - operating system support does not exist [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* now all the real nitty-gritty bits for making things work */
|
||||
ITEM keyBreak[] = {
|
||||
@ -3455,13 +3561,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 +3584,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},
|
||||
@ -3503,15 +3611,15 @@ ITEM keyConfig[] = {
|
||||
{"defaultaccess", ConfigItemDefaultaccess},
|
||||
{"daemonmode", ConfigItemDaemonmode},
|
||||
{"logfile", ConfigItemLogfile},
|
||||
{"loghostnames", ConfigItemLoghostnames},
|
||||
{"passwdfile", ConfigItemPasswordfile},
|
||||
{"primaryport", ConfigItemPrimaryport},
|
||||
{"redirect", ConfigItemRedirect},
|
||||
{"reinitcheck", ConfigItemReinitcheck},
|
||||
{"secondaryport", ConfigItemSecondaryport},
|
||||
#if HAVE_OPENSSL
|
||||
{"setproctitle", ConfigItemSetproctitle},
|
||||
{"sslcredentials", ConfigItemSslcredentials},
|
||||
{"sslrequired", ConfigItemSslrequired},
|
||||
#endif
|
||||
{(char *)0, (void *)0}
|
||||
};
|
||||
|
||||
@ -4000,49 +4108,77 @@ ReReadCfg(fd)
|
||||
}
|
||||
|
||||
/* check for changes to master & child values */
|
||||
if (optConf->logfile == (char *)0 && pConfig->logfile != (char *)0 &&
|
||||
(config->logfile == (char *)0 ||
|
||||
strcmp(pConfig->logfile, config->logfile) != 0)) {
|
||||
if (config->logfile != (char *)0)
|
||||
free(config->logfile);
|
||||
if ((config->logfile = strdup(pConfig->logfile))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
ReopenLogfile();
|
||||
if (optConf->logfile == (char *)0) {
|
||||
char *p;
|
||||
if (pConfig->logfile == (char *)0)
|
||||
p = defConfig.logfile;
|
||||
else
|
||||
p = pConfig->logfile;
|
||||
if (config->logfile == (char *)0 ||
|
||||
strcmp(p, config->logfile) != 0) {
|
||||
if (config->logfile != (char *)0)
|
||||
free(config->logfile);
|
||||
if ((config->logfile = StrDup(p))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
ReopenLogfile();
|
||||
}
|
||||
}
|
||||
if (optConf->defaultaccess == '\000' &&
|
||||
pConfig->defaultaccess != '\000' &&
|
||||
pConfig->defaultaccess != config->defaultaccess) {
|
||||
config->defaultaccess = pConfig->defaultaccess;
|
||||
|
||||
if (optConf->defaultaccess == '\000') {
|
||||
if (pConfig->defaultaccess == '\000')
|
||||
config->defaultaccess = defConfig.defaultaccess;
|
||||
else if (pConfig->defaultaccess != config->defaultaccess)
|
||||
config->defaultaccess = pConfig->defaultaccess;
|
||||
/* gets used below by SetDefAccess() */
|
||||
}
|
||||
if (optConf->passwdfile == (char *)0 &&
|
||||
pConfig->passwdfile != (char *)0 &&
|
||||
(config->passwdfile == (char *)0 ||
|
||||
strcmp(pConfig->passwdfile, config->passwdfile) != 0)) {
|
||||
if (config->passwdfile != (char *)0)
|
||||
free(config->passwdfile);
|
||||
if ((config->passwdfile = strdup(pConfig->passwdfile))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
if (optConf->passwdfile == (char *)0) {
|
||||
char *p;
|
||||
if (pConfig->passwdfile == (char *)0)
|
||||
p = defConfig.passwdfile;
|
||||
else
|
||||
p = pConfig->passwdfile;
|
||||
if (config->passwdfile == (char *)0 ||
|
||||
strcmp(p, config->passwdfile) != 0) {
|
||||
if (config->passwdfile != (char *)0)
|
||||
free(config->passwdfile);
|
||||
if ((config->passwdfile = StrDup(p))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
/* gets used on-the-fly */
|
||||
}
|
||||
}
|
||||
|
||||
if (optConf->redirect == FLAGUNKNOWN) {
|
||||
if (pConfig->redirect == FLAGUNKNOWN)
|
||||
config->redirect = defConfig.redirect;
|
||||
else if (pConfig->redirect != config->redirect)
|
||||
config->redirect = pConfig->redirect;
|
||||
/* gets used on-the-fly */
|
||||
}
|
||||
if (optConf->redirect == FLAGUNKNOWN &&
|
||||
pConfig->redirect != FLAGUNKNOWN &&
|
||||
pConfig->redirect != config->redirect) {
|
||||
config->redirect = pConfig->redirect;
|
||||
|
||||
if (optConf->loghostnames == FLAGUNKNOWN) {
|
||||
if (pConfig->loghostnames == FLAGUNKNOWN)
|
||||
config->loghostnames = defConfig.loghostnames;
|
||||
else if (pConfig->loghostnames != config->loghostnames)
|
||||
config->loghostnames = pConfig->loghostnames;
|
||||
/* gets used on-the-fly */
|
||||
}
|
||||
if (optConf->reinitcheck == 0 && pConfig->reinitcheck != 0 &&
|
||||
pConfig->reinitcheck != config->reinitcheck) {
|
||||
config->reinitcheck = pConfig->reinitcheck;
|
||||
|
||||
if (optConf->reinitcheck == 0) {
|
||||
if (pConfig->reinitcheck == 0)
|
||||
config->reinitcheck = defConfig.reinitcheck;
|
||||
else if (pConfig->reinitcheck != config->reinitcheck)
|
||||
config->reinitcheck = pConfig->reinitcheck;
|
||||
/* gets used on-the-fly */
|
||||
}
|
||||
#if HAVE_OPENSSL
|
||||
if (optConf->sslrequired == FLAGUNKNOWN &&
|
||||
pConfig->sslrequired != FLAGUNKNOWN &&
|
||||
pConfig->sslrequired != config->sslrequired) {
|
||||
config->sslrequired = pConfig->sslrequired;
|
||||
if (optConf->sslrequired == FLAGUNKNOWN) {
|
||||
if (pConfig->sslrequired == FLAGUNKNOWN)
|
||||
config->sslrequired = defConfig.sslrequired;
|
||||
else if (pConfig->sslrequired != config->sslrequired)
|
||||
config->sslrequired = pConfig->sslrequired;
|
||||
/* gets used on-the-fly */
|
||||
}
|
||||
#endif
|
||||
@ -4057,49 +4193,81 @@ ReReadCfg(fd)
|
||||
|
||||
/* process any new options (command-line flags might have
|
||||
* overridden things, so just need to check on new pConfig
|
||||
* values for changes)
|
||||
* values for changes).
|
||||
* the checks here produce warnings, and are inside the
|
||||
* isMaster check so it only pops out once.
|
||||
*/
|
||||
if (optConf->daemonmode == FLAGUNKNOWN &&
|
||||
pConfig->daemonmode != FLAGUNKNOWN &&
|
||||
pConfig->daemonmode != config->daemonmode) {
|
||||
config->daemonmode = pConfig->daemonmode;
|
||||
Msg("warning: `daemonmode' config option changed - you must restart for it to take effect");
|
||||
if (optConf->daemonmode == FLAGUNKNOWN) {
|
||||
if (pConfig->daemonmode == FLAGUNKNOWN)
|
||||
pConfig->daemonmode = defConfig.daemonmode;
|
||||
if (pConfig->daemonmode != config->daemonmode) {
|
||||
config->daemonmode = pConfig->daemonmode;
|
||||
Msg("warning: `daemonmode' config option changed - you must restart for it to take effect");
|
||||
}
|
||||
}
|
||||
if (optConf->primaryport == (char *)0 &&
|
||||
pConfig->primaryport != (char *)0 &&
|
||||
(config->primaryport == (char *)0 ||
|
||||
strcasecmp(pConfig->primaryport, config->primaryport) != 0)) {
|
||||
if (config->primaryport != (char *)0)
|
||||
free(config->primaryport);
|
||||
if ((config->primaryport = strdup(pConfig->primaryport))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `primaryport' config option changed - you must restart for it to take effect");
|
||||
if (optConf->primaryport == (char *)0) {
|
||||
char *p;
|
||||
if (pConfig->primaryport == (char *)0)
|
||||
p = defConfig.primaryport;
|
||||
else
|
||||
p = pConfig->primaryport;
|
||||
if (config->primaryport == (char *)0 ||
|
||||
strcmp(p, config->primaryport) != 0) {
|
||||
if (config->primaryport != (char *)0)
|
||||
free(config->primaryport);
|
||||
if ((config->primaryport = StrDup(p))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `primaryport' config option changed - you must restart for it to take effect");
|
||||
}
|
||||
}
|
||||
if (optConf->secondaryport == (char *)0 &&
|
||||
pConfig->secondaryport != (char *)0 &&
|
||||
(config->secondaryport == (char *)0 ||
|
||||
strcasecmp(pConfig->secondaryport,
|
||||
config->secondaryport) != 0)) {
|
||||
if (config->secondaryport != (char *)0)
|
||||
free(config->secondaryport);
|
||||
if ((config->secondaryport = strdup(pConfig->secondaryport))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `secondaryport' config option changed - you must restart for it to take effect");
|
||||
if (optConf->secondaryport == (char *)0) {
|
||||
char *p;
|
||||
if (pConfig->secondaryport == (char *)0)
|
||||
p = defConfig.secondaryport;
|
||||
else
|
||||
p = pConfig->secondaryport;
|
||||
if (config->secondaryport == (char *)0 ||
|
||||
strcmp(p, config->secondaryport) != 0) {
|
||||
if (config->secondaryport != (char *)0)
|
||||
free(config->secondaryport);
|
||||
if ((config->secondaryport = StrDup(p))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `secondaryport' config option changed - you must restart for it to take effect");
|
||||
}
|
||||
}
|
||||
#if HAVE_OPENSSL
|
||||
if (optConf->sslcredentials == (char *)0 &&
|
||||
pConfig->sslcredentials != (char *)0 &&
|
||||
(config->sslcredentials == (char *)0 ||
|
||||
strcasecmp(pConfig->sslcredentials,
|
||||
config->sslcredentials) != 0)) {
|
||||
if (config->sslcredentials != (char *)0)
|
||||
free(config->sslcredentials);
|
||||
if ((config->sslcredentials = strdup(pConfig->sslcredentials))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `sslcredentials' config option changed - you must restart for it to take effect");
|
||||
if (optConf->sslcredentials == (char *)0) {
|
||||
if (pConfig->sslcredentials == (char *)0) {
|
||||
if (config->sslcredentials != (char *)0) {
|
||||
free(config->sslcredentials);
|
||||
config->sslcredentials = (char *)0;
|
||||
Msg("warning: `sslcredentials' config option changed - you must restart for it to take effect");
|
||||
}
|
||||
} else {
|
||||
if (config->sslcredentials == (char *)0 ||
|
||||
strcmp(pConfig->sslcredentials,
|
||||
config->sslcredentials) != 0) {
|
||||
if (config->sslcredentials != (char *)0)
|
||||
free(config->sslcredentials);
|
||||
if ((config->sslcredentials =
|
||||
StrDup(pConfig->sslcredentials))
|
||||
== (char *)0)
|
||||
OutOfMem();
|
||||
Msg("warning: `sslcredentials' config option changed - you must restart for it to take effect");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if HAVE_SETPROCTITLE
|
||||
if (optConf->setproctitle == FLAGUNKNOWN) {
|
||||
if (pConfig->setproctitle == FLAGUNKNOWN)
|
||||
pConfig->setproctitle = defConfig.setproctitle;
|
||||
if (pConfig->setproctitle != config->setproctitle) {
|
||||
config->setproctitle = pConfig->setproctitle;
|
||||
Msg("warning: `setproctitle' config option changed - you must restart for it to take effect");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4134,4 +4302,22 @@ ReReadCfg(fd)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if HAVE_SETPROCTITLE
|
||||
if (config->setproctitle == FLAGTRUE) {
|
||||
if (isMaster) {
|
||||
REMOTE *pRC;
|
||||
GRPENT *pGE;
|
||||
int local = 0, remote = 0;
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext)
|
||||
local += pGE->imembers;
|
||||
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext)
|
||||
remote++;
|
||||
setproctitle("master: port %hu, %d local, %d remote", bindPort,
|
||||
local, remote);
|
||||
} else
|
||||
setproctitle("group %u: port %hu, %d %s", pGroups->id,
|
||||
pGroups->port, pGroups->imembers,
|
||||
pGroups->imembers == 1 ? "console" : "consoles");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: readcfg.h,v 5.32 2003-09-28 08:54:16-07 bryan Exp $
|
||||
* $Id: readcfg.h,v 5.36 2003-10-31 09:54:44-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -11,12 +11,15 @@ typedef struct config {
|
||||
char defaultaccess;
|
||||
FLAG daemonmode;
|
||||
char *logfile;
|
||||
char *initcmd;
|
||||
char *passwdfile;
|
||||
char *primaryport;
|
||||
FLAG redirect;
|
||||
FLAG loghostnames;
|
||||
int reinitcheck;
|
||||
char *secondaryport;
|
||||
#if HAVE_SETPROCTITLE
|
||||
FLAG setproctitle;
|
||||
#endif
|
||||
#if HAVE_OPENSSL
|
||||
char *sslcredentials;
|
||||
FLAG sslrequired;
|
||||
|
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.51 2003-10-31 10:04:19-08 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.5"
|
||||
|
@ -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.5" "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.5
|
||||
|
||||
# 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.5"
|
||||
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]
|
||||
|
Reference in New Issue
Block a user