* movemail.c: Don't grant more read permissions than necessary.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 13 Mar 2013 01:05:40 +0000 (18:05 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 13 Mar 2013 01:05:40 +0000 (18:05 -0700)
The old 0333 dates back to before we called setuid,
so it was needed back then to ensure user-readability,
but 0377 should suffice now.

lib-src/ChangeLog
lib-src/movemail.c

index 9900f38..67c17cd 100644 (file)
@@ -2,6 +2,10 @@
 
        * movemail.c (main): Call umask on all systems.
        This is OK since Emacs already assumes umask elsewhere.
+       Don't grant more read permissions than necessary.
+       The old 0333 dates back to before we called setuid,
+       so it was needed back then to ensure user-readability,
+       but 0377 should suffice now.
 
 2013-02-08  Paul Eggert  <eggert@cs.ucla.edu>
 
index 386e28d..190937d 100644 (file)
@@ -380,9 +380,9 @@ main (int argc, char **argv)
       if (indesc < 0)
        pfatal_with_name (inname);
 
-      /* In case movemail is setuid to root, make sure the user can
-        read the output file.  */
-      umask (umask (0) & 0333);
+      /* Make sure the user can read the output file.  */
+      umask (umask (0) & 0377);
+
       outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666);
       if (outdesc < 0)
        pfatal_with_name (outname);