diff options
Diffstat (limited to 'gnu/usr.bin/sudo/sudo/logging.c')
-rw-r--r-- | gnu/usr.bin/sudo/sudo/logging.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gnu/usr.bin/sudo/sudo/logging.c b/gnu/usr.bin/sudo/sudo/logging.c index 85cc707a80a..0feb8d9cccc 100644 --- a/gnu/usr.bin/sudo/sudo/logging.c +++ b/gnu/usr.bin/sudo/sudo/logging.c @@ -1,5 +1,5 @@ /* - * CU sudo version 1.5.2 (based on Root Group sudo version 1.1) + * CU sudo version 1.5.3 (based on Root Group sudo version 1.1) * * This software comes with no waranty whatsoever, use at your own risk. * @@ -37,7 +37,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: logging.c,v 1.1 1996/10/14 05:14:50 millert Exp $"; +static char rcsid[] = "$Id: logging.c,v 1.2 1996/11/17 16:34:00 millert Exp $"; #endif /* lint */ #include "config.h" @@ -444,6 +444,7 @@ static void send_mail() char *mailer = MAILER; char *subject = MAILSUBJECT; int fd[2]; + char *p; #ifdef POSIX_SIGNALS struct sigaction action; @@ -498,8 +499,18 @@ static void send_mail() /* feed the data to sendmail */ /* XXX - do we need to fdopen this fd #1 to a new stream??? */ - (void) fprintf(stdout, "To: %s\nSubject: %s\n\n%s : %s\n\n", - ALERTMAIL, subject, host, logline); + (void) fprintf(stdout, "To: %s\nSubject: ", ALERTMAIL); + p = subject; + while (*p) { + /* expand %h -> hostname in subject */ + if (*p == '%' && *(p+1) == 'h') { + (void) fputs(host, stdout); + p++; + } else + (void) fputc(*p, stdout); + p++; + } + (void) fprintf(stdout, "\n\n%s : %s\n\n", host, logline); fclose(stdout); exit(0); |