]> granicus.if.org Git - sudo/commitdiff
now fixes mode on sudoers if set to 0400 to aid in upgrade
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 29 Apr 1996 02:38:36 +0000 (02:38 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 29 Apr 1996 02:38:36 +0000 (02:38 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index 4ca65feae50609cb47eb603a33838888425b92ed..a5ab643b9b9e8146eb74eb3554869de829ba2a32 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -717,8 +717,20 @@ static int check_sudoers()
        rtn = SUDOERS_NOT_FILE;
     else if (statbuf.st_uid != SUDOERS_UID || statbuf.st_gid != SUDOERS_GID)
        rtn = SUDOERS_WRONG_OWNER;
-    else if ((statbuf.st_mode & 0007777) != SUDOERS_MODE)
-       rtn = SUDOERS_WRONG_MODE;
+    else if ((statbuf.st_mode & 0007777) != SUDOERS_MODE) {
+       if ((statbuf.st_mode & 0007777) == 0400) {
+           if (chmod(_PATH_SUDO_SUDOERS, SUDOERS_MODE) == 0) {
+               fprintf(stderr, "%s: fixed mode on %s\n", Argv[0],
+                   _PATH_SUDO_SUDOERS);
+           } else {
+               fprintf(stderr, "%s: Unable to fix mode on %s: ", Argv[0],
+                   _PATH_SUDO_SUDOERS);
+               perror("");
+           }
+       } else {
+           rtn = SUDOERS_WRONG_MODE;
+       }
+    }
 
     (void) close(fd);