mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Make sure the mailer exists and is a regular file before trying
to exec it.
This commit is contained in:
@@ -542,6 +542,7 @@ 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[] = {
|
||||||
@@ -559,6 +560,10 @@ 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:
|
||||||
|
Reference in New Issue
Block a user