summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-12-23 02:19:52 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-12-23 02:19:52 +0000
commit39803152a5292e02e577bbb1291f89961c2f7158 (patch)
tree4bb91aaa017d13f81643f66d885e662f9e5e7a6b /usr.bin
parentd7fd4a13c62ac2d16ea4e2646be3b76940fef497 (diff)
If we are in -k/-K mode, just spew to stderr. It is not unusual
for users to place "sudo -k" in a .logout file which can cause sudo to be run during reboot after ypbind has died. Previously, this would result in useless mail and logging. Requested by mickey@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sudo/sudo.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/sudo/sudo.c b/usr.bin/sudo/sudo.c
index b77818ede4f..26feb1f71a3 100644
--- a/usr.bin/sudo/sudo.c
+++ b/usr.bin/sudo/sudo.c
@@ -529,8 +529,14 @@ init_vars(sudo_mode)
pw.pw_name = pw_name;
sudo_user.pw = &pw;
- log_error(0, "uid %lu does not exist in the passwd file!",
- (unsigned long) pw.pw_uid);
+ /*
+ * If we are in -k/-K mode, just spew to stderr. It is not unusual for
+ * users to place "sudo -k" in a .logout file which can cause sudo to
+ * be run during reboot after the YP/NIS/NIS+/LDAP/etc daemon has died.
+ */
+ if (sudo_mode & (MODE_INVALIDATE|MODE_KILL))
+ errx(1, "uid %s does not exist in the passwd file!", pw_name);
+ log_error(0, "uid %s does not exist in the passwd file!", pw_name);
}
if (user_shell == NULL || *user_shell == '\0')
user_shell = sudo_user.pw->pw_shell;