version 1.6, 2002/01/14 00:11:44 |
version 1.7, 2002/01/17 01:03:21 |
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: logging.c,v 1.152 2002/01/13 18:27:25 millert Exp $"; |
static const char rcsid[] = "$Sudo: logging.c,v 1.153 2002/01/16 21:28:25 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
static void do_syslog __P((int, char *)); |
static void do_syslog __P((int, char *)); |
|
|
char *p; |
char *p; |
int pfd[2], pid, status; |
int pfd[2], pid, status; |
sigset_t set, oset; |
sigset_t set, oset; |
|
#ifndef NO_ROOT_MAILER |
|
static char *root_envp[] = { |
|
"HOME=/", |
|
"PATH=/usr/bin:/bin", |
|
"LOGNAME=root", |
|
"USER=root", |
|
NULL |
|
}; |
|
#endif |
|
|
/* Just return if mailer is disabled. */ |
/* Just return if mailer is disabled. */ |
if (!def_str(I_MAILERPATH) || !def_str(I_MAILTO)) |
if (!def_str(I_MAILERPATH) || !def_str(I_MAILTO)) |
|
|
/* Close password file so we don't leak the fd. */ |
/* Close password file so we don't leak the fd. */ |
endpwent(); |
endpwent(); |
|
|
/* Run mailer as root so user cannot kill it. */ |
/* |
|
* Depending on the config, either run the mailer as root |
|
* (so user cannot kill it) or as the user (for the paranoid). |
|
*/ |
|
#ifndef NO_ROOT_MAILER |
set_perms(PERM_FULL_ROOT, 0); |
set_perms(PERM_FULL_ROOT, 0); |
|
execve(mpath, argv, root_envp); |
|
#else |
|
set_perms(PERM_FULL_USER, 0); |
execv(mpath, argv); |
execv(mpath, argv); |
|
#endif /* NO_ROOT_MAILER */ |
_exit(127); |
_exit(127); |
} |
} |
break; |
break; |