diff --git a/CHANGES b/CHANGES index dc90282..f257ca5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,32 @@ CHANGES ======= +version 7.0.3 (Jul 5, 2001): + - "Off by 1" bug in 7.0.2 line-oriented timestamp code fixed (extra + chars in logfile) reported by Matthew Cheek + - TODO file added to distribution + - 'attached', 'detached', and 'bumped' actions now written to + console logs that have 'a' in timestamp-spec field + - Default timestamp specification with TIMESTAMP= in .cf file + - config file much more forgiving about whitespace in fields + - gethostbyaddr() failures are no longer fatal + - Added -M for server to specify the address to listen on + - Added -p option to client and server to specify the port to + connect to and listen on (--with-port still sets the default) + - Added logfile output when going into daemon mode + - Added --with-logfile to configure + - Added -L to override compile-time logfile location + - SIGHUP reopens this logfile as well as previous behavior + - Run as root only restriction removed - warning now (if necessary) + - More #defines for FreeBSD compatibility + - Using inet_ntoa() now instead of peeking at bytes + - Fixed up -V (and -Vv) output for client and server + - Increased conserver.passwd read buffer (CheckPasswd()) + - Removed DO_VIRTUAL #if's - always build that code now + - Removed ORIGINAL_CODE #if's (old non-CIDR access list parsing) + - Changed undocumented -p option to -P in console client + - man pages updated to reflect a little more reality + version 7.0.2 (Jun 15, 2001): - Bogus "ambiguous server abbreviation" with distributed server setup fixed @@ -128,5 +154,5 @@ before version 6.05: and enhancements of various types were applied. # -# $Id: CHANGES,v 1.28 2001-06-15 17:36:53-07 bryan Exp $ +# $Id: CHANGES,v 1.32 2001-07-05 08:09:30-07 bryan Exp $ # diff --git a/INSTALL b/INSTALL index f5e82a1..c965df3 100644 --- a/INSTALL +++ b/INSTALL @@ -15,7 +15,7 @@ Detailed Instructions - First thing to do is determine if you want different defaults. A './configure --help' will show you the basics. If you like all - the defaults shown, your set. If not, here are the conserver + the defaults shown, you're set. If not, here are the conserver unique options: --with-port=PORT Specify port number [conserver] @@ -85,5 +85,5 @@ Detailed Instructions - That's it! Just start up the console server and enjoy! # -# $Id: INSTALL,v 1.10 2001-06-15 09:48:58-07 bryan Exp $ +# $Id: INSTALL,v 1.11 2001-07-05 02:46:01-07 bryan Exp $ # diff --git a/LICENSE b/LICENSE index b93844b..6dd8f3c 100644 --- a/LICENSE +++ b/LICENSE @@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -Copyright (c) 1988, GNAC, Inc. +Copyright (c) 1998, GNAC, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/TODO b/TODO new file mode 100644 index 0000000..10db5ee --- /dev/null +++ b/TODO @@ -0,0 +1,91 @@ + TODO + ==== + +Warning to those who aren't me: this is an unorganized list of things +that might be classified as bugs, improvements, random thoughts or +suggestions. Hopefully it will get cleaned up over time. + +Bryan Stansell + +--------------------------------------------------------------------------- + +- reread of conserver.cf - totally difficult + - non-dynamic memory allocation + - no IPC for coordinated updates + - additions only may work + - deletions only may work + - reimplement the whole thing *would* work + +- better shadow file support + +- PAM support + +- syslog? + +- alternate (md5) password encryption support in conserver.passwd + +- config file examples for various configurations + +- per-line timestamps + - only when not connected? + +- flow control configuration (hardcoded on, i think) + +- pipe input/output (console <-> program) via 'console' + +- group permissions (better user management in general) + +- 64-bit compilation support (have a patch set contributed, somewhere, i think) + +- autologout? setting per console? gack, would have to interpret data. + +- "listen" capability (watch all/multiple consoles) + +- alternate break (^ecl2?) + +- aliases for console entries + +- authentication to terminal servers (ssh, passphrase, whatever) + +- "not" or "except" in passwd file (!console). + +- master redirect for same host - big mess + - redirect for console goes to `hostname` + - should probably go to ip of connection + - addresses not allowed - has to be hostname (resolvable by client) + - can you say: gack! + +- multi-homed/multi-ip hosts not supported well + - other names/ip addrs not detected as local, necessarily + +- cyclades ts1000/2000 port : "Moses, Joel" + +- dynamic memory allocation + - buf[BUFSIZ] in conserver/group.c CheckPasswd(). + - kill --with-maxgrp + +- config file for client (list of masters, for example) + +- patches from Enrik Berkhan + - bind address + - base port for children + +- strftime() idea for logfile names : Lars Kellogg-Stedman + +- 9600baud log replay? + +- SSH/SSL/Encryption of some type between client/server + +- server -M flag should accept multiple addresses (comma separated) + - should client as well? + +- logfile rotation based on size + +- website docs on serial port configs + - PCs (solaris x86, linux, *bsd, etc) + - lilo + - bios support + +# +# $Id: TODO,v 1.7 2001-07-05 07:37:34-07 bryan Exp $ +# diff --git a/acconfig.h b/acconfig.h index 4a8d74c..4a77766 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,9 +1,7 @@ /* * Socket used to communicate - * Choose either PORT or SERVICE... */ -#undef SERVICENAME -#undef PORTNUMBER +#undef DEFPORT /* * Hostname of console server @@ -20,6 +18,11 @@ */ #undef PASSWDFILE +/* + * Logfile path + */ +#undef LOGFILEPATH + /* * Number of consoles per child process */ diff --git a/compat.h b/compat.h index cf8aa44..0bf91e1 100644 --- a/compat.h +++ b/compat.h @@ -212,3 +212,9 @@ extern char *h_errlist[]; #ifndef BSDLY #define BSDLY 0 #endif +#ifndef ONOCR +#define ONOCR 0 +#endif +#ifndef ONLRET +#define ONLRET 0 +#endif diff --git a/config.h.in b/config.h.in index ab6aecd..95a201d 100644 --- a/config.h.in +++ b/config.h.in @@ -30,10 +30,8 @@ /* * Socket used to communicate - * Choose either PORT or SERVICE... */ -#undef SERVICENAME -#undef PORTNUMBER +#undef DEFPORT /* * Hostname of console server @@ -50,6 +48,11 @@ */ #undef PASSWDFILE +/* + * Logfile path + */ +#undef LOGFILEPATH + /* * Number of consoles per child process */ diff --git a/configure b/configure index aac42e8..522a0a8 100755 --- a/configure +++ b/configure @@ -19,6 +19,8 @@ ac_help="$ac_help --with-cffile=CFFILE Specify config filename [conserver.cf] " ac_help="$ac_help --with-pwdfile=PWDFILE Specify password filename [conserver.passwd] " +ac_help="$ac_help + --with-logfile=LOGFILE Specify log filename [/var/log/conserver] " ac_help="$ac_help --with-pidfile=PIDFILE Specify PID filepath [/var/run/conserver.pid] " ac_help="$ac_help @@ -550,42 +552,34 @@ MKDIR="mkdir -p -m 755" echo $ac_n "checking for port number specification""... $ac_c" 1>&6 -echo "configure:554: checking for port number specification" >&5 +echo "configure:556: checking for port number specification" >&5 # Check whether --with-port or --without-port was given. if test "${with_port+set}" = set; then withval="$with_port" if test "$withval" != yes -a "$withval" != no; then - if expr "$withval" : '.*[^0-9]' >/dev/null 2>&1; then - cat >> confdefs.h <> confdefs.h <&6 - else - cat >> confdefs.h <&6 - fi + echo "$ac_t""port '$withval'" 1>&6 else cat >> confdefs.h <&6 + echo "$ac_t""port 'conserver'" 1>&6 fi else cat >> confdefs.h <&6 + echo "$ac_t""port 'conserver'" 1>&6 fi echo $ac_n "checking for master conserver hostname""... $ac_c" 1>&6 -echo "configure:589: checking for master conserver hostname" >&5 +echo "configure:583: checking for master conserver hostname" >&5 # Check whether --with-master or --without-master was given. if test "${with_master+set}" = set; then withval="$with_master" @@ -612,7 +606,7 @@ fi echo $ac_n "checking for configuration filename""... $ac_c" 1>&6 -echo "configure:616: checking for configuration filename" >&5 +echo "configure:610: checking for configuration filename" >&5 # Check whether --with-cffile or --without-cffile was given. if test "${with_cffile+set}" = set; then withval="$with_cffile" @@ -639,7 +633,7 @@ fi echo $ac_n "checking for password filename""... $ac_c" 1>&6 -echo "configure:643: checking for password filename" >&5 +echo "configure:637: checking for password filename" >&5 # Check whether --with-pwdfile or --without-pwdfile was given. if test "${with_pwdfile+set}" = set; then withval="$with_pwdfile" @@ -665,8 +659,35 @@ EOF fi +echo $ac_n "checking for log filename""... $ac_c" 1>&6 +echo "configure:664: checking for log filename" >&5 +# Check whether --with-logfile or --without-logfile was given. +if test "${with_logfile+set}" = set; then + withval="$with_logfile" + if test "$withval" != yes; then + cat >> confdefs.h <&6 + else + cat >> confdefs.h <&6 + fi +else + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for PID filename""... $ac_c" 1>&6 -echo "configure:670: checking for PID filename" >&5 +echo "configure:691: checking for PID filename" >&5 # Check whether --with-pidfile or --without-pidfile was given. if test "${with_pidfile+set}" = set; then withval="$with_pidfile" @@ -693,7 +714,7 @@ fi echo $ac_n "checking for MAXMEMB setting""... $ac_c" 1>&6 -echo "configure:697: checking for MAXMEMB setting" >&5 +echo "configure:718: checking for MAXMEMB setting" >&5 # Check whether --with-maxmemb or --without-maxmemb was given. if test "${with_maxmemb+set}" = set; then withval="$with_maxmemb" @@ -720,7 +741,7 @@ fi echo $ac_n "checking for MAXGRP setting""... $ac_c" 1>&6 -echo "configure:724: checking for MAXGRP setting" >&5 +echo "configure:745: checking for MAXGRP setting" >&5 # Check whether --with-maxgrp or --without-maxgrp was given. if test "${with_maxgrp+set}" = set; then withval="$with_maxgrp" @@ -747,7 +768,7 @@ fi echo $ac_n "checking for 8bit setting""... $ac_c" 1>&6 -echo "configure:751: checking for 8bit setting" >&5 +echo "configure:772: checking for 8bit setting" >&5 # Check whether --enable-8bit or --disable-8bit was given. if test "${enable_8bit+set}" = set; then enableval="$enable_8bit" @@ -774,7 +795,7 @@ fi echo $ac_n "checking for connect() timeout""... $ac_c" 1>&6 -echo "configure:778: checking for connect() timeout" >&5 +echo "configure:799: checking for connect() timeout" >&5 # Check whether --with-timeout or --without-timeout was given. if test "${with_timeout+set}" = set; then withval="$with_timeout" @@ -803,7 +824,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:807: checking for $ac_word" >&5 +echo "configure:828: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -833,7 +854,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:837: checking for $ac_word" >&5 +echo "configure:858: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -884,7 +905,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:888: checking for $ac_word" >&5 +echo "configure:909: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -916,7 +937,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:920: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:941: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -927,12 +948,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 931 "configure" +#line 952 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -958,12 +979,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:962: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:983: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:967: checking whether we are using GNU C" >&5 +echo "configure:988: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -972,7 +993,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -991,7 +1012,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:995: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1016: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1053,7 +1074,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1057: checking for a BSD compatible install" >&5 +echo "configure:1078: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1106,7 +1127,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1110: checking whether ln -s works" >&5 +echo "configure:1131: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1127,7 +1148,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1131: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1152: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1156,7 +1177,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1160: checking how to run the C preprocessor" >&5 +echo "configure:1181: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1171,13 +1192,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1188,13 +1209,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1205,13 +1226,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1236,9 +1257,9 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1240: checking for AIX" >&5 +echo "configure:1261: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:1264: checking for working const" >&5 +echo "configure:1285: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1337,12 +1358,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1341: checking for ANSI C header files" >&5 +echo "configure:1362: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1350,7 +1371,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1375: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1367,7 +1388,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1385,7 +1406,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1406,7 +1427,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1417,7 +1438,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1444,17 +1465,17 @@ for ac_hdr in sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1448: checking for $ac_hdr" >&5 +echo "configure:1469: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1485,17 +1506,17 @@ for ac_hdr in termios.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1489: checking for $ac_hdr" >&5 +echo "configure:1510: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1526,17 +1547,17 @@ if test "$ac_cv_header_termios_h" != "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1530: checking for $ac_hdr" >&5 +echo "configure:1551: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1561: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1567,17 +1588,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1571: checking for $ac_hdr" >&5 +echo "configure:1592: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1613,17 +1634,17 @@ for ac_hdr in unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1617: checking for $ac_hdr" >&5 +echo "configure:1638: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1650,12 +1671,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1654: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1675: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1664,7 +1685,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1685,12 +1706,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1689: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1710: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1706,7 +1727,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1727,12 +1748,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:1731: checking for mode_t" >&5 +echo "configure:1752: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1760,12 +1781,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1764: checking return type of signal handlers" >&5 +echo "configure:1785: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1782,7 +1803,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1802,12 +1823,12 @@ EOF echo $ac_n "checking if sig_atomic_t is defined""... $ac_c" 1>&6 -echo "configure:1806: checking if sig_atomic_t is defined" >&5 +echo "configure:1827: checking if sig_atomic_t is defined" >&5 if eval "test \"`echo '$''{'ac_cv_type_sig_atomic_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1819,7 +1840,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_type_sig_atomic_t=yes else @@ -1842,12 +1863,12 @@ EOF fi echo $ac_n "checking if socklen_t is defined""... $ac_c" 1>&6 -echo "configure:1846: checking if socklen_t is defined" >&5 +echo "configure:1867: checking if socklen_t is defined" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1860,7 +1881,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_type_socklen_t=yes else @@ -1885,7 +1906,7 @@ fi echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1889: checking for socket in -lsocket" >&5 +echo "configure:1910: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1893,7 +1914,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1932,7 +1953,7 @@ else fi echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1936: checking for gethostbyname in -lnsl" >&5 +echo "configure:1957: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1940,7 +1961,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1979,7 +2000,7 @@ else fi echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:1983: checking for crypt in -lcrypt" >&5 +echo "configure:2004: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1987,7 +2008,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2030,12 +2051,12 @@ fi for ac_func in getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent wait3 getspnam setlinebuf setvbuf getpseudo ptsname flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2034: checking for $ac_func" >&5 +echo "configure:2055: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2083,7 +2104,7 @@ fi done echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:2087: checking whether setpgrp takes no argument" >&5 +echo "configure:2108: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2091,7 +2112,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else diff --git a/configure.in b/configure.in index ef4c9d1..4d52800 100644 --- a/configure.in +++ b/configure.in @@ -16,19 +16,14 @@ AC_MSG_CHECKING(for port number specification) AC_ARG_WITH(port, [ --with-port=PORT Specify port number [conserver]], [if test "$withval" != yes -a "$withval" != no; then - if expr "$withval" : '.*[[^0-9]]' >/dev/null 2>&1; then - AC_DEFINE_UNQUOTED(SERVICENAME, "$withval") - AC_MSG_RESULT(/etc/services name '$withval') - else - AC_DEFINE_UNQUOTED(PORTNUMBER, $withval) - AC_MSG_RESULT(port $withval) - fi + AC_DEFINE_UNQUOTED(DEFPORT, "$withval") + AC_MSG_RESULT(port '$withval') else - AC_DEFINE_UNQUOTED(SERVICENAME, "conserver") - AC_MSG_RESULT(/etc/services name 'conserver') + AC_DEFINE_UNQUOTED(DEFPORT, "conserver") + AC_MSG_RESULT(port 'conserver') fi], - [AC_DEFINE_UNQUOTED(SERVICENAME, "conserver") - AC_MSG_RESULT(/etc/services name 'conserver')]) + [AC_DEFINE_UNQUOTED(DEFPORT, "conserver") + AC_MSG_RESULT(port 'conserver')]) AC_MSG_CHECKING(for master conserver hostname) AC_ARG_WITH(master, @@ -69,6 +64,19 @@ AC_ARG_WITH(pwdfile, [AC_DEFINE_UNQUOTED(PASSWDFILE, "conserver.passwd") AC_MSG_RESULT('conserver.passwd')]) +AC_MSG_CHECKING(for log filename) +AC_ARG_WITH(logfile, + [ --with-logfile=LOGFILE Specify log filename [/var/log/conserver] ], + [if test "$withval" != yes; then + AC_DEFINE_UNQUOTED(LOGFILEPATH, "$withval") + AC_MSG_RESULT('$withval') + else + AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/conserver") + AC_MSG_RESULT('/var/log/conserver') + fi], + [AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/conserver") + AC_MSG_RESULT('/var/log/conserver')]) + AC_MSG_CHECKING(for PID filename) AC_ARG_WITH(pidfile, [ --with-pidfile=PIDFILE Specify PID filepath [/var/run/conserver.pid] ], diff --git a/conserver.cf/INSTALL.old b/conserver.cf/INSTALL.old deleted file mode 100644 index 181ce9f..0000000 --- a/conserver.cf/INSTALL.old +++ /dev/null @@ -1,26 +0,0 @@ -# $Id: INSTALL,v 4.1 91/06/19 14:20:54 ksb Exp $ - -Prep: - - Start in the conserver directory. - - Now read conserver.cf.5l (if you have mk(1L) installed just mk it). - Run: - $ tbl conserver.cf.5l |nroff -man |${PAGER-more} - - Now edit dummy.cf and follow the instructions there. - [If you are just shopping stop here.] - - Now edit conserver.cf and put your real hosts in there. - - Edit the Makefile and change LIB. - - -Compile: - - None. - - -Install: - - Make install. diff --git a/conserver.cf/README.old b/conserver.cf/README.old deleted file mode 100644 index d5f8931..0000000 --- a/conserver.cf/README.old +++ /dev/null @@ -1,16 +0,0 @@ -# $Id: README,v 4.1 91/06/19 14:21:06 ksb Exp $ - -This configuration file has been extended from the Ohio State version. We -allow parity and baud to be set, as well as more than one console server -machine to be in play at a time. We have too many console servers to use -just a single Sun3... :-). - - -We also allow another section for trusted hosts. We allow our operators root -access by physical access to a workstation. - - --- -"So I try to say `Goodbye, my friend.' - I'd like to leave you with something more..." -kayessbee, Kevin Braunsdorf, ksb@cc.purdue.edu, pur-ee!ksb, purdue!ksb diff --git a/conserver.cf/conserver.cf b/conserver.cf/conserver.cf index db1f2e5..d976dea 100644 --- a/conserver.cf/conserver.cf +++ b/conserver.cf/conserver.cf @@ -1,5 +1,5 @@ # -# $Id: conserver.cf,v 1.3 1999-01-25 14:38:19-08 bryan Exp $ +# $Id: conserver.cf,v 1.4 2001-06-28 10:24:01-07 bryan Exp $ # # The character '&' in logfile names are substituted with the console # name. Any logfile name that doesn't begin with a '/' has LOGDIR @@ -9,9 +9,9 @@ LOGDIR=/var/consoles # # list of consoles we serve -# name : tty[@host] : baud[parity] : logfile : mark-interval[m|h|d] -# name : !host : port : logfile : mark-interval[m|h|d] -# name : |command : : logfile : mark-interval[m|h|d] +# name : tty[@host] : baud[parity] : logfile : [mark-interval(m|h|d|l)][+] +# name : !host : port : logfile : [mark-interval(m|h|d|l)][+] +# name : |command : : logfile : [mark-interval(m|h|d|l)][+] # tweety:!ts1:2002:&: bambam:!ts1:2003:&: diff --git a/conserver.cf/conserver.cf.man b/conserver.cf/conserver.cf.man index e6c3d36..0d83765 100644 --- a/conserver.cf/conserver.cf.man +++ b/conserver.cf/conserver.cf.man @@ -1,17 +1,19 @@ -.\" $Id: conserver.cf.man,v 1.7 2001-06-15 07:11:37-07 bryan Exp $ +.\" $Id: conserver.cf.man,v 1.10 2001-07-05 01:39:00-07 bryan Exp $ .\" @(#)constab.5 01/06/91 OSU CIS; Thomas A. Fine .TH CONSERVER.CF 4 "Local" .SH NAME -conserver.cf \- table of server console terminals used by conserver(8L) +conserver.cf \- table of server console terminals used by conserver(8) .SH SYNOPSIS .br LOGDIR=\fIlogdirectory\fP .br -\fIserver\fP:\fIdevice\fP[@\fIconserver\fP]:\fIbaud\fP:\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d|l\fP] +TIMESTAMP=\fItimestamp-spec\fP .br -\fIserver\fP:!\fIhost\fP[@\fIconserver\fP]:\fIport\fP:\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d|l\fP] +\fIserver\fP:\fIdevice\fP[@\fIconserver\fP]:\fIbaud\fP:\fIlogfile\fP:\fItimestamp-spec\fP .br -\fIserver\fP:|\fIcommand\fP[@\fIconserver\fP]::\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d|l\fP] +\fIserver\fP:!\fIhost\fP[@\fIconserver\fP]:\fIport\fP:\fIlogfile\fP:\fItimestamp-spec\fP +.br +\fIserver\fP:|\fIcommand\fP[@\fIconserver\fP]::\fIlogfile\fP:\fItimestamp-spec\fP .br \fB%%\fP .br @@ -19,7 +21,7 @@ LOGDIR=\fIlogdirectory\fP .SH DESCRIPTION .B Conserver.cf is the configuration file for -.IR conserver (8L). +.IR conserver (8). All lines starting with the pound sign `#' are considered comment lines. Blank lines are ignored. .PP @@ -33,7 +35,7 @@ it is used to refer to the server when using the console program. The \fIbaud\fP rate is the speed and parity for this console. Speed may be given as an integer, parity only requires the first letter of any of: even, odd, mark, space. -For no parity, use the character 'p'. +For no parity, use the character `p'. .PP !\fIhost\fP - the hostname of the server to connect to. A socket connection will be made to port \fIport\fP (an integer). @@ -49,14 +51,23 @@ this server is logged. Any occurance of `&' will be replaced with the \fIserver\fP name. Any path that doesn't begin with a `/' will have \fIlogdirectory\fP (value of LOGDIR) prepended to it. .PP -\fImark-interval\fP[\fIm|h|d|l\fP] - specifies the time between -timestamps applied to the console log file. The timestamps look like -`[-- MARK -- Mon Jan 25 14:46:56 PST 1999]'. The `m', `h', and `d' tags -specify `minutes', `hours', and `days'. The `l' tag specifies `lines' -and will cause timestamps of the form `[Mon Jan 25 14:46:56 PST 1999]' to +\fItimestamp-spec\fP - specifies the time between +timestamps applied to the console log file and activity logging. +The format of the specification is +[\fImark-interval\fP(\fIm\fP|\fIh\fP|\fId\fP|\fIl\fP)][\fIa\fP]. +The timestamps look like `[-- MARK -- Mon Jan 25 14:46:56 PST 1999]'. The `m', +`h', and `d' tags specify `minutes', `hours', and `days'. The `l' tag +specifies `lines' and will cause timestamps of the form +`[Mon Jan 25 14:46:56 PST 1999]' to be placed every \fImark-interval\fP lines (a newline character signifies a new line). So, `5h' specifies every 5 hours and `2l' specifies every -two lines. +two lines. An `a' can be specified to add activity logs to the +logfile: `attached', `detached', and `bumped' messages. +.PP +A default \fItimestamp-spec\fP can be specified by using the TIMESTAMP= +syntax. All consoles below the TIMESTAMP= line will have use that +\fItimestamp-spec\fP unless overridden. To turn off marks for a specific +console, use a \fImark-interval\fP of zero. .PP This section is terminated with a `%%' token on a line by itself. .PP @@ -134,4 +145,4 @@ trusted: console.cc.purdue.edu 128.210.7.90 .br allow: cc.purdue.edu stat.cc.purdue.edu .SH "SEE ALSO" -console(1L), conserver(8L) +console(1), conserver(8) diff --git a/conserver.html b/conserver.html index 48f3339..690af4f 100644 --- a/conserver.html +++ b/conserver.html @@ -23,10 +23,27 @@

Conserver


-
+ + + + +

What is conserver?

+
+
+ + + + + + + + +
+
+

From an email I once sent... @@ -72,30 +89,25 @@ HREF="https://www.conserver.com/mailman/listinfo">web pages.

-

Wanna Search?

-

- -Give the search engine a -try. You can hunt through the mailing list archives as well as the -files referenced here. - -

- -

Origin

The console server software found here is a heavily modified version -originally written by Tom Fine (fine@head-cfa.harvard.edu) and then -Kevin S Braunsdorf (ksb+conserver@sa.fedex.com). Patches from Robert -Olson (olson@mcs.anl.gov) were then applied to get network console -support. +originally written by Tom +Fine (fine@head-cfa.harvard.edu) +at Ohio State and then Kevin S Braunsdorf (ksb+conserver@sa.fedex.com). +Patches from Robert Olson (olson@mcs.anl.gov) were then +applied to get network console support.

-Arnold de Leon (arnold@corp.webtv.net) then fixed various bugs and -added enhancements while at arnold@corp.webtv.net) then +fixed various bugs and added enhancements while at Synopsys. I then took the result, continued fixing things, and added features we found useful. @@ -131,10 +143,10 @@ GNAC name - sad, but true.

The current version is -7.0.2.tar.gz. You can get it via FTP -or HTTP. +HREF="http://www.conserver.com/7.0.3.tar.gz"> +7.0.3.tar.gz. You can get it via FTP +or HTTP. See the CHANGES file for information on the latest updates.

diff --git a/conserver/INSTALL.old b/conserver/INSTALL.old deleted file mode 100644 index d8ffc84..0000000 --- a/conserver/INSTALL.old +++ /dev/null @@ -1,114 +0,0 @@ -# $Id: INSTALL,v 4.4 94/07/19 14:48:29 ksb Exp $ -# -# lpr this file, you need to read it with other stuff on the screen. -# - -Basic installation: - - First off, this stuff isn't guaranteed to work, or compile or anything. - Second, the Makefile doesn't even really do that much, because most people - with large networks don't have very normal configurations (that's a lot like - an excuse :-). Third, I assume you have the hardware set up done, and don't - need any help there (just use normal serial lines, or see Sun-serial). - - With that out of the way, let's get started. - - -Prep: - - If you are a serious kinda guy you will want to add the console service to - /etc/services, here is the line we use: - console 782/tcp conserver # console server - - Otherwise you'll have to hard code a PORT in cons.h (there are a comments - at the apropos points. - - If you do not have the PUCC ptyd daemon (and I'll bet you don't) you have - to edit the Makefile, look at the block that sets HAVE_PTYD. - - Later, on the console server you will have to add a line to /etc/rc.local, - or an atboot/cronboot job to start the console server - nice --4 /usr/local/etc/conserver >/dev/console 2>&1 @@ -92,16 +88,13 @@ OutOfMem() * Returns 0 if the addresses match, else returns 1. */ int -AddrCmp(hp, pattern) -struct hostent *hp; +AddrCmp(addr, pattern) +struct in_addr *addr; char *pattern; { unsigned long int hostaddr, pattern_addr, netmask; char buf[200], *p, *slash_posn; - if (hp->h_addrtype != AF_INET || hp->h_length != 4) - return 1; /* unsupported address type */ - slash_posn = strchr(pattern, '/'); if (slash_posn != NULL) { if (strlen(pattern) >= sizeof(buf)) @@ -137,7 +130,7 @@ char *pattern; netmask = htonl(netmask); if (~netmask & pattern_addr) netmask = 0xffffffff; /* compare entire addresses */ - hostaddr = *(unsigned long int*)hp->h_addr; + hostaddr = *(unsigned long int*)addr; Debug( "Access check: host=%lx(%lx/%lx)", hostaddr & netmask, hostaddr, netmask ); Debug( "Access check: acl=%lx(%lx/%lx)", pattern_addr & netmask, pattern_addr, netmask ); @@ -147,54 +140,43 @@ char *pattern; /* return the access type for a given host entry (ksb) */ char -AccType(hp) -struct hostent *hp; +AccType(addr,hname) +struct in_addr *addr; +char *hname; { register int i; - register unsigned char *puc; register char *pcName; - auto char acAddr[4*4]; register int len; if ( fDebug ) { - puc = (unsigned char *)hp->h_addr; - sprintf(acAddr, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]); - Debug( "Access check: hostname=%s, ip=%s", hp->h_name, acAddr ); + if (hname) + Debug( "Access check: hostname=%s, ip=%s", hname, inet_ntoa(*addr) ); + else + Debug( "Access check: hostname=, ip=%s", inet_ntoa(*addr) ); } -#if ORIGINAL_CODE - puc = (unsigned char *)hp->h_addr; - sprintf(acAddr, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]); -#endif for (i = 0; i < iAccess; ++i) { Debug( "Access check: who=%s, trust=%c", pACList[i].pcwho, pACList[i].ctrust ); if (isdigit((int)(pACList[i].pcwho[0]))) { -#if ORIGINAL_CODE - /* we could allow 128.210.7 to match all on that subnet - * here... - */ - if (0 == strcmp(acAddr, pACList[i].pcwho)) { + if (0 == AddrCmp(addr, pACList[i].pcwho)) { return pACList[i].ctrust; } -#else - if (0 == AddrCmp(hp, pACList[i].pcwho)) { - return pACList[i].ctrust; - } -#endif continue; } - pcName = hp->h_name; - len = strlen(pcName); - while (len >= pACList[i].ilen) { - Debug( "Access check: name=%s", pcName ); - if (0 == strcmp(pcName, pACList[i].pcwho)) { - return pACList[i].ctrust; - } - pcName = strchr(pcName, '.'); - if ((char *)0 == pcName) { - break; - } - ++pcName; - len = strlen(pcName); + if (hname && hname[0] != '\000') { + pcName = hname; + len = strlen(pcName); + while (len >= pACList[i].ilen) { + Debug( "Access check: name=%s", pcName ); + if (0 == strcmp(pcName, pACList[i].pcwho)) { + return pACList[i].ctrust; + } + pcName = strchr(pcName, '.'); + if ((char *)0 == pcName) { + break; + } + ++pcName; + len = strlen(pcName); + } } } return chDefAcc; @@ -207,21 +189,28 @@ SetDefAccess(hpLocal) struct hostent *hpLocal; { register char *pcWho, *pcDomain; - register unsigned char *puc; register int iLen; + char *addr; + struct in_addr *aptr; + aptr = (struct in_addr *)(hpLocal->h_addr); + addr = inet_ntoa(*aptr); pACList = (ACCESS *)calloc(3, sizeof(ACCESS)); if ((ACCESS *)0 == pACList) { OutOfMem(); } - if ((char *)0 == (pcWho = malloc(4*3+1))) { + if ((char *)0 == (pcWho = malloc(strlen(addr)+1))) { OutOfMem(); } - puc = (unsigned char *)hpLocal->h_addr; - sprintf(pcWho, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]); + strcpy(pcWho, addr); pACList[iAccess].ctrust = 'a'; pACList[iAccess].ilen = strlen(pcWho); - pACList[iAccess++].pcwho = pcWho; + pACList[iAccess].pcwho = pcWho; + + Debug( "Access list prime: trust=%c, who=%s", pACList[iAccess].ctrust, + pACList[iAccess].pcwho ); + + iAccess++; if ((char *)0 == (pcDomain = strchr(hpLocal->h_name, '.'))) { return; @@ -231,7 +220,12 @@ struct hostent *hpLocal; pcWho = malloc(iLen+1); pACList[iAccess].ctrust = 'a'; pACList[iAccess].ilen = iLen; - pACList[iAccess++].pcwho = strcpy(pcWho, pcDomain); + pACList[iAccess].pcwho = strcpy(pcWho, pcDomain); + + Debug( "Access list prime: trust=%c, who=%s", pACList[iAccess].ctrust, + pACList[iAccess].pcwho ); + + iAccess++; } /* thread ther list of uniq console server machines, aliases for (ksb) diff --git a/conserver/client.c b/conserver/client.c index 6b72d3d..5bf98ec 100644 --- a/conserver/client.c +++ b/conserver/client.c @@ -1,5 +1,5 @@ /* - * $Id: client.c,v 5.25 2001-02-21 17:26:06-08 bryan Exp $ + * $Id: client.c,v 5.28 2001-06-29 00:26:39-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -33,10 +33,6 @@ * * 4. This notice may not be removed or altered. */ -#ifndef lint -static char copyright[] = -"@(#) Copyright 1992 Purdue Research Foundation.\nAll rights reserved.\n"; -#endif #include @@ -58,6 +54,7 @@ static char copyright[] = #include #include #include +#include /* find the next guy who wants to write on the console (ksb) @@ -83,29 +80,12 @@ CONSCLIENT *pCL; } else { CSTROUT(pCL->fd, "\r\n[attached]\r\n"); } + tagLogfile(pCL->pCEto, "%s attached", pCL->acid); return pCL; } return (CONSCLIENT *)0; } -#if HAVE_IDENTD -/* use identd to verify a user at a host (ksb) - * we have a list of login@host:passwd:trust after the general host - * limits. We call identd/tap/auth to get info and compare - */ -IdentifyMe(pCL) -CONSCLIENT *pCL; -{ - /* ZZZ */ - /* we would have to getsockname(fdClient) - * getpeername(fdClient) - * identd_client(addr, addr, acBuffer - * check for identifier in allowed list - * return the permision (modify in pCL) - */ -} -#endif - /* show a character as a string so the user cannot mistake it for (ksb) * another * diff --git a/conserver/consent.c b/conserver/consent.c index a67a09a..52904b2 100644 --- a/conserver/consent.c +++ b/conserver/consent.c @@ -1,5 +1,5 @@ /* - * $Id: consent.c,v 5.47 2001-06-15 11:33:49-07 bryan Exp $ + * $Id: consent.c,v 5.51 2001-07-05 04:12:31-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -37,10 +37,6 @@ /* * Network console modifications by Robert Olson, olson@mcs.anl.gov. */ -#ifndef lint -static char copyright[] = -"@(#) Copyright 1992 Purdue Research Foundation.\nAll rights reserved.\n"; -#endif #include @@ -324,7 +320,6 @@ CONSENT *pCE; #endif /* HAVE_TERMIOS_H */ -#if DO_VIRTUAL /* setup a virtual device (ksb) */ static int @@ -385,7 +380,7 @@ CONSENT *pCE; close(1); close(0); # if defined(TIOCNOTTY) - if (-1 != (i = open("/dev/tty", 2, 0))) { + if (-1 != (i = open("/dev/tty", O_RDWR, 0))) { ioctl(i, TIOCNOTTY, (char *)0); close(i); } @@ -401,7 +396,7 @@ CONSENT *pCE; iNewGrp = getpid(); # endif - if (0 != open(pCE->acslave, 2, 0) || 1 != dup(0)) { + if (0 != open(pCE->acslave, O_RDWR, 0) || 1 != dup(0)) { Error( "%s: fd sync error", pCE->server); exit(1); } @@ -413,9 +408,6 @@ CONSENT *pCE; (void)ioctl(0, I_PUSH, "ptem"); (void)ioctl(0, I_PUSH, "ldterm"); # endif -# if HAVE_STTY_LD - (void)ioctl(0, I_PUSH, "stty_ld"); -# endif # if HAVE_TERMIOS_H # ifdef HAVE_TCGETATTR @@ -545,7 +537,6 @@ CONSENT *pCE; exit(1); /*NOTREACHED*/ } -#endif /* DO_VIRTUAL */ /* down a console, virtual or real (ksb) */ @@ -554,24 +545,17 @@ ConsDown(pCE, pfdSet) CONSENT *pCE; fd_set *pfdSet; { -#if DO_VIRTUAL if (-1 != pCE->ipid) { if (-1 != kill(pCE->ipid, SIGHUP)) sleep(1); pCE->ipid = -1; } -#endif if (-1 != pCE->fdtty) { FD_CLR(pCE->fdtty, pfdSet); -#if DO_VIRTUAL if (0 == pCE->fvirtual) { (void)close(pCE->fdtty); pCE->fdtty = -1; } -#else - (void)close(pCE->fdtty); - pCE->fdtty = -1; -#endif } if (-1 != pCE->fdlog) { if (pCE->nolog) { @@ -660,7 +644,6 @@ int useHostCache; return; } -#if DO_VIRTUAL if (0 != pCE->fvirtual) { /* still open, never ever close it, but set the bit */ @@ -814,17 +797,4 @@ int useHostCache; { TtyDev(pCE); } -#else /* ! DO_VIRTUAL */ - if (-1 == (pCE->fdtty = open(pCE->dfile, O_RDWR|O_NDELAY, 0600))) { - Error( "open: %s: %s", pCE->dfile, strerror(errno)); - (void)close(pCE->fdlog); - pCE->fdlog = -1; - return; - } - FD_SET(pCE->fdtty, pfdSet); - - /* ok, now setup the device - */ - TtyDev(pCE); -#endif /* DO_VIRTUAL */ } diff --git a/conserver/consent.h b/conserver/consent.h index e2e5572..01b6f02 100644 --- a/conserver/consent.h +++ b/conserver/consent.h @@ -1,5 +1,5 @@ /* - * $Id: consent.h,v 5.17 2001-02-21 17:26:06-08 bryan Exp $ + * $Id: consent.h,v 5.19 2001-06-28 11:14:30-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -71,17 +71,17 @@ typedef struct consent { /* console information */ char networkConsoleHost[MAXSERVLEN]; int networkConsolePort; -#if DO_VIRTUAL /* used if virtual console */ char acslave[MAXDEVLEN];/* pseudo-device slave side */ int fvirtual; /* is a pty device we use as a console */ char *pccmd; /* virtual console command */ int ipid; /* pid of virtual command */ -#endif + /* only used in child */ int nolog; /* don't log output */ int fdlog; /* the local log file */ int fdtty; /* the port to talk to machine on */ + int activitylog; /* log attach/detach/bump */ short int fup; /* we setup this line? */ short int fronly; /* we can only read this console */ short int iend; /* like icursor in CONSCLIENT */ diff --git a/conserver/conserver.man b/conserver/conserver.man index 150c8d0..eb60bbb 100644 --- a/conserver/conserver.man +++ b/conserver/conserver.man @@ -1,16 +1,16 @@ .\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine -.\" $Id: conserver.man,v 1.6 1999-12-01 11:55:13-08 bryan Exp $ +.\" $Id: conserver.man,v 1.11 2001-07-05 05:09:50-07 bryan Exp $ .TH CONSERVER 8 "Local" .SH NAME conserver \- console server daemon .SH SYNOPSIS -.B conserver [\-\fBdinv\fP] [\-\fBC\fP \fIconfig\fP] -.br -.B conserver [\-\fBhV\fP] +.B conserver [\-\fBdDhinsvV\fP] [\-\fBa\fP \fItype\fP] [\-\fBM\fP \fIaddr\fP] +.B [\-\fBp\fP \fIport\fP] [\-\fBC\fP \fIconfig\fP] [\-\fBP\fP \fIpasswd\fP] +.B [\-\fBL\fP \fIlogfile\fP] .SH DESCRIPTION .B Conserver is the daemon for the -.IR console (1L) +.IR console (1) program. It provides remote access to the server consoles, and logs all console data. @@ -29,19 +29,32 @@ All handling of escape sequenes is done by the server, except the suspend sequence which is sent as an out-of-band command to the client. .PP -The -.B conserver -parent process will automatically respawn any child process that dies. -If the parent process receives a SIGTERM, it will propogate the signal -to its children. +The \fBconserver\fP parent process will automatically respawn any child +process that dies. If the parent process receives a SIGTERM, it will +propagate the signal to its children, shutting everything down. The +parent will also propagate the SIGHUP and SIGUSR1 signals. A SIGHUP +will cause all the console logfiles to be closed and +then reopened (no reread of the configuration file is done). A SIGUSR1 +will cause the server to try and connect to any consoles marked as +down. This can come in handy if you had a terminal server (or more) +that wasn't accepting connections at startup and you want +\fBconserver\fP to try and reconnect to all those downed ports. .SH OPTIONS .TP +.B \-a +Set the default access type. +.TP .BI \-C config -With this option the invoker may specify an alternate confguration. -The default \fIconfig\fP is /usr/local/lib/conserver.cf. +This option points the server at a different configuration file. +The default \fIconfig\fP is set at compile time using the +--with-cffile option. .TP .B \-d -Become a daemon. +Become a daemon. Disconnects from the controlling terminal and sends +all output to the logfile specified with \fB\-L\fP. +.TP +.B \-D +Enable debugging output, sent to stderr. .TP .B \-h Output a brief help message. @@ -49,10 +62,27 @@ Output a brief help message. .B \-i Initiate console connections on demand (and close them when not used) .TP +.BI \-L logfile +This option points the server at a different logfile path. The default +\fIlogfile\fP is set at compile time using the --with-logfile option. +.TP +.BI \-M addr +Set the address to listen on. This allows conserver to bind to a +particular ip address (like `localhost') instead of all interfaces. +The default is to bind to all addresses. +.TP .B \-n The \fIconserver\fP will \fBnot\fP output unloved console output to stdout. .TP +.BI \-p port +Set the port to listen on. The default \fIport\fP is set at compile time +using the --with-port option. +.TP +.BI \-P passwd +This option points the server at a different password file. The default +\fIpasswd\fP is set at compile time using the --with-pwdfile option. +.TP .B \-v Echo the configuration as it is being read (be verbose). .TP @@ -70,6 +100,6 @@ Thomas A. Fine, Ohio State Computer Science .br Kevin S Braunsdorf, Purdue University Computing Center .br -Bryan Stansell, Global Networking and Computing, Inc. +Bryan Stansell, conserver.com .SH "SEE ALSO" -console(1L), conserver.cf(5L) +console(1), conserver.cf(5) diff --git a/conserver/fallback.c b/conserver/fallback.c index 913b8fe..5fe130c 100644 --- a/conserver/fallback.c +++ b/conserver/fallback.c @@ -1,5 +1,5 @@ /* - * $Id: fallback.c,v 5.27 2001-06-15 11:33:49-07 bryan Exp $ + * $Id: fallback.c,v 5.29 2001-06-29 00:34:11-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -35,8 +35,6 @@ #include -#if DO_VIRTUAL && ! HAVE_PTYD - #if 0 static char *__pty_host; static char *__pty_fmt; @@ -222,5 +220,3 @@ char *pcSlave, *pcMaster; (void) strcpy(pcMaster, pcTMaster); return fd; } - -#endif /* no code if it is not used */ diff --git a/conserver/group.c b/conserver/group.c index a704a57..72f7577 100644 --- a/conserver/group.c +++ b/conserver/group.c @@ -1,5 +1,5 @@ /* - * $Id: group.c,v 5.72 2001-06-15 11:33:49-07 bryan Exp $ + * $Id: group.c,v 5.89 2001-07-05 09:00:36-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -51,12 +51,6 @@ * * 4. This notice may not be removed or altered. */ -#ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1990 The Ohio State University.\n\ -@(#) Copyright 1992 Purdue Research Foundation.\n\ -All rights reserved.\n"; -#endif #include @@ -67,11 +61,13 @@ All rights reserved.\n"; #include #include #include +#include #include #include #include #include #include +#include #include @@ -84,13 +80,7 @@ All rights reserved.\n"; #include #include -#if DO_VIRTUAL -# if HAVE_PTYD -# include "local/openpty.h" -# else extern int FallBack(); -# endif /* ptyd */ -#endif /* virtual consoles */ #include @@ -126,6 +116,26 @@ char *pcEPass, *pcWord; return 0 == strcmp(pwd->pw_passwd, crypt(pcWord, pwd->pw_passwd)); } +/* This returns a string with the current time in ascii form. + * (same as ctime() but without the \n) + * optionally returns the time in time_t form (pass in NULL if you don't care). + * It's overwritten each time, so use it and forget it. + */ +char curtime[25]; + +const char * +strtime(ltime) + time_t *ltime; +{ + time_t tyme; + + tyme = time((time_t *)0); + (void)strcpy(curtime, ctime(&tyme)); + curtime[24] = '\000'; + if (ltime != NULL) *ltime = tyme; + return (const char *)curtime; +} + /* on an HUP close and re-open log files so lop can trim them (ksb) * lucky for us: log file fd's can change async from the group driver! */ @@ -203,12 +213,32 @@ FlagMark(sig) #endif } +void +tagLogfile(pCE, fmt, va_alist) +const CONSENT *pCE; +const char *fmt; +va_dcl +{ + char ac[BUFSIZ]; + char acOut[BUFSIZ]; + va_list ap; + va_start(ap); + + if ((pCE == (CONSENT *)0) || + (pCE->fdlog == -1) || + (pCE->activitylog == 0)) return; + + vsprintf(ac, fmt, ap); + sprintf(acOut, "[-- %s -- %s]\r\n", ac, strtime(NULL)); + (void)write(pCE->fdlog, acOut, strlen(acOut)); + va_end(ap); +} + static void Mark() { - time_t tyme; char acOut[BUFSIZ]; - char styme[26]; + time_t tyme; register int i; register CONSENT *pCE; @@ -216,17 +246,15 @@ Mark() return; } - tyme = time((time_t *)0); - (void)strcpy(styme, ctime(&tyme)); - styme[24] = '\000'; /* [-- MARK -- `date`] */ - sprintf(acOut, "[-- MARK -- %s]\r\n", styme); + sprintf(acOut, "[-- MARK -- %s]\r\n", strtime(&tyme)); for (i = 0, pCE = pGEHup->pCElist; i < pGEHup->imembers; ++i, ++pCE) { if (-1 == pCE->fdlog) { continue; } if ( (pCE->nextMark > 0) && (tyme >= pCE->nextMark) ) { + Debug( "[-- MARK --] stamp added to %s", pCE->lfile ); (void)write(pCE->fdlog, acOut, strlen(acOut)); pCE->nextMark = tyme + pCE->mark; } @@ -240,8 +268,6 @@ CONSENT *pCE; char *s; int len; { - time_t tyme; - char styme[26]; char acOut[BUFSIZ]; int i = 0; int j; @@ -256,24 +282,17 @@ int len; acOut[0] = '\000'; for (j=0; jnextMark)++; Debug( "Found newline for %s (nextMark=%d, mark=%d)", pCE->server, pCE->nextMark, pCE->mark ); - if (pCE->nextMark == 0) { - (void)write(pCE->fdlog, s+i, j-i+1); - i=j+1; - if ( acOut[0] == '\000' ) { - tyme = time((time_t *)0); - (void)strcpy(styme, ctime(&tyme)); - styme[24] = '\000'; - sprintf(acOut, "[%s]", styme); - } - (void)write(pCE->fdlog, acOut, strlen(acOut)); - pCE->nextMark = pCE->mark; + (void)write(pCE->fdlog, s+i, j-i+1); + i=j+1; + if ( acOut[0] == '\000' ) { + sprintf(acOut, "[%s]", strtime(NULL)); } + (void)write(pCE->fdlog, acOut, strlen(acOut)); } } - if ( i <= j ) { - (void)write(pCE->fdlog, s+i, j-i+1); + if ( i < j ) { + (void)write(pCE->fdlog, s+i, j-i); } } @@ -309,7 +328,6 @@ int sig; fSawGoAway = 1; } -#if DO_VIRTUAL /* on a TERM we have to cleanup utmp entries (ask ptyd to do it) (ksb) */ static void @@ -328,11 +346,7 @@ DeUtmp() if (-1 == pCE->fdtty || 0 == pCE->fvirtual) { continue; } -# if HAVE_PTYD - (void)closepty(pCE->acslave, pCE->dfile, OPTY_UTMP, pCE->fdlog); -# else (void)close(pCE->fdlog); -# endif } exit(0); _exit(0); @@ -367,21 +381,6 @@ int sig; } } -#else /* DO_VIRTUAL */ - -static void -GoAway() -{ - SendShutdownMsg(pGEHup); - - exit(0); - _exit(0); - abort(); -} - -#endif /* DO_VIRTUAL */ - - static char acStop[] = { /* buffer for oob stop command */ OB_SUSP, 0 }; @@ -392,7 +391,7 @@ char *pw_string; { struct passwd *pwd; FILE *fp; - char buf[100]; + char buf[BUFSIZ]; char *server, *servers, *this_pw, *user; char username[64]; /* same as acid */ #if HAVE_GETSPNAM @@ -567,8 +566,6 @@ int sfd; register int i, nr; register struct hostent *hpPeer; register long tyme; - time_t tymee; - char stymee[26]; auto CONSENT CECtl; /* our control `console' */ auto char cType; auto int maxfd, so; @@ -591,11 +588,7 @@ int sfd; */ (void)signal(SIGURG, SIG_DFL); Set_signal(SIGTERM, FlagGoAway); -#if DO_VIRTUAL Set_signal(SIGCHLD, ReapVirt); -#else - (void)signal(SIGCHLD, SIG_DFL); -#endif /* setup our local data structures and fields, and control line */ @@ -603,7 +596,6 @@ int sfd; for (iConsole = 0; iConsole < pGE->imembers; ++iConsole) { pCE[iConsole].fup = 0; pCE[iConsole].pCLon = pCE[iConsole].pCLwr = (CONSCLIENT *)0; -#if DO_VIRTUAL pCE[iConsole].fdlog = -1; if (0 == pCE[iConsole].fvirtual) { pCE[iConsole].fdtty = -1; @@ -611,16 +603,9 @@ int sfd; } /* open a pty for each vitrual console */ -# if HAVE_PTYD - pCE[iConsole].fdtty = openpty(pCE[iConsole].acslave, pCE[iConsole].dfile, OPTY_UTMP, 0); -# else /* oops, get ptyd soon */ /* we won't get a utmp entry... *sigh* */ pCE[iConsole].fdtty = FallBack(pCE[iConsole].acslave, pCE[iConsole].dfile); -# endif /* find openpty */ -#else - pCE[iConsole].fdlog = pCE[iConsole].fdtty = -1; -#endif } sprintf(CECtl.server, "ctl_%d", pGE->port); CECtl.inamelen = strlen(CECtl.server); /* bogus, of course */ @@ -686,14 +671,11 @@ int sfd; while (1) { /* check signal flags */ if (fSawGoAway) { -#if DO_VIRTUAL DeUtmp(); -#else - GoAway(); -#endif } if (fSawReOpen) { fSawReOpen = 0; + reopenLogfile(); ReOpen(); } if (fSawReUp) { @@ -725,7 +707,6 @@ int sfd; if ((nr = read(pCEServing->fdtty, acIn, sizeof(acIn))) <= 0) { /* carrier lost */ Error( "lost carrier on %s (%s)!", pCEServing->server, pCEServing->dfile); -#if DO_VIRTUAL if (pCEServing->fvirtual) { FD_CLR(pCEServing->fdtty, &rinit); pCEServing->ipid = -1; @@ -733,9 +714,6 @@ int sfd; } else { ConsInit(pCEServing, &rinit, 0); } -#else - ConsInit(pCEServing, &rinit, 0); -#endif continue; } #if CPARITY @@ -802,10 +780,7 @@ drop: * close gap in table, restart loop */ if (&CECtl != pCEServing) { - tymee = time((time_t *)0); - (void)strcpy(stymee, ctime(&tymee)); - stymee[24] = '\000'; - Info("%s: logout %s [%s]", pCEServing->server, pCLServing->acid, stymee); + Info("%s: logout %s [%s]", pCEServing->server, pCLServing->acid, strtime(NULL)); } if (fNoinit && (CONSCLIENT *)0 == pCLServing->pCEto->pCLon->pCLnext) @@ -821,6 +796,7 @@ drop: if (pCLServing->fwr) { pCLServing->fwr = 0; pCLServing->fwantwr = 0; + tagLogfile(pCEServing, "%s detached", pCLServing->acid); if (pCEServing->nolog) { pCEServing->nolog = 0; sprintf(acOut, "[Console logging restored (logout)]\r\n"); @@ -990,19 +966,17 @@ drop: if (pCLServing->fwr) { pCLServing->fwr = 0; pCLServing->fwantwr = 0; + tagLogfile(pCEServing, "%s detached", pCLServing->acid); pCEServing->pCLwr = FindWrite(pCEServing->pCLon); } /* inform operators of the change */ /* if (fVerbose) { */ - tymee = time((time_t *)0); - (void)strcpy(stymee, ctime(&tymee)); - stymee[24] = '\000'; if (&CECtl == pCEServing) { - Info("%s: login %s [%s]", pCLServing->pCEwant->server, pCLServing->acid, stymee); + Info("%s: login %s [%s]", pCLServing->pCEwant->server, pCLServing->acid, strtime(NULL)); } else { - Info("%s moves from %s to %s [%s]", pCLServing->acid, pCEServing->server, pCLServing->pCEwant->server, stymee); + Info("%s moves from %s to %s [%s]", pCLServing->acid, pCEServing->server, pCLServing->pCEwant->server, strtime(NULL)); } /* } */ @@ -1032,6 +1006,7 @@ drop: CSTROUT(pCLServing->fd, "attached]\r\n"); /* this keeps the ops console neat */ pCEServing->iend = pCEServing->inamelen; + tagLogfile(pCEServing, "%s attached", pCLServing->acid); } else { CSTROUT(pCLServing->fd, "spy]\r\n"); } @@ -1071,6 +1046,7 @@ drop: } else { CSTROUT(pCLServing->fd, " -- attached]\r\n"); } + tagLogfile(pCEServing, "%s attached", pCLServing->acid); } else { CSTROUT(pCLServing->fd, " -- spy mode]\r\n"); } @@ -1238,6 +1214,7 @@ drop: } else { sprintf(acOut, "attached]\r\n"); } + tagLogfile(pCEServing, "%s attached", pCLServing->acid); } else if (pCL == pCLServing) { if ( pCEServing->nolog ) { sprintf(acOut, "ok (nologging)]\r\n"); @@ -1256,11 +1233,9 @@ drop: if (pCEServing->isNetworkConsole) { continue; } -#if DO_VIRTUAL if (pCEServing->fvirtual) { continue; } -#endif #if HAVE_TERMIOS_H if (-1 == tcgetattr(pCEServing->fdtty, & sbuf)) { @@ -1311,6 +1286,7 @@ drop: pCLServing->fwr = 0; pCEServing->pCLwr = (CONSCLIENT *)0; + tagLogfile(pCEServing, "%s detached", pCLServing->acid); ConsDown(pCEServing, &rinit); CSTROUT(pCLServing->fd, "line down]\r\n"); @@ -1366,6 +1342,9 @@ drop: } sprintf(acNote, "\r\n[forced to `spy\' mode by %s]\r\n", pCLServing->acid); (void)write(pCL->fd, acNote, strlen(acNote)); + tagLogfile(pCEServing, "%s bumped %s", pCLServing->acid, pCL->acid); + } else { + tagLogfile(pCEServing, "%s attached", pCLServing->acid); } pCEServing->pCLwr = pCLServing; pCLServing->fwr = 1; @@ -1394,27 +1373,6 @@ drop: HelpUser(pCLServing); break; -#if HAVE_IDENTD - case 'I': /* identd auth request */ - case 'i': - CSTROUT(pCLServing->fd, "ident"); - IdentifyMe(pCLServing, pCEServing); - switch (pCLServing->caccess) { - case 'a': - CSTROUT(pCLServing->fd, " allowerd]\r\n"); - break; - case 'r': - CSTROUT(pCLServing->fd, " refused]\r\n"); - break; - case 't': - CSTROUT(pCLServing->fd, " trusted]\r\n"); - break; - default: - CSTROUT(pCLServing->fd, " failed]\r\n"); - break; - } - break; -#endif case 'L': if (pCLServing->fwr) { pCEServing->nolog = !pCEServing->nolog; @@ -1465,8 +1423,10 @@ drop: pCEServing->pCLwr = pCLServing; pCLServing->fwr = 1; sprintf(acOut, "up -- attached]\r\n"); + tagLogfile(pCEServing, "%s attached", pCLServing->acid); } else if (pCL == pCLServing) { sprintf(acOut, "up]\r\n"); + tagLogfile(pCEServing, "%s attached", pCLServing->acid); } else { sprintf(acOut, "up, %s is attached]\r\n", pCL->acid); } @@ -1501,6 +1461,7 @@ drop: break; } pCLServing->fwr = 0; + tagLogfile(pCEServing, "%s detached", pCLServing->acid); pCEServing->pCLwr = FindWrite(pCEServing->pCLon); CSTROUT(pCLServing->fd, "spying]\r\n"); break; @@ -1534,7 +1495,11 @@ drop: case 'X': CSTROUT(pCLServing->fd, "examine]\r\n"); for (iConsole = 0; iConsole < pGE->imembers; ++iConsole) { - sprintf(acOut, " %-24.24s on %-32.32s at %5.5s%c\r\n", pCE[iConsole].server, pCE[iConsole].dfile, pCE[iConsole].pbaud->acrate, pCE[iConsole].pparity->ckey); + if (pCE[iConsole].fvirtual) { + sprintf(acOut, " %-24.24s on %-32.32s at %5.5s%c\r\n", pCE[iConsole].server, pCE[iConsole].acslave, pCE[iConsole].pbaud->acrate, pCE[iConsole].pparity->ckey); + } else { + sprintf(acOut, " %-24.24s on %-32.32s at %5.5s%c\r\n", pCE[iConsole].server, pCE[iConsole].dfile, pCE[iConsole].pbaud->acrate, pCE[iConsole].pparity->ckey); + } (void)write(pCLServing->fd, acOut, strlen(acOut)); } break; @@ -1551,6 +1516,7 @@ drop: pCLServing->fwr = 0; pCLServing->fwantwr = 0; pCEServing->pCLwr = (CONSCLIENT *)0; + tagLogfile(pCEServing, "%s detached", pCLServing->acid); } break; @@ -1596,11 +1562,9 @@ drop: if (pCEServing->isNetworkConsole) { goto drop; } -#if DO_VIRTUAL if (pCEServing->fvirtual) { goto drop; } -#endif #if HAVE_TERMIOS_H if (-1 == tcgetattr(pCEServing->fdtty, & sbuf)) { @@ -1675,11 +1639,11 @@ unknown: } so = sizeof(in_port.sin_addr); if ((struct hostent *)0 == (hpPeer = gethostbyaddr((char *)&in_port.sin_addr, so, AF_INET))) { - CSTROUT(pCLFree->fd, "unknown peer name\r\n"); - (void)close(pCLFree->fd); - continue; + cType = AccType(&in_port.sin_addr, NULL); + } else { + cType = AccType(&in_port.sin_addr, hpPeer->h_name); } - if ('r' == (cType = AccType(hpPeer))) { + if ('r' == cType) { CSTROUT(pCLFree->fd, "access from your host refused\r\n"); (void)close(pCLFree->fd); continue; @@ -1692,10 +1656,14 @@ unknown: /* init the identification stuff */ - sprintf(pCL->acid, "client@%.*s", (int)(sizeof(pCL->acid)-10), hpPeer->h_name); - pCL->typetym = pCL->tym = time((time_t *)0); - (void)strcpy(pCL->actym, ctime(&(pCL->tym))); - pCL->actym[24] = '\000'; + if (hpPeer == (struct hostent *)0) { + sprintf(pCL->acid, "client@%.*s", (int)(sizeof(pCL->acid)-10), inet_ntoa(in_port.sin_addr)); + } else { + sprintf(pCL->acid, "client@%.*s", (int)(sizeof(pCL->acid)-10), hpPeer->h_name); + } + Debug( "Client acid initialized to `%s'", pCL->acid ); + (void)strcpy(pCL->actym, strtime(&(pCL->tym))); + pCL->typetym = pCL->tym; /* link into the control list for the dummy console */ @@ -1770,7 +1738,7 @@ GRPENT *pGE; (void)bzero((char *)&lstn_port, sizeof(lstn_port)); #endif lstn_port.sin_family = AF_INET; - *(u_long *)&lstn_port.sin_addr = INADDR_ANY; + *(u_long *)&lstn_port.sin_addr = bindAddr; lstn_port.sin_port = 0; /* create a socket to listen on diff --git a/conserver/group.h b/conserver/group.h index d222a02..87e38b5 100644 --- a/conserver/group.h +++ b/conserver/group.h @@ -1,5 +1,5 @@ /* - * $Id: group.h,v 5.13 2001-02-21 17:26:06-08 bryan Exp $ + * $Id: group.h,v 5.15 2001-06-28 02:05:22-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -48,3 +48,5 @@ typedef struct grpent { /* group info */ extern void Spawn(); extern int CheckPass(); +extern const char *strtime(); +extern void tagLogfile(); diff --git a/conserver/main.c b/conserver/main.c index dbc4b6e..59ac150 100644 --- a/conserver/main.c +++ b/conserver/main.c @@ -1,5 +1,5 @@ /* - * $Id: main.c,v 5.47 2001-06-15 09:04:08-07 bryan Exp $ + * $Id: main.c,v 5.56 2001-07-05 05:48:18-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -54,30 +55,44 @@ #include #include -char rcsid[] = - "$Id: main.c,v 5.47 2001-06-15 09:04:08-07 bryan Exp $"; -char *progname = - rcsid; -int fAll = 1, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fDebug = 0, fVersion = 0; +int fAll = 1, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fVersion = 0; int fDaemon = 0; char chDefAcc = 'r'; -int thepid = 0; #define FULLCFPATH SYSCONFDIR "/" CONFIGFILE; #define FULLPDPATH SYSCONFDIR "/" PASSWDFILE; +char *pcLogfile = LOGFILEPATH; char *pcConfig = FULLCFPATH; char *pcPasswd = FULLPDPATH; +char *pcPort = DEFPORT; int domainHack = 0; - -#if defined(SERVICENAME) -char acService[] = SERVICENAME; -#endif +char *pcAddress = NULL; +unsigned long bindAddr; +unsigned int bindPort; struct sockaddr_in in_port; char acMyAddr[4]; /* "\200\76\7\1" */ char acMyHost[256]; /* staff.cc.purdue.edu */ +void +reopenLogfile() +{ + /* redirect stdout and stderr to the logfile. + * + * first time through any problems will show up (stderr still there). + * after that, all bets are off...probably not see the errors (well, + * aside from the tail of the old logfile, if it was rolled). + */ + close(1); + if (1 != open(pcLogfile, O_WRONLY|O_CREAT|O_APPEND, 0644)) { + Error( "open: %s: %s", pcLogfile, strerror(errno)); + exit(1); + } + close(2); + dup(1); +} + /* become a daemon (ksb) */ static void @@ -98,6 +113,9 @@ daemonize() (void) signal(SIGTSTP, SIG_IGN); #endif + (void)fflush(stdout); + (void)fflush(stderr); + switch (res = fork()) { case -1: Error( "fork: %s", strerror(errno)); @@ -106,18 +124,19 @@ daemonize() thepid = getpid(); break; default: - sleep(1); exit(0); } /* if we read from stdin (by accident) we don't wanna block */ close(0); - if (0 != open("/dev/null", 2, 0644)) { + if (0 != open("/dev/null", O_RDWR, 0644)) { Error( "open: /dev/null: %s", strerror(errno)); exit(1); } + reopenLogfile(); + /* Further disassociate this process from the terminal * Maybe this will allow you to start a daemon from rsh, * i.e. with no controlling terminal. @@ -145,29 +164,33 @@ daemonize() } +static char u_terse[] = + " [-dDhinsvV] [-a type] [-M addr] [-p port] [-C config] [-P passwd] [-L logfile]"; static char *apcLong[] = { - "a type set the default access type", - "C config give a new config file to the server process", - "d become a daemon, output to /dev/null", - "D enable debug output, sent to stderr", - "h output this message", - "i init console connections on demand", - "n do not output summary stream to stdout", - "C passwd give a new passwd file to the server process", - "v be verbose on startup", - "V output version info", + "a type set the default access type", + "C config give a new config file to the server process", + "d become a daemon, output to logfile (see -L)", + "D enable debug output, sent to stderr", + "h output this message", + "i init console connections on demand", + "L logfile give a new logfile path to the server process", + "M addr address to listen on (all addresses by default)", + "n do not output summary stream to stdout", + "p port port to listen on", + "P passwd give a new passwd file to the server process", + "v be verbose on startup", + "V output version info", (char *)0 }; /* output a long message to the user (ksb) */ static void -Usage(fp, ppc) -FILE *fp; +Usage(ppc) char **ppc; { for (/* passed */; (char *)0 != *ppc; ++ppc) - (void)fprintf(fp, "%s\n", *ppc); + fprintf(stderr, "\t%s\n", *ppc); } /* show the user our version info (ksb) @@ -176,44 +199,46 @@ static void Version() { auto char acA1[16], acA2[16]; -#if defined(SERVICENAME) - char acOut[BUFSIZ]; -#endif + int i; + + outputPid = 0; Info("%s", THIS_VERSION); Info("default access type `%c\'", chDefAcc); Info("default escape sequence `%s%s\'", FmtCtl(DEFATTN, acA1), FmtCtl(DEFESC, acA2)); Info("configuration in `%s\'", pcConfig); Info("password in `%s\'", pcPasswd); - Info("pidfile in `%s\'", PIDFILE); + Info("logfile is `%s\'", pcLogfile); + Info("pidfile is `%s\'", PIDFILE); Info("limited to %d group%s with %d member%s", MAXGRP, MAXGRP == 1 ? "" : "s", MAXMEMB, MAXMEMB == 1 ? "" : "s"); #if CPARITY Info("high-bit of data stripped (7-bit clean)"); #else Info("high-bit of data *not* stripped (8-bit clean)"); #endif -#if defined(SERVICENAME) - { + + /* Look for non-numeric characters */ + for (i=0;pcPort[i] != '\000';i++) + if (!isdigit((int)pcPort[i])) break; + + if ( pcPort[i] == '\000' ) { + /* numeric only */ + bindPort = atoi( pcPort ); + Info("on port %u (referenced as `%s')", bindPort, pcPort); + } else { + /* non-numeric only */ struct servent *pSE; - if ((struct servent *)0 == (pSE = getservbyname(acService, "tcp"))) { - Error( "getservbyname: %s: %s", acService, strerror(errno)); - return; + if ((struct servent *)0 == (pSE = getservbyname(pcPort, "tcp"))) { + Error("getservbyname: %s: %s", pcPort, strerror(errno)); + } else { + bindPort = ntohs((u_short)pSE->s_port); + Info("on port %u (referenced as `%s')", bindPort, pcPort); } - sprintf(acOut, "service name `%s\'", pSE->s_name); - if (0 != strcmp(pSE->s_name, acService)) { - sprintf(acOut, " (which we call `%s\')", acService); - } - sprintf(acOut, " on port %d", ntohs((u_short)pSE->s_port)); - Info( "%s", acOut ); } -#else -#if defined(PORTNUMBER) - Info("on port %d", PORTNUMBER); -#else - Info("no service or port compiled in"); + + if (fVerbose) + printf(COPYRIGHT); exit(1); -#endif -#endif } /* find out where/who we are (ksb) @@ -232,13 +257,14 @@ char **argv; register int i, j; register FILE *fpConfig; auto struct hostent *hpMe; - static char acOpts[] = "a:C:dDhinP:sVv", - u_terse[] = " [-dDhinsvV] [-a type] [-C config] [-P passwd]"; + static char acOpts[] = "a:C:dDhiM:np:P:sVv"; extern int optopt; extern char *optarg; auto REMOTE *pRCUniq; /* list of uniq console servers */ + outputPid = 1; /* make sure stuff has the pid */ + thepid = getpid(); if ((char *)0 == (progname = strrchr(argv[0], '/'))) { progname = argv[0]; @@ -247,13 +273,17 @@ char **argv; } (void)setpwent(); + #if HAVE_SETLINEBUF + setlinebuf(stdout); setlinebuf(stderr); #endif #if HAVE_SETVBUF + setvbuf(stdout, NULL, _IOLBF, BUFSIZ); setvbuf(stderr, NULL, _IOLBF, BUFSIZ); #endif + (void)gethostname(acMyHost, sizeof(acMyHost)); if ((struct hostent *)0 == (hpMe = gethostbyname(acMyHost))) { Error( "gethostbyname(%s): %s", acMyHost, hstrerror(h_errno)); @@ -289,6 +319,9 @@ char **argv; case 'C': pcConfig = optarg; break; + case 'p': + pcPort = optarg; + break; case 'P': pcPasswd = optarg; break; @@ -299,12 +332,18 @@ char **argv; fDebug = 1; break; case 'h': - Error( "usage%s", u_terse); - Usage(stdout, apcLong); + fprintf(stderr, "%s: usage%s\n", progname, u_terse); + Usage(apcLong); exit(0); case 'i': fNoinit = 1; break; + case 'L': + pcLogfile = optarg; + break; + case 'M': + pcAddress = optarg; + break; case 'n': fAll = 0; break; @@ -318,7 +357,7 @@ char **argv; fVerbose = 1; break; case '\?': - Error( "usage%s", u_terse); + fprintf(stderr, "%s: usage%s\n", progname, u_terse); exit(1); default: Error( "option %c needs a parameter", optopt); @@ -331,11 +370,13 @@ char **argv; exit(0); } + if (fDaemon) { + daemonize(); + } + #if HAVE_GETSPNAM -/* Why force root??? Cause of getsp*() calls... */ if (0 != geteuid()) { - Error( "must be the superuser" ); - exit(1); + Error( "Warning: Running as a non-root user - any shadow password usage will most likely fail!" ); } #endif @@ -345,7 +386,6 @@ char **argv; Error( "fopen: %s: %s", pcConfig, strerror(errno)); exit(1); } - ReadCfg(pcConfig, fpConfig); #if HAVE_FLOCK /* we lock the configuration file so that two identical @@ -358,24 +398,48 @@ char **argv; } #endif + ReadCfg(pcConfig, fpConfig); + + if ( pcAddress == NULL ) { + bindAddr = (unsigned long)INADDR_ANY; + } else { + if ((bindAddr = inet_addr(pcAddress)) == -1) { + Error("inet_addr: %s: %s", pcAddress, "invalid IP address"); + exit(1); + } + } + Debug( "Bind address set to `%s'", inet_ntoa(*(struct in_addr *)&bindAddr) ); + + if ( pcPort == NULL ) + { + Error( "Severe error: pcPort is NULL???? How can that be?" ); + exit(1); + } + + /* Look for non-numeric characters */ + for (i=0;pcPort[i] != '\000';i++) + if (!isdigit((int)pcPort[i])) break; + + if ( pcPort[i] == '\000' ) { + /* numeric only */ + bindPort = atoi( pcPort ); + } else { + /* non-numeric only */ + struct servent *pSE; + if ((struct servent *)0 == (pSE = getservbyname(pcPort, "tcp"))) { + Debug("getservbyname: %s: %s", pcPort, strerror(errno)); + exit(1); + } else { + bindPort = ntohs((u_short)pSE->s_port); + } + } + /* if no one can use us we need to come up with a default */ if (0 == iAccess) { SetDefAccess(hpMe); } -#if HAVE_SETLINEBUF - setlinebuf(stdout); -#endif -#if HAVE_SETVBUF - setvbuf(stdout, NULL, _IOLBF, BUFSIZ); -#endif - - (void)fflush(stdout); - (void)fflush(stderr); - if (fDaemon) { - daemonize(); - } /* spawn all the children, so fix kids has an initial pid */ for (i = 0; i < MAXGRP; ++i) { @@ -411,11 +475,6 @@ char **argv; (void)fflush(stdout); (void)fflush(stderr); -/* - if (fDaemon) { - daemonize(); - } -*/ Master(pRCUniq); /* stop putting kids back, and shoot them diff --git a/conserver/main.h b/conserver/main.h index dfccbb5..57446d7 100644 --- a/conserver/main.h +++ b/conserver/main.h @@ -1,5 +1,5 @@ /* - * $Id: main.h,v 5.18 2001-06-12 19:18:58-07 bryan Exp $ + * $Id: main.h,v 5.21 2001-07-05 05:09:50-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -37,18 +37,15 @@ /* program options and stuff */ extern char rcsid[]; -extern char *progname; -extern int fAll, fVerbose, fSoftcar, fNoinit, fInteractive, fDebug; +extern int fAll, fVerbose, fSoftcar, fNoinit, fInteractive; extern char chDefAcc; +extern unsigned long bindAddr; +extern unsigned int bindPort; +extern char *pcLogfile; extern char *pcConfig; extern char *pcPasswd; extern struct sockaddr_in in_port; extern char acMyHost[]; extern char acMyAddr[]; extern int domainHack; -extern int thepid; - -#if defined(SERVICENAME) -extern char acService[]; -#endif - +extern void reopenLogfile(); diff --git a/conserver/master.c b/conserver/master.c index a0435f7..ff084c6 100644 --- a/conserver/master.c +++ b/conserver/master.c @@ -1,5 +1,5 @@ /* - * $Id: master.c,v 5.36 2001-06-15 09:12:01-07 bryan Exp $ + * $Id: master.c,v 5.42 2001-07-05 07:36:57-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -76,9 +76,7 @@ static void FixKids() { register int i, pid; - auto time_t tyme; auto int UWbuf; - char styme[26]; #if HAVE_WAIT3 while (-1 != (pid = wait3(& UWbuf, WNOHANG, (struct rusage *)0))) { @@ -103,10 +101,7 @@ FixKids() /* this kid kid is dead, start another */ Spawn(& aGroups[i]); - tyme = time((time_t *)0); - (void)strcpy(styme, ctime(&tyme)); - styme[24] = '\000'; - Info("%s: exit(%d), restarted %s", aGroups[i].pCElist[0].server, WEXITSTATUS(UWbuf), styme); + Info("%s: exit(%d), restarted %s", aGroups[i].pCElist[0].server, WEXITSTATUS(UWbuf), strtime(NULL)); } } } @@ -152,7 +147,7 @@ SignalKids(arg) if (0 == aGroups[i].imembers) continue; if (-1 == kill(aGroups[i].pid, arg)) { - Error("%s: kill: %s", strerror(errno)); + Error("kill: %s", strerror(errno)); } } } @@ -194,40 +189,25 @@ REMOTE (void)bzero((char *)&master_port, sizeof(master_port)); #endif master_port.sin_family = AF_INET; - *(u_long *)&master_port.sin_addr = INADDR_ANY; -#if defined(SERVICENAME) - { - struct servent *pSE; - if ((struct servent *)0 == (pSE = getservbyname(acService, "tcp"))) { - Error("%s: getservbyname: %s: %s", acService, strerror(errno)); - return; - } - master_port.sin_port = pSE->s_port; - } -#else -# if defined(PORTNUMBER) - master_port.sin_port = htons((u_short)PORTNUMBER); -# else - Error("%s: no port or service compiled in?"); -# endif -#endif + *(u_long *)&master_port.sin_addr = bindAddr; + master_port.sin_port = htons(bindPort); if ((msfd=socket(AF_INET, SOCK_STREAM, 0)) < 0) { - Error("%s: socket: %s", strerror(errno)); + Error("socket: %s", strerror(errno)); return; } #if HAVE_SETSOCKOPT if (setsockopt(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true, sizeof(true))<0) { - Error("%s: setsockopt: %s", strerror(errno)); + Error("setsockopt: %s", strerror(errno)); return; } #endif if (bind(msfd, (struct sockaddr *)&master_port, sizeof(master_port))<0) { - Error("%s: bind: %s", strerror(errno)); + Error("bind: %s", strerror(errno)); return; } if (listen(msfd, SOMAXCONN) < 0) { - Error("%s: listen: %s", strerror(errno)); + Error("listen: %s", strerror(errno)); } FD_ZERO(&rmaster); @@ -239,6 +219,7 @@ REMOTE } if (fSawHUP) { fSawHUP = 0; + reopenLogfile(); SignalKids(SIGHUP); } if (fSawUSR1) { @@ -250,7 +231,7 @@ REMOTE if (-1 == select(msfd+1, &rmask, (fd_set *)0, (fd_set *)0, (struct timeval *)0)) { if ( errno != EINTR ) { - Error("%s: select: %s", strerror(errno)); + Error("select: %s", strerror(errno)); } continue; } @@ -260,7 +241,7 @@ REMOTE so = sizeof(response_port); cfd = accept(msfd, (struct sockaddr *)&response_port, (socklen_t *)&so); if (cfd < 0) { - Error("%s: accept: %s", strerror(errno)); + Error("accept: %s", strerror(errno)); continue; } @@ -273,11 +254,11 @@ REMOTE } so = sizeof(in_port.sin_addr); if ((struct hostent *)0 == (hpPeer = gethostbyaddr((char *)&in_port.sin_addr, so, AF_INET))) { - CSTROUT(cfd, "unknown peer name\r\n"); - (void)close(cfd); - continue; + cType = AccType(&in_port.sin_addr, NULL); + } else { + cType = AccType(&in_port.sin_addr, hpPeer->h_name); } - if ('r' == (cType = AccType(hpPeer))) { + if ('r' == cType) { CSTROUT(cfd, "access from your host refused\r\n"); (void)close(cfd); continue; @@ -322,7 +303,7 @@ REMOTE acIn[--i] = '\000'; } if (0 == i) { - Error("%s: lost connection"); + Error("lost connection"); (void)close(cfd); #if TEST_FORK exit(1); diff --git a/conserver/output.c b/conserver/output.c index 2dcc51a..b5b1207 100644 --- a/conserver/output.c +++ b/conserver/output.c @@ -1,5 +1,5 @@ /* - * $Id: output.c,v 1.5 2001-06-15 07:16:51-07 bryan Exp $ + * $Id: output.c,v 1.6 2001-07-05 00:09:39-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -8,9 +8,13 @@ #include #include -#include #include +int outputPid = 0; +char *progname = "conserver package"; +int thepid = 0; +int fDebug = 0; + void Debug(fmt, va_alist) char *fmt; va_dcl @@ -18,7 +22,10 @@ va_dcl va_list ap; va_start(ap); if (!fDebug) return; - fprintf(stderr, "%s (%d): DEBUG: ", progname, thepid ); + if (outputPid) + fprintf(stderr, "%s (%d): DEBUG: ", progname, thepid); + else + fprintf(stderr, "%s: DEBUG: ", progname); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n" ); va_end(ap); @@ -30,7 +37,10 @@ va_dcl { va_list ap; va_start(ap); - fprintf(stderr, "%s (%d): ", progname, thepid ); + if (outputPid) + fprintf(stderr, "%s (%d): ", progname, thepid); + else + fprintf(stderr, "%s: ", progname); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n" ); va_end(ap); @@ -42,7 +52,10 @@ va_dcl { va_list ap; va_start(ap); - fprintf(stdout, "%s (%d): ", progname, thepid ); + if (outputPid) + fprintf(stdout, "%s (%d): ", progname, thepid); + else + fprintf(stdout, "%s: ", progname); vfprintf(stdout, fmt, ap); fprintf(stdout, "\n" ); va_end(ap); diff --git a/conserver/output.h b/conserver/output.h index dd9e0b0..9ef3d5f 100644 --- a/conserver/output.h +++ b/conserver/output.h @@ -1,5 +1,5 @@ /* - * $Id: output.h,v 1.1 2001-06-14 09:28:05-07 bryan Exp $ + * $Id: output.h,v 1.2 2001-07-05 00:09:39-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -9,3 +9,6 @@ extern void Debug(); extern void Error(); extern void Info(); +extern int outputPid, fDebug; +extern char *progname; +extern int thepid; diff --git a/conserver/port.h b/conserver/port.h index 8a3e7e6..731413b 100644 --- a/conserver/port.h +++ b/conserver/port.h @@ -1,5 +1,5 @@ /* - * $Id: port.h,v 1.21 2001-02-21 17:26:06-08 bryan Exp $ + * $Id: port.h,v 1.26 2001-07-05 00:14:06-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -59,26 +59,6 @@ # define MAXREPLAY (80*25) #endif -/* the console server will provide a pseudo-device console which - * allows operators to run backups and such without a hard wired - * line (this is also good for testing the server to see if you - * might wanna use it). Turn this on only if you (might) need it. - */ -#if !defined(DO_VIRTUAL) -# define DO_VIRTUAL 1 -#endif - -#if DO_VIRTUAL -/* if the virtual console option is on we need a source to ptys, - * the PUCC ptyd daemon is the best source be know, else fall back - * on some emulation code?? (XXX) - */ -#if !defined(HAVE_PTYD) -# define HAVE_PTYD (defined(S81)||defined(VAX8800)) -#endif - -#endif /* virtual (process on a pseudo-tty) console support */ - /* communication constants */ #define OB_SUSP 'Z' /* suspended by server */ @@ -110,3 +90,16 @@ extern int shut_up_lint; write(Mfd, _ac, sizeof(_ac)-1); \ } while (shut_up_lint) +/* For legacy compile-time setting of the port... + */ +#if ! defined(DEFPORT) +# if defined(SERVICENAME) +# define DEFPORT SERVICENAME +# else +# if defined(PORTNUMBER) +# define DEFPORT PORTNUMBER +# else +# define DEFPORT "conserver" +# endif +# endif +#endif diff --git a/conserver/readcfg.c b/conserver/readcfg.c index f67f9e8..ac90c3e 100644 --- a/conserver/readcfg.c +++ b/conserver/readcfg.c @@ -1,5 +1,5 @@ /* - * $Id: readcfg.c,v 5.35 2001-06-15 09:04:41-07 bryan Exp $ + * $Id: readcfg.c,v 5.45 2001-07-05 09:06:52-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -57,7 +57,6 @@ #include #include - GRPENT aGroups[MAXGRP]; /* even spread is OK */ CONSENT @@ -72,6 +71,122 @@ ACCESS int iAccess; /* how many access restrictions we have */ +/* Parse the [number(m|h|d|l)[a]] spec + * return 0 on invalid spec, non-zero on valid spec + */ +int +parseMark(pcFile, iLine, pcMark, tyme, pCE) +const char *pcFile; +const int iLine; +const char *pcMark; +CONSENT *pCE; +{ + char mark[BUFSIZ]; + char *p, *n = (char *)0; + int activity = 0; + int factor = 0, pfactor = 0; + int value = 0, pvalue = 0; + + if ((pcMark == (char *)0) || + (*pcMark == '\000')) + return 0; + (void)strcpy(mark, pcMark); + + for (p = mark; *p != '\000'; p++) { + if ( *p == 'a' || *p == 'A' ) { + if ( n != (char *)0 ) { + Error( "%s(%d) bad timestamp specification `%s': numeral before `a' (ignoring numeral)", pcFile, iLine, pcMark); + } + activity = 1; + } else if ( *p == 'm' || *p == 'M' ) { + pfactor = 60; + } else if ( *p == 'h' || *p == 'H' ) { + pfactor = 60 * 60; + } else if ( *p == 'd' || *p == 'D') { + pfactor = 60 * 60 * 24; + } else if ( *p == 'l' || *p == 'L') { + pfactor = -1; + } else if ( isdigit((int)*p) ) { + if ( n == (char *)0 ) + n = p; + } else { + Error( "%s(%d) bad timestamp specification `%s': unknown character `%c'", pcFile, iLine, pcMark, *p); + return 0; + } + if ( pfactor ) { + if ( n == (char *)0 ) { + Error( "%s(%d) bad timestamp specification `%s': missing numeric prefix for `%c'", pcFile, iLine, pcMark, *p); + return 0; + } else { + *p = '\000'; + pvalue = atoi(n); + if ( pvalue < 0 ) { + Error( "%s(%d) negative timestamp specification `%s'", pcFile, iLine, pcMark); + return 0; + } + n = (char *)0; + factor = pfactor; + value = pvalue * pfactor; + pvalue = pfactor = 0; + } + } + } + + Debug( "Mark spec of `%s' parsed: factor=%d, value=%d, activity=%d", pcMark, factor, value, activity ); + + if (pCE != (CONSENT *)0) { + pCE->activitylog = activity; + if ( factor && value ) { + pCE->mark = value; + if ( factor > 0 ) { + pCE->nextMark = tyme + value; + } else { + pCE->nextMark = value; + } + } else { + pCE->nextMark = pCE->mark = 0; + } + } + + return factor; +} + +/* replace trailing space with '\000' in a string and return + * a pointer to the start of the non-space part + */ +char * +pruneSpace( string ) +char *string; +{ + char *p; + char *head = (char *)0; + char *tail = (char *)0; + + /* Don't do much if it's crap */ + if ( string == (char *)0 || *string == '\000' ) + return string; + + /* Now for the tricky part - search the string */ + for (p = string; *p != '\000'; p++) { + if (isspace((int)(*p))) { + if (tail == (char *)0) + tail = p; /* possible end of string */ + } else { + if (head == (char *)0) + head = p; /* found the start */ + tail = (char *)0; /* reset tail */ + } + } + + if (tail != (char *)0) + *tail = '\000'; + + if (head != (char *)0) + return head; + else + return string; +} + /* read in the configuration file, fill in all the structs we use (ksb) * to manage the consoles */ @@ -84,11 +199,13 @@ register FILE *fp; register int iG, minG; auto int iLine; auto char acIn[BUFSIZ]; + char *acStart; register GRPENT *pGEAll; register CONSENT *pCE; register REMOTE **ppRC; char LogDirectory[MAXLOGLEN]; time_t tyme; + char defMark[BUFSIZ]; tyme = time((time_t *)0); LogDirectory[0] = '\000'; @@ -103,33 +220,35 @@ register FILE *fp; register char *pcLine, *pcMode, *pcLog, *pcRem, *pcStart, *pcMark; ++iLine; - for (pcRem = acIn+strlen(acIn)-1; pcRem >= acIn; --pcRem) { - if (!isspace((int)(*pcRem))) - break; - *pcRem = '\000'; - if (pcRem == acIn) - break; - } - if ('#' == acIn[0] || '\000' == acIn[0]) { + + acStart = pruneSpace( acIn ); + + if ('#' == acStart[0] || '\000' == acStart[0]) { continue; } - if ('%' == acIn[0] && '%' == acIn[1] && '\000' == acIn[2]) { + if ('%' == acStart[0] && '%' == acStart[1] && '\000' == acStart[2]) { break; } - if ( (char *)0 == strchr(acIn, ':') && - (char *)0 != (pcLine = strchr(acIn, '=')) ) { - *pcLine = '\000'; - if ( 0 == strcmp(acIn, "LOGDIR") ) { - (void)strcpy(LogDirectory, ++pcLine); - } else if ( 0 == strcmp(acIn, "DOMAINHACK") ) { + if ( (char *)0 == strchr(acStart, ':') && + (char *)0 != (pcLine = strchr(acStart, '=')) ) { + *pcLine++ = '\000'; + acStart = pruneSpace( acStart ); + pcLine = pruneSpace( pcLine ); + if ( 0 == strcmp(acStart, "LOGDIR") ) { + (void)strcpy(LogDirectory, pcLine); + } else if ( 0 == strcmp(acStart, "TIMESTAMP") ) { + if ( parseMark(pcFile, iLine, pcLine, tyme, NULL) ) + (void)strcpy(defMark, pcLine); + else + defMark[0] = '\000'; + } else if ( 0 == strcmp(acStart, "DOMAINHACK") ) { domainHack = 1; } else { - *pcLine = '='; - Error( "%s(%d) bad variable line `%s'", pcFile, iLine, acIn); + Error( "%s(%d) unknown variable `%s'", pcFile, iLine, acStart); } continue; } - if ( (char *)0 == (pcLine = strchr(acIn, ':')) || + if ( (char *)0 == (pcLine = strchr(acStart, ':')) || (char *)0 == (pcMode = strchr(pcLine+1, ':')) || (char *)0 == (pcLog = strchr(pcMode+1, ':'))) { Error( "%s(%d) bad config line `%s'", pcFile, iLine, acIn); @@ -139,8 +258,14 @@ register FILE *fp; *pcMode++ = '\000'; *pcLog++ = '\000'; + acStart = pruneSpace( acStart ); + pcLine = pruneSpace( pcLine ); + pcMode = pruneSpace( pcMode ); + pcLog = pruneSpace( pcLog ); + if ((char *)0 != (pcMark = strchr(pcLog, ':'))) { *pcMark++ = '\000'; + pcMark = pruneSpace( pcMark ); /* Skip null intervals */ if ( pcMark[0] == '\000' ) pcMark = (char *)0; } @@ -154,6 +279,8 @@ register FILE *fp; auto struct hostent *hpMe; *pcRem++ = '\000'; + pcLine = pruneSpace( pcLine ); + pcRem = pruneSpace( pcRem ); if ((struct hostent *)0 == (hpMe = gethostbyname(pcRem))) { @@ -181,11 +308,11 @@ register FILE *fp; exit(32); } (void)strcpy(pRCTemp->rhost, pcRem); - (void)strcpy(pRCTemp->rserver, acIn); + (void)strcpy(pRCTemp->rserver, acStart); *ppRC = pRCTemp; ppRC = & pRCTemp->pRCnext; if (fVerbose) { - Info("%s remote on %s", acIn, pcRem); + Info("%s remote on %s", acStart, pcRem); } continue; } @@ -215,7 +342,7 @@ register FILE *fp; Error( "%s(%d) %d is too many consoles for hard coded tables, adjust MAXGRP or MAXMEMB", pcFile, iLine, iLocal); exit(1); } - (void)strcpy(pCE->server, acIn); + (void)strcpy(pCE->server, acStart); /* * Here we substitute the console name for any '&' character in the @@ -227,7 +354,7 @@ register FILE *fp; while ((char *)0 != (pcRem = strchr(pcStart, '&'))) { *pcRem = '\000'; (void)strcat(pCE->lfile, pcStart); - (void)strcat(pCE->lfile, acIn); + (void)strcat(pCE->lfile, acStart); pcStart = pcRem + 1; } (void)strcat(pCE->lfile, pcStart); @@ -240,41 +367,11 @@ register FILE *fp; } if ( pcMark ) { - int factor = 0; - char *p; - p = pcMark + strlen(pcMark) - 1; - if ( *p == 'm' || *p == 'M' ) { - factor = 60; - } else if ( *p == 'h' || *p == 'H' ) { - factor = 60 * 60; - } else if ( *p == 'd' || *p == 'D') { - factor = 60 * 60 * 24; - } else if ( *p == 'l' || *p == 'L') { - factor = -1; - } else { - Error( "%s(%d) bad mark specification `%s'", pcFile, iLine, pcMark); - pcMark = 0; - } - if ( factor ) { - *p = '\000'; - pCE->mark = atoi(pcMark); - if ( pCE->mark < 0 ) { - Error( "%s(%d) negative mark specification `%s'", pcFile, iLine, pcMark); - pcMark = 0; - } - pCE->mark = pCE->mark * factor; - if ( factor > 0 ) { - pCE->nextMark = tyme + pCE->mark; - } else { - pCE->nextMark = pCE->mark; - } - } - } - if ( !pcMark ) { - pCE->nextMark = pCE->mark = 0; + (void)parseMark(pcFile, iLine, pcMark, tyme, pCE); + } else { + (void)parseMark(pcFile, iLine, defMark, tyme, pCE); } -#if DO_VIRTUAL if (pcLine[0] == '!') { pCE->isNetworkConsole = 1; @@ -282,8 +379,8 @@ register FILE *fp; pCE->networkConsolePort = atoi(pcMode); if (fVerbose) { - Info("%d: %s is network on %s/%d logged to %s", - iG, acIn, pCE->networkConsoleHost, + Info("%s is network on %s/%d logged to %s", + acStart, pCE->networkConsoleHost, pCE->networkConsolePort, pCE->lfile); } pCE->fvirtual = 0; @@ -299,19 +396,13 @@ register FILE *fp; } (void)strcpy(pCE->pccmd, pcLine+1); (void)strcpy(pCE->dfile, "/dev/null"); + (void)strcpy(pCE->acslave, "/dev/null"); } else { pCE->isNetworkConsole = 0; pCE->fvirtual = 0; (void)strcpy(pCE->dfile, pcLine); } pCE->ipid = -1; -#else - if ('|' == pcLine[0]) { - Error( "%s(%d) this server doesn't provide any virtual console support", pcFile, iLine); - exit(9); - } - (void)strcpy(pCE->dfile, pcLine); -#endif if (!pCE->isNetworkConsole) { @@ -321,12 +412,10 @@ register FILE *fp; pCE->pbaud = FindBaud(pcMode); pCE->pparity = FindParity(pcMode); if (fVerbose) { -#if DO_VIRTUAL if (pCE->fvirtual) - Info("%d: %s with command `%s' logged to %s", iG, acIn, pCE->pccmd, pCE->lfile); + Info("%s with command `%s' logged to %s", acStart, pCE->pccmd, pCE->lfile); else -#endif - Info("%d: %s is on %s (%s%c) logged to %s", iG, acIn, pCE->dfile, pCE->pbaud->acrate, pCE->pparity->ckey, pCE->lfile); + Info("%s is on %s (%s%c) logged to %s", acStart, pCE->dfile, pCE->pbaud->acrate, pCE->pparity->ckey, pCE->lfile); } } ++pCE, ++iLocal; @@ -338,32 +427,30 @@ register FILE *fp; iG = iAccess = 0; pACList = (ACCESS *)0; while (fgets(acIn, sizeof(acIn)-1, fp) != NULL) { - register char *pcRem, *pcMach, *pcNext, *pcMem; + register char *pcMach, *pcNext, *pcMem; auto char cType; auto int iLen; ++iLine; - for (pcRem = acIn+strlen(acIn)-1; pcRem >= acIn; --pcRem) { - if (!isspace((int)(*pcRem))) - break; - *pcRem = '\000'; - if (pcRem == acIn) - break; - } - if ('#' == acIn[0] || '\000' == acIn[0]) { + + acStart = pruneSpace( acIn ); + + if ('#' == acStart[0] || '\000' == acStart[0]) { continue; } - if ('%' == acIn[0] && '%' == acIn[1] && '\000' == acIn[2]) { + if ('%' == acStart[0] && '%' == acStart[1] && '\000' == acStart[2]) { break; } - if ((char *)0 == (pcNext = strchr(acIn, ':'))) { + if ((char *)0 == (pcNext = strchr(acStart, ':'))) { Error( "%s(%d) missing colon?", pcFile, iLine); exit(3); } + do { *pcNext++ = '\000'; } while (isspace((int)(*pcNext))); - switch (acIn[0]) { + + switch (acStart[0]) { case 'a': /* allowed, allow, allows */ case 'A': cType = 'a'; @@ -377,7 +464,7 @@ register FILE *fp; cType = 't'; break; default: - Error( "%s(%d) unknown access key `%s\'", pcFile, iLine, acIn); + Error( "%s(%d) unknown access key `%s\'", pcFile, iLine, acStart); exit(3); } while ('\000' != *(pcMach = pcNext)) { diff --git a/conserver/stamper.sh b/conserver/stamper.sh deleted file mode 100644 index 6f15c8d..0000000 --- a/conserver/stamper.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# $Id: stamper.sh,v 4.1 91/06/19 14:40:46 ksb Exp $ -# -# The outputs a time stamp once an hour (on the hour, we hope). -# We take a list of logfiles to stamp -# -PROGNAME=`basename $0 .sh` -if [ "$#" -eq 0 ] -then - echo "$PROGNAME: usage files" 1>&2 - exit 1 -fi - -# sleep until the top of the hour -# output a mark on each log file -# sleep for nearly an hour -while true -do - ( - IFS="$IFS:" - - # _ Wed Jun 19 14:31:02 EST 1991 - # $1 $2 $3 $4 $5 $6 $7 $8 $9 - set _ `date` - - #sleep `expr 3600 - \( $6 \* 60 + $7 \)` - ) - - mark="[-- MARK -- `date`]" - for file - do - if [ _"-" = _"$file" ] - then - echo "$mark" - else - echo "$mark" >>$file - fi - done - - sleep 3530 -done - -# NOTREACHED -exit 0 diff --git a/conserver/version.h b/conserver/version.h index 3f0cddf..d3dee17 100644 --- a/conserver/version.h +++ b/conserver/version.h @@ -1,5 +1,5 @@ /* - * $Id: version.h,v 1.23 2001-06-15 09:34:40-07 bryan Exp $ + * $Id: version.h,v 1.25 2001-07-05 08:08:49-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -8,4 +8,10 @@ * Copyright GNAC, Inc., 1998 */ -#define THIS_VERSION "conserver.com version 7.0.2" +#define COPYRIGHT "@(#) Copyright 1990 The Ohio State University.\n\ +@(#) Copyright 1992 Purdue Research Foundation.\n\ +@(#) Copyright 1998 GNAC, Inc.\n\ +@(#) Copyright 2000 conserver.com.\n\ +All rights reserved.\n" + +#define THIS_VERSION "conserver.com version 7.0.3" diff --git a/console/INSTALL.old b/console/INSTALL.old deleted file mode 100644 index 0138f09..0000000 --- a/console/INSTALL.old +++ /dev/null @@ -1,35 +0,0 @@ -# $Id: INSTALL,v 4.1 91/06/19 15:27:49 ksb Exp $ -# - -Prep: - - Did you do the prep work in ../conserver yet? If not please start there. - - -Compiling: - - Try a - make - in this directory. If cons.h is correct this should just compile. - - -First test: - - Run a version command: - ./console -V - and see something like: - console: $Id: INSTALL,v 4.1 91/06/19 15:27:49 ksb Exp $ - console: initial master server `staff.cc.purdue.edu' - console: default escape sequence `^Ec' - console: loopback address for mentor.cc.purdue.edu is 127.0.0.1 - - - Finish the INSTALL in conserver now. - - -Connect to the conserver on your dumb port, - - Try all the commands. Especially ^Ecz and ^Ecd/^Eco. - - Try two connections to the same console, note the cool way you can force - the other guy off (^Ecf). diff --git a/console/Makefile.in b/console/Makefile.in index 05e0a61..919c32f 100644 --- a/console/Makefile.in +++ b/console/Makefile.in @@ -25,7 +25,7 @@ LIBS = @LIBS@ ### Makefile rules - no user-servicable parts below -CONSOLE_OBJS = console.o +CONSOLE_OBJS = console.o ../conserver/output.o CONSOLE_HDRS = ../config.h $(top_srcdir)/compat.h $(top_srcdir)/conserver/port.h ALL = console @@ -37,6 +37,9 @@ all: $(ALL) console: $(CONSOLE_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS) +../conserver/output.o: + ( cd ../conserver && $(MAKE) $(MAKE_FLAGS) output.o ) || exit 1; + .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< diff --git a/console/README.old b/console/README.old deleted file mode 100644 index c99e121..0000000 --- a/console/README.old +++ /dev/null @@ -1,67 +0,0 @@ -# $Id: README,v 4.2 92/07/27 08:47:14 ksb Exp $ - -BUGS: - This program depends on a header file in ../conserver/cons.h, - which is dones't know how to make. - -What does it do? - - The console switch (conserver) uses some tty ports on a `switch machine' to - read the output of many host machines. Admins can use a client program - (console) to connect to any console under control of the `switch'. Thus from - my terminal here on the second floor I can control the console for each of - the machines in the machine room 3 floors below me! - - The `switch' host is monitored by an operator who sees all the error output - from all the consoles (in a xterm here at PUCC). This operator can call up a - console on any machine in a flash and respond to problems. He is aware of - problems without having to poll many CRTs stacked out in the machine room -- - he and the tape drives can be in a quiet place. - - -What platforms? - - It runs under 4.2/4.3bsd, IBM's AIX6000, SunOS 4.X, and HPUX. - Only the client runs under HPUX at this release. It depends on - select(2) and sockets. - - -What do I need to evaluate it? - - I believe a modem could be used in a pinch as a `host', anything that you can - trick into producing tty I/O. Even a dumb tty, but then you must do the - echo. Another port on the same machine was used for testing at one point... - and an EPROM programmer might even work. - - -Who would be interested in this kind of thing? - - Anyone with more than one machine with a glass tty would love it, it also - gets rid of the need for paper consoles. - - -Is this software restricted in distribution? - - Tom has an Ohio State copyright on the stuff, I'm sure that there will be no - problem with distribution. {He ripped the Purdue ECN copyright off the code - he got, I didn't change his.} Tom has not replied to any of my email in ~3 - months.... - - -Why this version rather than any other? - - The PUCC version supports many more features (multiple `switch' machines for - when you run out of ports; job control; down'd consoles, etc) than either the - Ohio State or Purdue ECN versions. - - -How much trouble is it to port? - - The code is ~2000 lines for the server and ~1150 for the client. Not too - hard to read in ~3 hours. It should work with a little push on any BSD type - UNIX. - - --- -"When you find me here, at the end of my rope!" -kayessbee, Kevin Braunsdorf, ksb@cc.purdue.edu, pur-ee!ksb, purdue!ksb diff --git a/console/console.c b/console/console.c index 2a7c777..42f76df 100644 --- a/console/console.c +++ b/console/console.c @@ -1,5 +1,5 @@ /* - * $Id: console.c,v 5.39 2001-06-15 08:53:48-07 bryan Exp $ + * $Id: console.c,v 5.44 2001-07-05 02:15:04-07 bryan Exp $ * * Copyright conserver.com, 2000-2001 * @@ -44,16 +44,15 @@ #include #include +#include -static char rcsid[] = - "$Id: console.c,v 5.39 2001-06-15 08:53:48-07 bryan Exp $"; -static char *progname = - rcsid; -int fVerbose = 0, fReplay = 0, fRaw = 0; +int fVerbose = 0, fReplay = 0, fRaw = 0, fVersion = 0; int chAttn = -1, chEsc = -1; char *pcInMaster = /* which machine is current */ MASTERHOST; +char *pcPort = DEFPORT; +unsigned int bindPort; /* panic -- we have no more momory */ @@ -133,13 +132,15 @@ static char *apcLong[] = { "h output this message", "l user use username instead of current username", "M mach master server to poll first", + "p port port to connect to", + "P display pids of daemon(s)", "q(Q) send a quit command to the (local) server", "r connect to the console group only", "s(S) spy on a console (and replay)", - "u show users on the various consoles", + "u(U) show users on the various consoles", "v be more verbose", "V show version information", - "w show who is on which console", + "w(W) show who is on which console", "x examine ports and baud rates", (char *)0 }; @@ -147,12 +148,11 @@ static char *apcLong[] = { /* output a long message to the user */ static void -Usage(fp, ppc) -FILE *fp; +Usage(ppc) char **ppc; { for (/* passed */; (char *)0 != *ppc; ++ppc) - (void)fprintf(fp, "%s\n", *ppc); + fprintf(stderr, "\t%s\n", *ppc); } /* expain who we are and which revision we are (ksb) @@ -160,16 +160,34 @@ char **ppc; static void Version() { -/* register unsigned char *puc; */ + int i; - printf("%s: %s\n", progname, THIS_VERSION); - printf("%s: initial master server `%s\'\n", progname, pcInMaster); + Info("%s", THIS_VERSION); + Info("initial master server `%s\'", pcInMaster); printf("%s: default escape sequence `", progname); putCtlc(DEFATTN, stdout); putCtlc(DEFESC, stdout); printf("\'\n"); -/* puc = (unsigned char *)&local_port.sin_addr; - printf("%s: loopback address for %s is %d.%d.%d.%d\n", progname, acMyName, puc[0], puc[1], puc[2], puc[3]); */ + /* Look for non-numeric characters */ + for (i=0;pcPort[i] != '\000';i++) + if (!isdigit((int)pcPort[i])) break; + + if ( pcPort[i] == '\000' ) { + /* numeric only */ + bindPort = atoi( pcPort ); + Info("on port %u (referenced as `%s')", bindPort, pcPort); + } else { + /* non-numeric only */ + struct servent *pSE; + if ((struct servent *)0 == (pSE = getservbyname(pcPort, "tcp"))) { + Error("getservbyname: %s: %s", pcPort, strerror(errno)); + } else { + bindPort = ntohs((u_short)pSE->s_port); + Info("on port %u (referenced as `%s')", bindPort, pcPort); + } + } + if (fVerbose) + printf(COPYRIGHT); } @@ -232,11 +250,11 @@ char *pcText; pcTemp = pcText; if (ParseChar(&pcTemp, &c1) || ParseChar(&pcTemp, &c2)) { - fprintf(stderr, "%s: poorly formed escape sequence `%s\'\n", progname, pcText); + Error("poorly formed escape sequence `%s\'", pcText); exit(3); } if ('\000' != *pcTemp) { - fprintf(stderr, "%s: too many characters in new escape sequence at ...`%s\'\n", progname, pcTemp); + Error("too many characters in new escape sequence at ...`%s\'", pcTemp); exit(3); } chAttn = c1; @@ -279,7 +297,7 @@ short sPort; (void)bcopy((char *)hp->h_addr, (char *)&pPort->sin_addr, hp->h_length); #endif } else { - fprintf(stderr, "%s: gethostbyname: %s: %s\n", progname, pcToHost, hstrerror(h_errno)); + Error("gethostbyname: %s: %s", pcToHost, hstrerror(h_errno)); exit(9); } pPort->sin_port = sPort; @@ -300,11 +318,11 @@ short sPort; * (it will tell us who to talk to to get a real connection) */ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - fprintf(stderr, "%s: socket: %s\n", progname, strerror(errno)); + Error("socket: %s", strerror(errno)); exit(1); } if (connect(s, (struct sockaddr *)pPort, sizeof(*pPort)) < 0) { - fprintf(stderr, "%s: connect: %d@%s: %s\n", progname, ntohs(pPort->sin_port), pcToHost, strerror(errno)); + Error("connect: %d@%s: %s", ntohs(pPort->sin_port), pcToHost, strerror(errno)); exit(1); } @@ -359,7 +377,7 @@ c2raw() if (0 != ioctl(0, TCGETS, & o_tios)) # endif { - fprintf(stderr, "%s: iotcl: getsw: %s\n", progname, strerror(errno)); + Error("iotcl: getsw: %s", strerror(errno)); exit(10); } n_tios = o_tios; @@ -374,13 +392,13 @@ c2raw() if (0 != ioctl(0, TCSETS, & n_tios)) # endif { - fprintf(stderr, "%s: getarrt: %s\n", progname, strerror(errno)); + Error("getarrt: %s", strerror(errno)); exit(10); } #else # ifdef HAVE_TERMIO_H if (0 != ioctl(0, TCGETA, & o_tio)) { - fprintf(stderr, "%s: iotcl: geta: %s\n", progname, strerror(errno)); + Error("iotcl: geta: %s", strerror(errno)); exit(10); } n_tio = o_tio; @@ -390,12 +408,12 @@ c2raw() n_tio.c_cc[VMIN] = 1; n_tio.c_cc[VTIME] = 0; if (0 != ioctl(0, TCSETAF, & n_tio)) { - fprintf(stderr, "%s: iotcl: seta: %s\n", progname, strerror(errno)); + Error("iotcl: seta: %s", strerror(errno)); exit(10); } # else if (0 != ioctl(0, TIOCGETP, (char *)&o_sty)) { - fprintf(stderr, "%s: iotcl: getp: %s\n", progname, strerror(errno)); + Error("iotcl: getp: %s", strerror(errno)); exit(10); } n_sty = o_sty; @@ -405,25 +423,25 @@ c2raw() n_sty.sg_kill = -1; n_sty.sg_erase = -1; if (0 != ioctl(0, TIOCSETP, (char *)&n_sty)) { - fprintf(stderr, "%s: iotcl: setp: %s\n", progname, strerror(errno)); + Error("iotcl: setp: %s", strerror(errno)); exit(10); } /* stty undef all tty chars */ if (-1 == ioctl(0, TIOCGETC, (char *)&n_tchars)) { - fprintf(stderr, "%s: ioctl: getc: %s\n", progname, strerror(errno)); + Error("ioctl: getc: %s", strerror(errno)); return; } o_tchars = n_tchars; n_tchars.t_intrc = -1; n_tchars.t_quitc = -1; if (-1 == ioctl(0, TIOCSETC, (char *)&n_tchars)) { - fprintf(stderr, "%s: ioctl: setc: %s\n", progname, strerror(errno)); + Error("ioctl: setc: %s", strerror(errno)); return; } if (-1 == ioctl(0, TIOCGLTC, (char *)&n_ltchars)) { - fprintf(stderr, "%s: ioctl: gltc: %s\n", progname, strerror(errno)); + Error("ioctl: gltc: %s", strerror(errno)); return; } o_ltchars = n_ltchars; @@ -432,7 +450,7 @@ c2raw() n_ltchars.t_flushc = -1; n_ltchars.t_lnextc = -1; if (-1 == ioctl(0, TIOCSLTC, (char *)&n_ltchars)) { - fprintf(stderr, "%s: ioctl: sltc: %s\n", progname, strerror(errno)); + Error("ioctl: sltc: %s", strerror(errno)); return; } # endif @@ -480,7 +498,7 @@ char *pcBuf; while (0 != iLen) { if (-1 == (nr = write(fd, pcBuf, iLen))) { c2cooked(); - fprintf(stderr, "%s: lost connection\n", progname); + Error("lost connection"); exit(3); } iLen -= nr; @@ -508,7 +526,7 @@ char *pcBuf, *pcWant; /* fall through */ case -1: c2cooked(); - fprintf(stderr, "%s: lost connection\n", progname); + Error("lost connection"); exit(3); default: j += nr; @@ -519,7 +537,7 @@ char *pcBuf, *pcWant; } if (0 == iLen) { c2cooked(); - fprintf(stderr, "%s: reply too long\n", progname); + Error("reply too long"); exit(3); } continue; @@ -539,10 +557,6 @@ char *pcBuf, *pcWant; return strcmp(pcBuf, pcWant); } -#if defined(SERVICENAME) -static struct servent *pSE; -#endif - /* call a machine master for group master ports and machine master ports * take a list like "1782@localhost:@mentor.cc.purdue.edu:@pop.stat.purdue.edu" * and send the given command to the group leader at 1782 @@ -576,19 +590,9 @@ char *pcPorts, *pcMaster, *pcTo, *pcCmd, *pcWho; } if ('\000' == *pcPorts) { -#if defined(SERVICENAME) - /* in net order -- ksb */ - j = pSE->s_port; -#else -# if defined(PORTNUMBER) - j = htons(PORTNUMBER); -# else - fprintf(stderr, "%s: no port or service compiled in?\n", progname); - exit(8); -# endif -#endif + j = htons(bindPort); } else if (!isdigit((int)(pcPorts[0]))) { - fprintf(stderr, "%s: %s: %s\n", progname, pcMaster, pcPorts); + Error("%s: %s", pcMaster, pcPorts); exit(2); } else { j = htons((short)atoi(pcPorts)); @@ -597,7 +601,7 @@ char *pcPorts, *pcMaster, *pcTo, *pcCmd, *pcWho; s = GetPort(acExcg, & client_port, j); if (0 != ReadReply(s, acMesg, sizeof(acMesg), "ok\r\n")) { - fprintf(stderr, "%s: %s: %s", progname, acExcg, acMesg); + Error("%s: %s", acExcg, acMesg); exit(4); } @@ -646,7 +650,7 @@ int s; continue; case EINVAL: default: - fprintf(stderr, "%s: recv: %d: %s\r\n", progname, s, strerror(errno)); + Error("recv: %d: %s\r", s, strerror(errno)); sleep(1); continue; } @@ -669,7 +673,7 @@ int s; exit(1); /*NOTREACHED*/ default: - fprintf(stderr, "%s: unknown out of band command `%c\'\r\n", progname, acCmd[0]); + Error("unknown out of band command `%c\'\r", acCmd[0]); (void)fflush(stderr); break; } @@ -688,11 +692,11 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; extern int atoi(); if (fVerbose) { - printf("%s: %s to %s (%son %s)\n", progname, pcHow, pcMach, fRaw ? "raw " : "", pcMaster); + Info("%s to %s (%son %s)", pcHow, pcMach, fRaw ? "raw " : "", pcMaster); } #if defined(F_SETOWN) if (-1 == fcntl(s, F_SETOWN, getpid())) { - fprintf(stderr, "%s: fcntl: %d: %s\n", progname, s, strerror(errno)); + Error("fcntl: %d: %s", s, strerror(errno)); } #else # if defined(SIOCSPGRP) @@ -702,7 +706,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; */ iTemp = -getpid(); if (-1 == ioctl(s, SIOCSPGRP, & iTemp)) { - fprintf(stderr, "%s: ioctl: %d: %s\n", progname, s, strerror(errno)); + Error("ioctl: %d: %s", s, strerror(errno)); } } # endif @@ -724,7 +728,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; (void)sprintf(acMesg, "%c%ce%c%c", DEFATTN, DEFESC, chAttn, chEsc); SendOut(s, acMesg, 5); if (0 == ReadReply(s, acMesg, sizeof(acMesg), (char *)0)) { - fprintf(stderr, "protocol botch on redef on escape sequence\n"); + Error("protocol botch on redef on escape sequence"); exit(8); } } @@ -747,14 +751,14 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; (void)sprintf(acMesg, "%c%c;", chAttn, chEsc); SendOut(s, acMesg, 3); if (0 != ReadReply(s, acMesg, sizeof(acMesg), "[login:\r\n") && 0 != strcmp(acMesg, "\r\n[login:\r\n")) { - fprintf(stderr, "%s: call: %s\n", progname, acMesg); + Error("call: %s", acMesg); exit(2); } (void)sprintf(acMesg, "%s@%s\n", pcUser, acThisHost); SendOut(s, acMesg, strlen(acMesg)); if (0 != ReadReply(s, acMesg, sizeof(acMesg), "host:\r\n")) { - fprintf(stderr, "%s: %s\n", progname, acMesg); + Error("%s", acMesg); exit(2); } @@ -787,7 +791,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; } else if (0 == strcmp(acMesg, "line to host is down]")) { /* ouch, the machine is down on the server */ fIn = '-'; - fprintf(stderr, "%s: %s is down\n", progname, pcMach); + Error("%s is down", pcMach); if (fVerbose) { printf("[use `"); putCtlc(chAttn, stdout); @@ -796,7 +800,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; } } else if (0 == strcmp(acMesg, "no -- on ctl]")) { fIn = '-'; - fprintf(stderr, "%s: %s is a control port\n", progname, pcMach); + Error("%s is a control port", pcMach); if (fVerbose) { printf("[use `"); putCtlc(chAttn, stdout); @@ -804,7 +808,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; printf(";\' to open a console line]\n"); } } else { - fprintf(stderr, "%s: %s: %s\n", progname, pcMach, acMesg); + Error("%s: %s", pcMach, acMesg); exit(5); } } @@ -820,7 +824,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser; if ('-' != fIn) { if (fIn == 'r') { if ('s' != *pcHow) { - fprintf(stderr, "%s: %s is read-only\n", progname, pcMach); + Error("%s is read-only", pcMach); } } else if (fIn != ('f' == *pcHow ? 'a' : *pcHow)) { (void)sprintf(acMesg, "%c%c%c", chAttn, chEsc, *pcHow); @@ -904,14 +908,14 @@ char *pcMaster, *pcMach, *pcCmd, *pcWho; /* get the ports number */ if (0 >= ReadReply(s, acPorts, sizeof(acPorts), (char *)0)) { - fprintf(stderr, "%s: master forward broken\n", progname); + Error("master forward broken"); exit(1); } if ('@' == acPorts[0]) { static int iLimit = 0; if (iLimit++ > 10) { - fprintf(stderr, "%s: forwarding level too deep!\n", progname); + Error("forwarding level too deep!"); return 1; } return Gather(Indir, acPorts, pcMaster, pcMach, pcCmd, pcWho); @@ -1029,7 +1033,7 @@ char *pcMaster, *pcMach, *pcCmd, *pcWho; /* get the ports number */ if (0 >= ReadReply(s, acPorts, sizeof(acPorts), (char *)0)) { - fprintf(stderr, "%s: master forward broken\n", progname); + Error("master forward broken"); exit(1); } if (fVerbose) { @@ -1057,7 +1061,7 @@ char *pcMaster, *pcMach, *pcCmd, *pcWho; /* get the ports number */ if (0 >= ReadReply(s, acPorts, sizeof(acPorts), (char *)0)) { - fprintf(stderr, "%s: master forward broken\n", progname); + Error("master forward broken"); exit(1); } /* to the command to each master @@ -1085,7 +1089,7 @@ char *pcMaster, *pcMach, *pcCmd, *pcWho; /* get the ports number */ if (0 >= ReadReply(s, acPorts, sizeof(acPorts), (char *)0)) { - fprintf(stderr, "%s: group leader died?\n", progname); + Error("group leader died?"); return 1; } if (fVerbose) { @@ -1115,7 +1119,7 @@ char *pcMaster, *pcMach, *pcCmd, *pcWho; /* get the ports number */ if (0 >= ReadReply(s, acPorts, sizeof(acPorts), (char *)0)) { - fprintf(stderr, "%s: master forward broken\n", progname); + Error("master forward broken"); exit(1); } /* to the command to each master @@ -1145,11 +1149,14 @@ char **argv; auto char *pcUser; auto char *pcMsg = '\000'; auto int (*pfiCall)(); - static char acOpts[] = "b:aAdDsSfFe:hl:M:pvVwWUqQrux"; + static char acOpts[] = "b:aAdDsSfFe:hl:M:p:PvVwWqQruUx"; extern long atol(); extern int optind; extern int optopt; extern char *optarg; + int i; + + outputPid = 0; /* make sure stuff DOESN'T have the pid */ if ((char *)0 == (progname = strrchr(argv[0], '/'))) { progname = argv[0]; @@ -1157,40 +1164,6 @@ char **argv; ++progname; } -#if defined(SERVICENAME) - if ((struct servent *)0 == (pSE = getservbyname(SERVICENAME, "tcp"))) { - fprintf(stderr, "%s: getservbyname: %s: %s\n", progname, SERVICENAME, strerror(errno)); - exit(1); - } -#endif - - if (((char *)0 != (ptr = getenv("USER")) || (char *)0 != (ptr = getenv("LOGNAME"))) && - (struct passwd *)0 != (pwdMe = getpwnam(ptr)) && - getuid() == pwdMe->pw_uid) { - /* use the login $USER is set to, if it is our (real) uid */; - } else if ((struct passwd *)0 == (pwdMe = getpwuid(getuid()))) { - fprintf(stderr, "%s: getpwuid: %d: %s\n", progname, (int)(getuid()), strerror(errno)); - exit(1); - } - pcUser = pwdMe->pw_name; - - /* get the out hostname and the loopback devices IP address - * (for trusted connections mostly) - */ - if (-1 == gethostname(acMyName, sizeof(acMyName)-1)) { - fprintf(stderr, "%s: gethostname: %s\n", progname, strerror(errno)); - exit(2); - } - if ((struct hostent *)0 != (hp = gethostbyname(acLocalhost))) { -#if HAVE_MEMCPY - memcpy((char *)&local_port.sin_addr, (char *)hp->h_addr, hp->h_length); -#else - (void)bcopy((char *)hp->h_addr, (char *)&local_port.sin_addr, hp->h_length); -#endif - } else { - acLocalhost[0] = '\000'; - } - /* command line parsing */ pcCmd = (char *)0; @@ -1263,7 +1236,11 @@ char **argv; pcCmd = "xamine"; break; - case 'p': /* send a pid command to the server */ + case 'p': + pcPort = optarg; + break; + + case 'P': /* send a pid command to the server */ pcCmd = "pid"; break; @@ -1279,22 +1256,76 @@ char **argv; break; case 'V': - Version(); - exit(0); + fVersion = 1; + break; default: /* huh? */ - if ( opt != 'h' ) - fprintf(stderr, "%s: unknown option `%c\'\n", progname, optopt); - printf("%s: usage [-aAfFsS] [-rv] [-e esc] [-M mach] [-l username] machine\n", progname); - printf("%s: usage [-v] [-hdDuVwx] [-b message]\n", progname); - printf("%s: usage [-qQ] [-M mach]\n", progname); - Usage(stdout, apcLong); + Error("usage [-aAfFsS] [-rv] [-e esc] [-M mach] [-l username] console"); + Error("usage [-v] [-hdDPuVwx] [-b message]"); + Error("usage [-qQ] [-M mach]"); + Usage(apcLong); exit(0); /*NOTREACHED*/ } } + if (fVersion) { + Version(); + exit(0); + } + + if ( pcPort == NULL ) + { + Error("Severe error: pcPort is NULL???? How can that be?" ); + exit(1); + } + + /* Look for non-numeric characters */ + for (i=0;pcPort[i] != '\000';i++) + if (!isdigit((int)pcPort[i])) break; + + if ( pcPort[i] == '\000' ) { + /* numeric only */ + bindPort = atoi( pcPort ); + } else { + /* non-numeric only */ + struct servent *pSE; + if ((struct servent *)0 == (pSE = getservbyname(pcPort, "tcp"))) { + Error("getservbyname: %s: %s", pcPort, strerror(errno)); + exit(1); + } else { + bindPort = ntohs((u_short)pSE->s_port); + } + } + + if (((char *)0 != (ptr = getenv("USER")) || (char *)0 != (ptr = getenv("LOGNAME"))) && + (struct passwd *)0 != (pwdMe = getpwnam(ptr)) && + getuid() == pwdMe->pw_uid) { + /* use the login $USER is set to, if it is our (real) uid */; + } else if ((struct passwd *)0 == (pwdMe = getpwuid(getuid()))) { + Error("getpwuid: %d: %s", (int)(getuid()), strerror(errno)); + exit(1); + } + pcUser = pwdMe->pw_name; + + /* get the out hostname and the loopback devices IP address + * (for trusted connections mostly) + */ + if (-1 == gethostname(acMyName, sizeof(acMyName)-1)) { + Error("gethostname: %s", strerror(errno)); + exit(2); + } + if ((struct hostent *)0 != (hp = gethostbyname(acLocalhost))) { +#if HAVE_MEMCPY + memcpy((char *)&local_port.sin_addr, (char *)hp->h_addr, hp->h_length); +#else + (void)bcopy((char *)hp->h_addr, (char *)&local_port.sin_addr, hp->h_length); +#endif + } else { + acLocalhost[0] = '\000'; + } + /* finish resolving the command to do, call Gather */ if ((char *)0 == pcCmd) { @@ -1303,7 +1334,7 @@ char **argv; if ('a' == *pcCmd || 'f' == *pcCmd || 's' == *pcCmd) { if (optind >= argc) { - fprintf(stderr, "%s: missing machine name\n", progname); + Error("missing console name"); exit(1); } pcTo = argv[optind++]; @@ -1311,7 +1342,7 @@ char **argv; pcTo = "*"; } if (optind < argc) { - fprintf(stderr, "%s: extra garbage on command line? (%s...)\n", progname, argv[optind]); + Error("extra garbage on command line? (%s...)", argv[optind]); exit(1); } (void)sprintf(acPorts, "@%s", pcInMaster); diff --git a/console/console.man b/console/console.man index b61803f..362e5c4 100644 --- a/console/console.man +++ b/console/console.man @@ -1,17 +1,17 @@ -.\" $Id: console.man,v 1.5 1999-04-12 22:40:55-07 bryan Exp $ +.\" $Id: console.man,v 1.6 2001-07-05 01:39:15-07 bryan Exp $ .TH CONSOLE 8 "Local" .SH NAME console \- console server client program .SH SYNOPSIS -\fBconsole\fP [\-\fBaAfFsS\fP] [\-\fBrv\fP] [\-\fBe\fP \fIesc\fP] [\-\fBM\fP \fIserver\fP] \fIhost\fP +\fBconsole\fP [\-\fBaAfFsS\fP] [\-\fBrv\fP] [\-\fBe\fP \fIesc\fP] [\-\fBM\fP \fImach\fP] \fIconsole\fP .br -\fBconsole\fP [\-\fBv\fP] [\-\fBhdDuVwx\fP] [\-\fBb\fP \fImessage\fP] +\fBconsole\fP [\-\fBv\fP] [\-\fBhdDPuVwx\fP] [\-\fBb\fP \fImessage\fP] .br -\fBconsole\fP [\-\fBqQ\fP] [\-\fBM\fP \fIserver\fP] +\fBconsole\fP [\-\fBqQ\fP] [\-\fBM\fP \fImach\fP] .SH DESCRIPTION .B Console is used to manipulate console terminals remotely or poll running -\fIconserver\fP(8L) daemons for status information. +\fIconserver\fP(8) daemons for status information. .PP .B Console queries the user for the their passwd before @@ -34,6 +34,9 @@ Display daemon versions. The \fIconsole\fP client connects to each server to request its version information. The uppercase varient of this option only requests the primary server's version. .TP +.B \-D +Same as \fB\-d\fP but just acts on the local server. +.TP .BI \-e esc Set the initial two character escape sequence to those represented by \fIesc\fP. @@ -41,24 +44,32 @@ Any of the forms output by \fIcat\fP(1)'s \-\fBv\fP option are accepted. The default value is ``^Ec''. .TP .B \-f -Same as -.I \-a -except it will force any existing connection into spy mode. +Same as \fB\-a\fP except it will force any existing connection into spy mode. .TP .B \-h Display a brief help message. .TP -.BI \-M server -The \fIconsole\fP client program polls \fIserver\fP as the primary server, +.BI \-l user +Sets the username used for authentication to \fIuser\fP. +.TP +.BI \-M mach +The \fIconsole\fP client program polls \fImach\fP as the primary server, rather than the hard coded default (``console''). .TP +.BI \-p port +Set the port to connect to. The default \fIport\fP is set at compile time +using the --with-port option. +.TP +.B \-P +Display the pids of the master daemon processes. +.TP .B \-q The \fIconsole\fP client requests the server daemon quit (shutdown). A password is sent in the protocol stream, if none is required for the local host to shutdown the server just press return. .TP .B \-Q -Like -q, but just acts on the primary server. +Same as \fB\-q\fP but just acts on the local server. .TP .B \-r Request a raw connection to the group control virtual console, @@ -73,6 +84,9 @@ but all other keyboard input is discarded. .B \-u Show a list of all consoles with status and attached users. .TP +.B \-U +Same as \fB\-u\fP. +.TP .B \-V Output the version of the console client program. .TP @@ -84,15 +98,18 @@ for added benefit. .B \-w Show a list of all connections to consoles. .TP +.B \-W +Same as \fB\-w\fP. +.TP .B \-x Show a list of consoles and devices. .PP -The \-\fBA\fP, \-\fBF\fP, or \-\fBS\fP options have the same effect as +The \fB\-A\fP, \fB\-F\fP, or \fB\-S\fP options have the same effect as their lower case variants. In addition they each request the last 20 lines of the console output after making the connection. .PP -Any default (\-\fBa\fP) connection is dropped to spy mode if +Any default (\fB\-a\fP) connection is dropped to spy mode if someone else is attached read-write. .SH "ESCAPE SEQUENCES" The connection can be controlled by a two character escape sequence, followed @@ -120,8 +137,7 @@ w who is using this console x examine this group's devices and modes. z suspend this connection ? display list of commands -^I toggle tab expansion -^J continue, ignore the escape sequence +^M continue, ignore the escape sequence ^R replay the last line only \. disconnect .TE @@ -179,18 +195,18 @@ Requests a connection to the host ``lv426'' with the escape characters set to ``escape one''. .SH BUGS Connections suspended under Dynix sometimes break the kernel when -resumed. Suspended connections are a poor idea in general, just -disconnect instead. +resumed. .PP It is possible to create a loop of console connections, with ugly results. -Never run \fIconsole\fP from within a console connection. +Never run \fIconsole\fP from within a console connection (unless you set each +escape sequence differently). .PP -The \-\fBr\fP option doesn't help to explain how connections get built. +The \fB\-r\fP option doesn't help to explain how connections get built. .SH AUTHORS Thomas A. Fine, Ohio State Computer Science. .br Kevin Braunsdorf, Purdue University Computing Center .br -Bryan Stansell, Global Networking and Computing, Inc. +Bryan Stansell, conserver.com .SH "SEE ALSO" -conserver.cf(5L), conserver(8L) +conserver.cf(5), conserver(8) diff --git a/contrib/redhat-rpm/conserver.spec b/contrib/redhat-rpm/conserver.spec index 2806c53..c6ba173 100644 --- a/contrib/redhat-rpm/conserver.spec +++ b/contrib/redhat-rpm/conserver.spec @@ -4,7 +4,7 @@ # %define pkg conserver -%define ver 7.0.2 +%define ver 7.0.3 # define the name of the machine on which the main conserver # daemon will be running if you don't want to use the default diff --git a/contrib/solaris-package/pkginfo b/contrib/solaris-package/pkginfo index 59a52c2..65babaa 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="7.0.2" +VERSION="7.0.3" DESC="Console server and client" CLASSES=none ARCH=sparc