version 1.1.1.4, 2013/07/22 10:46:12
|
version 1.1.1.5, 2013/10/14 07:56:34
|
Line 200 do_logfile(char *msg)
|
Line 200 do_logfile(char *msg)
|
time(&now); |
time(&now); |
if (def_loglinelen < sizeof(LOG_INDENT)) { |
if (def_loglinelen < sizeof(LOG_INDENT)) { |
/* Don't pretty-print long log file lines (hard to grep) */ |
/* Don't pretty-print long log file lines (hard to grep) */ |
if (def_log_host) | if (def_log_host) { |
(void) fprintf(fp, "%s : %s : HOST=%s : %s\n", |
(void) fprintf(fp, "%s : %s : HOST=%s : %s\n", |
get_timestr(now, def_log_year), user_name, user_shost, msg); | get_timestr(now, def_log_year), user_name, user_srunhost, |
else | msg); |
| } else { |
(void) fprintf(fp, "%s : %s : %s\n", |
(void) fprintf(fp, "%s : %s : %s\n", |
get_timestr(now, def_log_year), user_name, msg); |
get_timestr(now, def_log_year), user_name, msg); |
|
} |
} else { |
} else { |
if (def_log_host) | if (def_log_host) { |
len = easprintf(&full_line, "%s : %s : HOST=%s : %s", |
len = easprintf(&full_line, "%s : %s : HOST=%s : %s", |
get_timestr(now, def_log_year), user_name, user_shost, msg); | get_timestr(now, def_log_year), user_name, user_srunhost, |
else | msg); |
| } else { |
len = easprintf(&full_line, "%s : %s : %s", |
len = easprintf(&full_line, "%s : %s : %s", |
get_timestr(now, def_log_year), user_name, msg); |
get_timestr(now, def_log_year), user_name, msg); |
|
} |
|
|
/* |
/* |
* Print out full_line with word wrap around def_loglinelen chars. |
* Print out full_line with word wrap around def_loglinelen chars. |
Line 290 log_denial(int status, bool inform_user)
|
Line 294 log_denial(int status, bool inform_user)
|
} else if (ISSET(status, FLAG_NO_HOST)) { |
} else if (ISSET(status, FLAG_NO_HOST)) { |
sudo_printf(SUDO_CONV_ERROR_MSG, _("%s is not allowed to run sudo " |
sudo_printf(SUDO_CONV_ERROR_MSG, _("%s is not allowed to run sudo " |
"on %s. This incident will be reported.\n"), |
"on %s. This incident will be reported.\n"), |
user_name, user_shost); | user_name, user_srunhost); |
} else if (ISSET(status, FLAG_NO_CHECK)) { |
} else if (ISSET(status, FLAG_NO_CHECK)) { |
sudo_printf(SUDO_CONV_ERROR_MSG, _("Sorry, user %s may not run " |
sudo_printf(SUDO_CONV_ERROR_MSG, _("Sorry, user %s may not run " |
"sudo on %s.\n"), user_name, user_shost); | "sudo on %s.\n"), user_name, user_srunhost); |
} else { |
} else { |
sudo_printf(SUDO_CONV_ERROR_MSG, _("Sorry, user %s is not allowed " |
sudo_printf(SUDO_CONV_ERROR_MSG, _("Sorry, user %s is not allowed " |
"to execute '%s%s%s' as %s%s%s on %s.\n"), |
"to execute '%s%s%s' as %s%s%s on %s.\n"), |
Line 542 send_mail(const char *fmt, ...)
|
Line 546 send_mail(const char *fmt, ...)
|
int fd, pfd[2], status; |
int fd, pfd[2], status; |
pid_t pid, rv; |
pid_t pid, rv; |
sigaction_t sa; |
sigaction_t sa; |
|
struct stat sb; |
va_list ap; |
va_list ap; |
#ifndef NO_ROOT_MAILER |
#ifndef NO_ROOT_MAILER |
static char *root_envp[] = { |
static char *root_envp[] = { |
Line 559 send_mail(const char *fmt, ...)
|
Line 564 send_mail(const char *fmt, ...)
|
if (!def_mailerpath || !def_mailto) |
if (!def_mailerpath || !def_mailto) |
debug_return; |
debug_return; |
|
|
|
/* Make sure the mailer exists and is a regular file. */ |
|
if (stat(def_mailerpath, &sb) != 0 || !S_ISREG(sb.st_mode)) |
|
debug_return; |
|
|
/* Fork and return, child will daemonize. */ |
/* Fork and return, child will daemonize. */ |
switch (pid = sudo_debug_fork()) { |
switch (pid = sudo_debug_fork()) { |
case -1: |
case -1: |
Line 609 send_mail(const char *fmt, ...)
|
Line 618 send_mail(const char *fmt, ...)
|
closefrom(STDERR_FILENO + 1); |
closefrom(STDERR_FILENO + 1); |
|
|
/* Ignore SIGPIPE in case mailer exits prematurely (or is missing). */ |
/* Ignore SIGPIPE in case mailer exits prematurely (or is missing). */ |
zero_bytes(&sa, sizeof(sa)); | memset(&sa, 0, sizeof(sa)); |
sigemptyset(&sa.sa_mask); |
sigemptyset(&sa.sa_mask); |
sa.sa_flags = SA_INTERRUPT; |
sa.sa_flags = SA_INTERRUPT; |
sa.sa_handler = SIG_IGN; |
sa.sa_handler = SIG_IGN; |
Line 635 send_mail(const char *fmt, ...)
|
Line 644 send_mail(const char *fmt, ...)
|
case 0: |
case 0: |
{ |
{ |
char *argv[MAX_MAILFLAGS + 1]; |
char *argv[MAX_MAILFLAGS + 1]; |
char *mpath, *mflags; | char *mflags, *mpath = def_mailerpath; |
int i; |
int i; |
|
|
/* Child, set stdin to output side of the pipe */ |
/* Child, set stdin to output side of the pipe */ |
Line 652 send_mail(const char *fmt, ...)
|
Line 661 send_mail(const char *fmt, ...)
|
|
|
/* Build up an argv based on the mailer path and flags */ |
/* Build up an argv based on the mailer path and flags */ |
mflags = estrdup(def_mailerflags); |
mflags = estrdup(def_mailerflags); |
mpath = estrdup(def_mailerpath); | if ((argv[0] = strrchr(mpath, '/'))) |
if ((argv[0] = strrchr(mpath, ' '))) | |
argv[0]++; |
argv[0]++; |
else |
else |
argv[0] = mpath; |
argv[0] = mpath; |