]> granicus.if.org Git - sudo/commitdiff
Go back to returning true from display_privs() on non-error. This
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 31 Aug 2017 17:29:19 +0000 (11:29 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 31 Aug 2017 17:29:19 +0000 (11:29 -0600)
results in "sudo -U otheruser -l" exiting with a status of 0 even
when otheruser is not allowed to run commands.  This is appropriate
since the "sudo -l" command was successful.  This does not change
the exit value when otheruser runs "sudo -l" themselves, the exit
status will be 1 since that user is not allowed to run commands.
Requested by Radovan Sroka.

plugins/sudoers/sudo_nss.c

index 18f4de0020692ecd6495962b5c06323a04e378d0..98075ccd6118a846d775bb1be557ec7f2b34f4ea 100644 (file)
@@ -268,8 +268,7 @@ output(const char *buf)
 
 /*
  * Print out privileges for the specified user.
- * Returns true if the user is allowed to run commands, false if not
- * or -1 on error.
+ * Returns true on success or -1 on error.
  */
 int
 display_privs(struct sudo_nss_list *snl, struct passwd *pw)
@@ -348,7 +347,7 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
     sudo_lbuf_destroy(&defs);
     sudo_lbuf_destroy(&privs);
 
-    debug_return_int(count > 0);
+    debug_return_int(true);
 bad:
     sudo_lbuf_destroy(&defs);
     sudo_lbuf_destroy(&privs);