diff -u --recursive sudo.v1.5.6b2-old/acsite.m4 sudo.v1.5.6b2/acsite.m4 --- sudo.v1.5.6b2-old/acsite.m4 Mon Sep 7 12:49:57 1998 +++ sudo.v1.5.6b2/acsite.m4 Thu Sep 10 15:12:57 1998 @@ -135,7 +135,7 @@ AC_DEFUN(SUDO_LOGFILE, [AC_MSG_CHECKING(for log file location) if test -n "$with_logfile"; then AC_MSG_RESULT($with_logfile) - AC_DEFINE(_CONFIG_PATH_LOGFILE, "$with_logfile") + AC_DEFINE_UNQUOTED(_CONFIG_PATH_LOGFILE, "$with_logfile") elif test -d "/var/log"; then AC_MSG_RESULT(/var/log/sudo.log) AC_DEFINE(_CONFIG_PATH_LOGFILE, "/var/log/sudo.log") @@ -156,7 +156,7 @@ AC_DEFUN(SUDO_TIMEDIR, [AC_MSG_CHECKING(for timestamp file location) if test -n "$with_timedir"; then AC_MSG_RESULT($with_timedir) - AC_DEFINE(_CONFIG_PATH_TIMEDIR, "$with_timedir") + AC_DEFINE_UNQUOTED(_CONFIG_PATH_TIMEDIR, "$with_timedir") elif test -d "/var/run"; then AC_MSG_RESULT(/var/run/sudo) AC_DEFINE(_CONFIG_PATH_TIMEDIR, "/var/run/sudo") diff -u --recursive sudo.v1.5.6b2-old/config.h.in sudo.v1.5.6b2/config.h.in --- sudo.v1.5.6b2-old/config.h.in Mon Sep 7 12:42:34 1998 +++ sudo.v1.5.6b2/config.h.in Thu Sep 10 16:10:48 1998 @@ -295,6 +295,12 @@ #endif #endif +/* Define if you want the hostname to be entered into the log file */ +#undef HOST_IN_LOG + +/* Define if you want the log file line to be wrapped */ +#undef WRAP_LOG + /* * Paths to commands used by sudo. There are used by pathnames.h. * If you want to override these values, do so in pathnames.h, not here! diff -u --recursive sudo.v1.5.6b2-old/configure.in sudo.v1.5.6b2/configure.in --- sudo.v1.5.6b2-old/configure.in Mon Sep 7 20:32:06 1998 +++ sudo.v1.5.6b2/configure.in Thu Sep 10 16:10:31 1998 @@ -175,6 +175,37 @@ ;; esac]) +AC_MSG_CHECKING(whether to log the hostname in the log file) +AC_ARG_ENABLE(log-host, +[ --enable-log-host Log the hostname in the log file + --disable-log-host Do not log hostname in the log file (default)], +[ case "$enableval" in + yes) + AC_MSG_RESULT(yes) + AC_DEFINE(HOST_IN_LOG) + ;; + *) AC_MSG_RESULT(no) + ;; + esac ], + AC_MSG_RESULT(no) +) + +AC_MSG_CHECKING(whether to wrap long lines in the log file) +AC_ARG_ENABLE(log-wrap, +[ --enable-log-wrap Wrap long lines in the log file (default) + --disable-log-wrap Do not wrap long lines in the log file], +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + ;; + *) AC_MSG_RESULT(yes) + AC_DEFINE(WRAP_LOG) + ;; + esac ], + AC_MSG_RESULT(yes) + AC_DEFINE(WRAP_LOG) +) + AC_ARG_WITH(timedir, [ --with-timedir path to the sudo timestamp dir], [case $with_timedir in yes) echo "Must give --with-timedir an argument." diff -u --recursive sudo.v1.5.6b2-old/logging.c sudo.v1.5.6b2/logging.c --- sudo.v1.5.6b2-old/logging.c Mon May 18 23:32:00 1998 +++ sudo.v1.5.6b2/logging.c Thu Sep 10 16:15:21 1998 @@ -87,12 +87,6 @@ static char *logline; extern int errorlineno; -/* - * length of syslog-like header info used for mail and file logs - * is len("Mon MM HH:MM:SS : username : ") - */ -#define LOG_HEADER_LEN 29 - #ifdef BROKEN_SYSLOG #define MAXSYSLOGTRIES 16 /* num of retries for broken syslogs */ #define SYSLOG(a,b,c,d) syslog_wrapper(a,b,c,d) @@ -147,10 +141,18 @@ char *tmp, save; #endif /* LOGGING & SLOG_SYSLOG */ + /* "DDD MM HH:MM:SS : username : ") */ + int header_length = 15 + strlen(user_name) + 2*3; + +#ifdef HOST_IN_LOG + /* Additional " : HOST=hostname" -- hostname is strlen(shost) */ + header_length += 3 + strlen(shost) + 5; +#endif + /* * Allocate enough memory for logline so we won't overflow it */ - count = LOG_HEADER_LEN + 136 + 2 * MAXPATHLEN + strlen(tty) + strlen(cwd) + + count = header_length + 136 + 2 * MAXPATHLEN + strlen(tty) + strlen(cwd) + strlen(runas_user); if (cmnd_args) count += strlen(cmnd_args); @@ -168,12 +170,16 @@ */ now = time((time_t) 0); p = ctime(&now) + 4; - (void) sprintf(logline, "%15.15s : %8.8s : ", p, user_name); +#ifdef HOST_IN_LOG + (void) sprintf(logline, "%15.15s : %s : HOST=%s : ", p, user_name, shost); +#else + (void) sprintf(logline, "%15.15s : %s : ", p, user_name); +#endif /* * we need a pointer to the end of logline for cheap appends. */ - p = logline + LOG_HEADER_LEN; + p = logline + header_length; switch (code) { @@ -316,7 +322,7 @@ /* * Log the full line, breaking into multiple syslog(3) calls if necesary */ - p = &logline[LOG_HEADER_LEN]; /* skip past the date and user */ + p = &logline[header_length];/* skip past the date, host, and user */ for (count = 0; count < strlen(logline) / MAXSYSLOGLEN + 1; count++) { if (strlen(p) > MAXSYSLOGLEN) { /* @@ -366,6 +372,9 @@ char *beg, *oldend, *end; int maxlen = MAXLOGFILELEN; +#ifndef WRAP_LOG + (void) fprintf(fp, "%s\n", logline); +#else /* * Print out logline with word wrap */ @@ -413,6 +422,7 @@ beg = NULL; /* exit condition */ } } +#endif (void) fclose(fp); }