Prevent movemail from proceeding when setuid fails
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 27 Sep 2015 21:10:45 +0000 (17:10 -0400)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 27 Sep 2015 21:10:45 +0000 (17:10 -0400)
* lib-src/movemail.c (main): Exit is setuid fails

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
lib-src/movemail.c

index 9d75782..f6aa06d 100644 (file)
@@ -344,14 +344,18 @@ int main(int argc, char *argv[])
                int retcode = popmail(inname + 3, outname, poppass);
                exit(retcode);
        }
-       setuid(getuid());
+       if (0 != setuid(getuid())) {
+               exit(1);
+       }
 #endif                         /* MAIL_USE_POP */
 
 #ifndef DISABLE_DIRECT_ACCESS
 
 
        if (fork() == 0) {
-               setuid(getuid());
+               if (0 != setuid(getuid())) {
+                       exit(1);
+               }
 
                VERBOSE(("opening input file\n"));