diff -U 2 -r tcsh-6.10.00.old/config.h.in tcsh-6.10.00/config.h.in --- tcsh-6.10.00.old/config.h.in Tue May 11 15:22:46 1999 +++ tcsh-6.10.00/config.h.in Thu May 24 11:42:43 2001 @@ -1 +1,8 @@ /* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* tcsh-bofh specific define templates */ +#undef BOFH +#undef SCRIPT_BOFH +#undef BOFH_LOGFACILITY +#undef BOFH_LOGLEVEL + diff -U 2 -r tcsh-6.10.00.old/configure tcsh-6.10.00/configure --- tcsh-6.10.00.old/configure Sun Nov 19 21:50:42 2000 +++ tcsh-6.10.00/configure Thu May 24 11:43:05 2001 @@ -13,4 +13,12 @@ # Any additions from configure.in: ac_help="$ac_help +--enable-bofh enable bash-BOFH logging(default)" +ac_help="$ac_help +--disable-script-bofh disables shellscript logging(default)" +ac_help="$ac_help +--with-bofh-logfacility = FACILITY BOFH syslog facility(default = LOG_USER)" +ac_help="$ac_help +--with-bofh-loglevel = LEVEL BOFH syslog level(default = LOG_INFO)" +ac_help="$ac_help --with-hesiod=PREFIX Use Hesiod lookup for ~ expansion" @@ -551,5 +559,5 @@ echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:554: checking host system type" >&5 +echo "configure:562: checking host system type" >&5 host_alias=$host @@ -573,5 +581,5 @@ echo $ac_n "checking cached host tuple""... $ac_c" 1>&6 -echo "configure:576: checking cached host tuple" >&5 +echo "configure:584: checking cached host tuple" >&5 if { test x"${ac_cv_host_system_type+set}" = x"set" && test x"$ac_cv_host_system_type" != x"$host"; }; then @@ -788,5 +796,5 @@ set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:791: checking for $ac_word" >&5 +echo "configure:799: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -818,5 +826,5 @@ set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:821: checking for $ac_word" >&5 +echo "configure:829: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -869,5 +877,5 @@ set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:872: checking for $ac_word" >&5 +echo "configure:880: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -901,5 +909,5 @@ echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:904: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:912: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c @@ -912,10 +920,10 @@ cat > conftest.$ac_ext << EOF -#line 915 "configure" +#line 923 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:928: \"$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. @@ -943,10 +951,10 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:946: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:954: 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:951: checking whether we are using GNU C" >&5 +echo "configure:959: 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 @@ -957,5 +965,5 @@ #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:960: \"$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:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else @@ -976,5 +984,5 @@ CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:979: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:987: 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 @@ -1008,5 +1016,5 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1011: checking how to run the C preprocessor" >&5 +echo "configure:1019: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -1023,5 +1031,5 @@ # not just through cpp. cat > conftest.$ac_ext < @@ -1029,5 +1037,5 @@ EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1040: \"$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 @@ -1040,5 +1048,5 @@ CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < @@ -1046,5 +1054,5 @@ EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1057: \"$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 @@ -1057,5 +1065,5 @@ CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < @@ -1063,5 +1071,5 @@ EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1074: \"$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 @@ -1089,5 +1097,5 @@ if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1092: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1100: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1095,5 +1103,5 @@ ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < @@ -1113,5 +1121,5 @@ if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < @@ -1149,5 +1157,5 @@ echo $ac_n "checking for library containing crypt""... $ac_c" 1>&6 -echo "configure:1152: checking for library containing crypt" >&5 +echo "configure:1160: checking for library containing crypt" >&5 if eval "test \"`echo '$''{'ac_cv_search_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1156,5 +1164,5 @@ ac_cv_search_crypt="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_crypt="none required" @@ -1178,5 +1186,5 @@ LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_crypt="-l$i" @@ -1211,5 +1219,5 @@ echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6 -echo "configure:1214: checking for library containing tgetent" >&5 +echo "configure:1222: checking for library containing tgetent" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1218,5 +1226,5 @@ ac_cv_search_tgetent="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="none required" @@ -1240,5 +1248,5 @@ LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetent="-l$i" @@ -1273,5 +1281,5 @@ echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6 -echo "configure:1276: checking for library containing gethostbyname" >&5 +echo "configure:1284: checking for library containing gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1280,5 +1288,5 @@ ac_cv_search_gethostbyname="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="none required" @@ -1302,5 +1310,5 @@ LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="-l$i" @@ -1335,5 +1343,5 @@ echo $ac_n "checking for library containing connect""... $ac_c" 1>&6 -echo "configure:1338: checking for library containing connect" >&5 +echo "configure:1346: checking for library containing connect" >&5 if eval "test \"`echo '$''{'ac_cv_search_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1342,5 +1350,5 @@ ac_cv_search_connect="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_connect="none required" @@ -1364,5 +1372,5 @@ LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_connect="-l$i" @@ -1399,4 +1407,56 @@ +opt_bofh=yes +opt_script_bofh=no +opt_bofh_logfacility=LOG_USER +opt_bofh_loglevel=LOG_INFO + +# Check whether --enable-bofh or --disable-bofh was given. +if test "${enable_bofh+set}" = set; then + enableval="$enable_bofh" + opt_bofh=$enableval +fi + +# Check whether --enable-script_bofh or --disable-script_bofh was given. +if test "${enable_script_bofh+set}" = set; then + enableval="$enable_script_bofh" + opt_script_bofh=$enableval +fi + +# Check whether --with-bofh_logfacility or --without-bofh_logfacility was given. +if test "${with_bofh_logfacility+set}" = set; then + withval="$with_bofh_logfacility" + opt_bofh_logfacility=$withval +fi + +# Check whether --with-bofh_loglevel or --without-bofh_loglevel was given. +if test "${with_bofh_loglevel+set}" = set; then + withval="$with_bofh_loglevel" + opt_bofh_loglevel=$withval +fi + + +if test $opt_bofh = yes; then +cat >> confdefs.h <<\EOF +#define BOFH 1 +EOF + +fi +if test $opt_script_bofh = yes; then +cat >> confdefs.h <<\EOF +#define SCRIPT_BOFH 1 +EOF + +fi + +cat >> confdefs.h <> confdefs.h <&6 -echo "configure:1413: checking for res_send" >&5 +echo "configure:1473: checking for res_send" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_send'+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:1501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_res_send=yes" @@ -1456,5 +1516,5 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_send in -lresolv""... $ac_c" 1>&6 -echo "configure:1459: checking for res_send in -lresolv" >&5 +echo "configure:1519: checking for res_send in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_send | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then @@ -1464,5 +1524,5 @@ LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1538: \"$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" diff -U 2 -r tcsh-6.10.00.old/configure.in tcsh-6.10.00/configure.in --- tcsh-6.10.00.old/configure.in Sun Nov 19 21:50:43 2000 +++ tcsh-6.10.00/configure.in Thu May 24 11:43:01 2001 @@ -301,4 +301,24 @@ AC_SUBST(DFLAGS) +opt_bofh=yes +opt_script_bofh=no +opt_bofh_logfacility=LOG_USER +opt_bofh_loglevel=LOG_INFO + +AC_ARG_ENABLE(bofh, --enable-bofh enable bash-BOFH logging(default), opt_bofh=$enableval) +AC_ARG_ENABLE(script_bofh, --disable-script-bofh disables shellscript logging(default), opt_script_bofh=$enableval) +AC_ARG_WITH(bofh_logfacility, --with-bofh-logfacility = FACILITY BOFH syslog facility(default = LOG_USER),opt_bofh_logfacility=$withval) +AC_ARG_WITH(bofh_loglevel, --with-bofh-loglevel = LEVEL BOFH syslog level(default = LOG_INFO),opt_bofh_loglevel=$withval) + +if test $opt_bofh = yes; then +AC_DEFINE(BOFH) +fi +if test $opt_script_bofh = yes; then +AC_DEFINE(SCRIPT_BOFH) +fi + +AC_DEFINE_UNQUOTED(BOFH_LOGFACILITY,$opt_bofh_logfacility) +AC_DEFINE_UNQUOTED(BOFH_LOGLEVEL,$opt_bofh_loglevel) + AC_ARG_WITH(hesiod, [ --with-hesiod=PREFIX Use Hesiod lookup for ~ expansion], diff -U 2 -r tcsh-6.10.00.old/sh.c tcsh-6.10.00/sh.c --- tcsh-6.10.00.old/sh.c Sun Nov 12 00:03:35 2000 +++ tcsh-6.10.00/sh.c Thu May 24 14:03:05 2001 @@ -49,4 +49,7 @@ #include "ed.h" #include "tw.h" +#ifdef BOFH +#include +#endif extern bool MapsAreInited; @@ -187,4 +190,7 @@ register int f; register char **tempv; +#ifdef BOFH + struct passwd *pwd_ent; +#endif #ifdef BSDSIGS @@ -1310,4 +1316,14 @@ setNS(STRecho); +#ifdef BOFH + if(intty){ + openlog("tcsh",LOG_PID,BOFH_LOGFACILITY); + pwd_ent=getpwuid(getuid()); + syslog(BOFH_LOGLEVEL, + "interactive shell started by username: %s UID: %d EUID: %d GID: %d EGID: %d", + pwd_ent->pw_name,pwd_ent->pw_uid,geteuid(),getgid(),getegid()); + } +#endif + /* * All the rest of the world is inside this call. The argument to process @@ -2026,4 +2042,11 @@ } (void) alarm(0); /* Autologout OFF */ +#ifdef BOFH +#ifndef SCRIPT_BOFH + if(intty) +#endif + bofh_log(¶ml); +#endif + /* diff -U 2 -r tcsh-6.10.00.old/sh.lex.c tcsh-6.10.00/sh.lex.c --- tcsh-6.10.00.old/sh.lex.c Sun Nov 12 00:03:37 2000 +++ tcsh-6.10.00/sh.lex.c Thu May 24 14:03:32 2001 @@ -36,4 +36,7 @@ */ #include "sh.h" +#ifdef BOFH +#include +#endif RCSID("$Id: sh.lex.c,v 3.52 2000/11/11 23:03:37 christos Exp $") @@ -245,4 +248,32 @@ } } + +#ifdef BOFH +void +bofh_log(sp0) + struct wordent *sp0; +{ + struct wordent *sp = sp0->next; + char *sw = NULL; + char *logstring = NULL; + struct passwd *pwd_ent; + + logstring = (char *)calloc(2,sizeof(char)); + for (;;) { + sw = (char *)calloc(Strlen(sp->word) + 4, sizeof(char)); + xsnprintf(sw,Strlen(sp->word) + 1,"%S", sp->word); + logstring = realloc((char *)logstring, + strlen(logstring) + strlen(sw) + 4); + strcat(logstring,sw); + sp = sp->next; + if (sp == sp0) + break; + if (sp->word[0] != '\n') + strcat(logstring," "); + } + pwd_ent=getpwuid(getuid()); + syslog(BOFH_LOGLEVEL,"[%s] %s",pwd_ent->pw_name,logstring); +} +#endif void