From 92cf41a9f2b9964a3fb6281ef32d9bb8e4eb8343 Mon Sep 17 00:00:00 2001 From: Bryan Stansell Date: Fri, 31 Oct 2003 10:15:09 -0800 Subject: [PATCH] Imported from conserver-8.0.5.tar.gz --- CHANGES | 15 +- TODO | 5 +- config.h.in | 3 + configure | 3 +- configure.in | 2 +- conserver.cf/conserver.cf.man | 14 +- conserver.cf/conserver.passwd.man | 2 +- conserver.html | 8 +- conserver/access.c | 26 ++- conserver/conserver.man | 2 +- conserver/group.c | 10 +- conserver/main.c | 105 ++++++++--- conserver/main.h | 3 +- conserver/readcfg.c | 280 +++++++++++++++++++++--------- conserver/readcfg.h | 7 +- conserver/version.h | 4 +- console/console.man | 2 +- contrib/redhat-rpm/conserver.spec | 2 +- contrib/solaris-package/pkginfo | 2 +- 19 files changed, 360 insertions(+), 135 deletions(-) diff --git a/CHANGES b/CHANGES index c3e5a54..35caf6b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,19 @@ 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 + - 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 + version 8.0.4 (Oct 10, 2003): - fixed client rejection bug that can nearly never happen - reported by Han Pilmeyer @@ -573,5 +586,5 @@ before version 6.05: and enhancements of various types were applied. # -# $Id: CHANGES,v 1.118 2003-10-10 09:02:38-07 bryan Exp $ +# $Id: CHANGES,v 1.120 2003-10-31 10:04:12-08 bryan Exp $ # diff --git a/TODO b/TODO index 148d0ac..5478f2c 100644 --- a/TODO +++ b/TODO @@ -80,6 +80,9 @@ Bryan Stansell - show attach/detach events to/of spy console clients : Greg A. Woods +- redefine client escape sequence in conserver.cf : Toby Gerhart + + # -# $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 $ # diff --git a/config.h.in b/config.h.in index 5932545..bb6691f 100644 --- a/config.h.in +++ b/config.h.in @@ -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 diff --git a/configure b/configure index 16f001c..d9fd320 100755 --- a/configure +++ b/configure @@ -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 diff --git a/configure.in b/configure.in index 90e37cd..04ff735 100644 --- a/configure.in +++ b/configure.in @@ -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])], diff --git a/conserver.cf/conserver.cf.man b/conserver.cf/conserver.cf.man index 73c7ae3..4cd198a 100644 --- a/conserver.cf/conserver.cf.man +++ b/conserver.cf/conserver.cf.man @@ -1,5 +1,5 @@ -.\" $Id: conserver.cf.man,v 1.43 2003-10-02 19:01:05-07 bryan Exp $ -.TH CONSERVER.CF 5 "2003-10-02" "conserver-8.0.4" "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 diff --git a/conserver.cf/conserver.passwd.man b/conserver.cf/conserver.passwd.man index 928ecc7..0ae8a8d 100644 --- a/conserver.cf/conserver.passwd.man +++ b/conserver.cf/conserver.passwd.man @@ -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.4" "conserver" +.TH CONSERVER.PASSWD 5 "2003-07-04" "conserver-8.0.5" "conserver" .SH NAME conserver.passwd \- user access information for .BR conserver (8) diff --git a/conserver.html b/conserver.html index 410d567..5a4cf39 100644 --- a/conserver.html +++ b/conserver.html @@ -183,11 +183,11 @@

Downloading

-

The current version, released on Oct 10, 2003, is 8.0.4.tar.gz. You can get it via +

The current version, released on Oct 31,2003, is 8.0.5.tar.gz. You can get it via FTP - or HTTP. See the FTP + or HTTP. See the CHANGES file for information on the latest updates.

diff --git a/conserver/access.c b/conserver/access.c index 482ff63..e57e74b 100644 --- a/conserver/access.c +++ b/conserver/access.c @@ -1,5 +1,5 @@ /* - * $Id: access.c,v 5.67 2003-10-03 06:32:34-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; } diff --git a/conserver/conserver.man b/conserver/conserver.man index 10a8b4b..5b32aaa 100644 --- a/conserver/conserver.man +++ b/conserver/conserver.man @@ -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.4" "conserver" +.TH CONSERVER 8 "2003-09-22" "conserver-8.0.5" "conserver" .SH NAME conserver \- console server daemon .SH SYNOPSIS diff --git a/conserver/group.c b/conserver/group.c index 51d5517..989ba2c 100644 --- a/conserver/group.c +++ b/conserver/group.c @@ -1,5 +1,5 @@ /* - * $Id: group.c,v 5.264 2003-10-10 03:28:49-07 bryan Exp $ + * $Id: group.c,v 5.265 2003-10-31 09:54:35-08 bryan Exp $ * * Copyright conserver.com, 2000 * @@ -4162,6 +4162,14 @@ Spawn(pGE) isMaster = 0; break; } + +#if HAVE_SETPROCTITLE + if (config->setproctitle == FLAGTRUE) + setproctitle("group %u: port %hu, %d %s", pGE->id, pGE->port, + pGE->imembers, + pGE->imembers == 1 ? "console" : "consoles"); +#endif + /* clean out the master client lists - they aren't useful here and just * cause extra file descriptors and memory allocation to lie around, * not a very good thing! diff --git a/conserver/main.c b/conserver/main.c index 1051b23..2621f47 100644 --- a/conserver/main.c +++ b/conserver/main.c @@ -1,5 +1,5 @@ /* - * $Id: main.c,v 5.161 2003-10-03 06:32:34-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(); @@ -1190,10 +1213,10 @@ main(argc, argv) #endif break; case 'C': - pcConfig = optarg; + pcConfig = StrDup(optarg); break; case 'd': - fDaemon = 1; + optConf->daemonmode = FLAGTRUE; break; case 'D': fDebug++; @@ -1225,7 +1248,7 @@ main(argc, argv) } break; case 'M': - interface = optarg; + interface = StrDup(optarg); break; case 'n': /* noop now */ @@ -1360,7 +1383,7 @@ main(argc, argv) else if (pConfig->primaryport != (char *)0) config->primaryport = StrDup(pConfig->primaryport); else - config->primaryport = StrDup(DEFPORT); + config->primaryport = StrDup(defConfig.primaryport); if (config->primaryport == (char *)0) OutOfMem(); @@ -1391,7 +1414,7 @@ main(argc, argv) else if (pConfig->secondaryport != (char *)0) config->secondaryport = StrDup(pConfig->secondaryport); else - config->secondaryport = StrDup(DEFBASEPORT); + config->secondaryport = StrDup(defConfig.secondaryport); if (config->secondaryport == (char *)0) OutOfMem(); @@ -1421,7 +1444,7 @@ main(argc, argv) else if (pConfig->passwdfile != (char *)0) config->passwdfile = StrDup(pConfig->passwdfile); else - config->passwdfile = StrDup(PASSWDFILE); + config->passwdfile = StrDup(defConfig.passwdfile); if (config->passwdfile == (char *)0) OutOfMem(); @@ -1430,7 +1453,7 @@ main(argc, argv) else if (pConfig->logfile != (char *)0) 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; diff --git a/conserver/main.h b/conserver/main.h index 404b12c..9e3608a 100644 --- a/conserver/main.h +++ b/conserver/main.h @@ -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 diff --git a/conserver/readcfg.c b/conserver/readcfg.c index 34d6edb..5633226 100644 --- a/conserver/readcfg.c +++ b/conserver/readcfg.c @@ -1,5 +1,5 @@ /* - * $Id: readcfg.c,v 5.146 2003-10-10 08:58:12-07 bryan Exp $ + * $Id: readcfg.c,v 5.148 2003-10-31 09:55:55-08 bryan Exp $ * * Copyright conserver.com, 2000 * @@ -3148,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) @@ -3209,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); @@ -3233,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) { @@ -3420,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) @@ -3472,7 +3478,6 @@ ConfigItemSecondaryport(id) OutOfMem(); } -#if HAVE_OPENSSL void #if PROTOTYPES ConfigItemSslcredentials(char *id) @@ -3482,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); @@ -3492,6 +3498,11 @@ ConfigItemSslcredentials(id) if ((parserConfigTemp->sslcredentials = StrDup(id)) == (char *)0) OutOfMem(); +#else + Error + ("sslcredentials ignored - encryption not compiled into code [%s:%d]", + file, line); +#endif } void @@ -3503,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[] = { @@ -3577,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} }; @@ -4074,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 @@ -4131,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 @@ -4208,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 } diff --git a/conserver/readcfg.h b/conserver/readcfg.h index 0aac125..c26f73b 100644 --- a/conserver/readcfg.h +++ b/conserver/readcfg.h @@ -1,5 +1,5 @@ /* - * $Id: readcfg.h,v 5.34 2003-10-10 08:57:17-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; diff --git a/conserver/version.h b/conserver/version.h index c23dbff..4cfac8a 100644 --- a/conserver/version.h +++ b/conserver/version.h @@ -1,5 +1,5 @@ /* - * $Id: version.h,v 1.50 2003-10-10 09:02:08-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.4" +#define THIS_VERSION "conserver.com version 8.0.5" diff --git a/console/console.man b/console/console.man index 055f1c9..31e639b 100644 --- a/console/console.man +++ b/console/console.man @@ -1,5 +1,5 @@ .\" $Id: console.man,v 1.37 2003-10-02 19:00:45-07 bryan Exp $ -.TH CONSOLE 1 "2003-10-02" "conserver-8.0.4" "conserver" +.TH CONSOLE 1 "2003-10-02" "conserver-8.0.5" "conserver" .SH NAME console \- console server client program .SH SYNOPSIS diff --git a/contrib/redhat-rpm/conserver.spec b/contrib/redhat-rpm/conserver.spec index 44da46e..7d5582a 100644 --- a/contrib/redhat-rpm/conserver.spec +++ b/contrib/redhat-rpm/conserver.spec @@ -4,7 +4,7 @@ # %define pkg conserver -%define ver conserver-8.0.4 +%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 diff --git a/contrib/solaris-package/pkginfo b/contrib/solaris-package/pkginfo index 2975178..380c750 100644 --- a/contrib/solaris-package/pkginfo +++ b/contrib/solaris-package/pkginfo @@ -1,7 +1,7 @@ PKG="conserver" NAME="Console server and client" CATEGORY="system" -VERSION="conserver-8.0.4" +VERSION="conserver-8.0.5" DESC="Console server and client" CLASSES=none ARCH=sparc