]> granicus.if.org Git - sudo/commitdiff
Fix the sudoers permission check when the expected sudoers mode is
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 31 Jan 2012 21:25:07 +0000 (16:25 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 31 Jan 2012 21:25:07 +0000 (16:25 -0500)
owner-writable.

--HG--
branch : 1.7

sudo.c

diff --git a/sudo.c b/sudo.c
index 67bd67ef0449b10570a8d37dabb38c00aa4d8851..1efbbb6c6be1911a94d613c5b607ba3233925deb 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -1035,7 +1035,7 @@ open_sudoers(sudoers, doedit, keepopen)
        log_error(USE_ERRNO|NO_EXIT, "can't stat %s", sudoers);
     else if (!S_ISREG(statbuf.st_mode))
        log_error(NO_EXIT, "%s is not a regular file", sudoers);
-    else if ((statbuf.st_mode & 07577) != SUDOERS_MODE)
+    else if ((statbuf.st_mode & 07577) != (SUDOERS_MODE & 07577))
        log_error(NO_EXIT, "%s is mode 0%o, should be 0%o", sudoers,
            (unsigned int) (statbuf.st_mode & 07777),
            (unsigned int) SUDOERS_MODE);