aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_securetty/pam_securetty.c
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2010-07-29 20:16:39 -0700
committerSteve Langasek <vorlon@debian.org>2019-01-08 21:32:38 -0800
commit655c7a8843261079fecf0b6e15de77972a0eb708 (patch)
tree167aeb717538bdc9f685a652009038d586530779 /modules/pam_securetty/pam_securetty.c
parent6ce511785e4b9751ef184236c2cf8f63bc25f512 (diff)
parent8645d4f5131d25692dfd78d3e1c46b03f33febf3 (diff)
downloadpam-655c7a8843261079fecf0b6e15de77972a0eb708.tar.gz
pam-655c7a8843261079fecf0b6e15de77972a0eb708.tar.bz2
pam-655c7a8843261079fecf0b6e15de77972a0eb708.zip
merge from trunk
Diffstat (limited to 'modules/pam_securetty/pam_securetty.c')
-rw-r--r--modules/pam_securetty/pam_securetty.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/pam_securetty/pam_securetty.c b/modules/pam_securetty/pam_securetty.c
index ec796d9e..a3c2010d 100644
--- a/modules/pam_securetty/pam_securetty.c
+++ b/modules/pam_securetty/pam_securetty.c
@@ -86,13 +86,11 @@ securetty_perform_check (pam_handle_t *pamh, int ctrl,
}
user_pwd = pam_modutil_getpwnam(pamh, username);
- if (user_pwd == NULL) {
- return PAM_USER_UNKNOWN;
- } else if (user_pwd->pw_uid != 0) { /* If the user is not root,
- securetty's does not apply
- to them */
+ if (user_pwd != NULL && user_pwd->pw_uid != 0) {
+ /* If the user is not root, securetty's does not apply to them */
return PAM_SUCCESS;
}
+ /* The user is now either root or an invalid / mistyped username */
retval = pam_get_item(pamh, PAM_TTY, &void_uttyname);
uttyname = void_uttyname;
@@ -151,6 +149,9 @@ securetty_perform_check (pam_handle_t *pamh, int ctrl,
uttyname);
retval = PAM_AUTH_ERR;
+ if (user_pwd == NULL) {
+ retval = PAM_USER_UNKNOWN;
+ }
} else {
if (ctrl & PAM_DEBUG_ARG) {
pam_syslog(pamh, LOG_DEBUG, "access allowed for '%s' on '%s'",