]> granicus.if.org Git - sudo/commitdiff
Make sure the mailer exists and is a regular file before trying
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 13 Aug 2013 20:48:24 +0000 (14:48 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 13 Aug 2013 20:48:24 +0000 (14:48 -0600)
to exec it.

plugins/sudoers/logging.c

index eee0f2d5a9e6982137a560ad6616dfc0afbaea1d..a53581d9412891bc4e3561bf4e516e69020bef0f 100644 (file)
@@ -542,6 +542,7 @@ send_mail(const char *fmt, ...)
     int fd, pfd[2], status;
     pid_t pid, rv;
     sigaction_t sa;
+    struct stat sb;
     va_list ap;
 #ifndef NO_ROOT_MAILER
     static char *root_envp[] = {
@@ -559,6 +560,10 @@ send_mail(const char *fmt, ...)
     if (!def_mailerpath || !def_mailto)
        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. */
     switch (pid = sudo_debug_fork()) {
        case -1: