diff options
author | Steve Langasek <vorlon@debian.org> | 2003-07-13 06:10:08 +0000 |
---|---|---|
committer | Steve Langasek <vorlon@debian.org> | 2003-07-13 06:10:08 +0000 |
commit | 1095d016c3e1d838e8b3b81425d34cf3027b87be (patch) | |
tree | 28726883c5c2c166f37d71f483f528ab22960349 | |
parent | b78954ae95f3250edd1f8026a2e443d2de2f8c8d (diff) | |
download | pam-1095d016c3e1d838e8b3b81425d34cf3027b87be.tar.gz pam-1095d016c3e1d838e8b3b81425d34cf3027b87be.tar.bz2 pam-1095d016c3e1d838e8b3b81425d34cf3027b87be.zip |
Relevant BUGIDs: patch 476967
Purpose of commit: bugfix
Commit summary:
---------------
Patch from Nalin Dahyabhai: an empty tty value is not fatal when the
user isn't root.
-rw-r--r-- | modules/pam_securetty/pam_securetty.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/pam_securetty/pam_securetty.c b/modules/pam_securetty/pam_securetty.c index c69180ab..a5ae0df8 100644 --- a/modules/pam_securetty/pam_securetty.c +++ b/modules/pam_securetty/pam_securetty.c @@ -97,14 +97,6 @@ static int securetty_perform_check(pam_handle_t *pamh, int flags, int ctrl, return (retval == PAM_CONV_AGAIN ? PAM_INCOMPLETE:PAM_SERVICE_ERR); } - retval = pam_get_item(pamh, PAM_TTY, (const void **)&uttyname); - if (retval != PAM_SUCCESS || uttyname == NULL) { - if (ctrl & PAM_DEBUG_ARG) { - _pam_log(LOG_WARNING, "cannot determine user's tty"); - } - return PAM_SERVICE_ERR; - } - /* The PAM_TTY item may be prefixed with "/dev/" - skip that */ if (strncmp(TTY_PREFIX, uttyname, sizeof(TTY_PREFIX)-1) == 0) { uttyname += sizeof(TTY_PREFIX)-1; @@ -119,6 +111,14 @@ static int securetty_perform_check(pam_handle_t *pamh, int flags, int ctrl, return PAM_SUCCESS; } + retval = pam_get_item(pamh, PAM_TTY, (const void **)&uttyname); + if (retval != PAM_SUCCESS || uttyname == NULL) { + if (ctrl & PAM_DEBUG_ARG) { + _pam_log(LOG_WARNING, "cannot determine user's tty"); + } + return PAM_SERVICE_ERR; + } + if (stat(SECURETTY_FILE, &ttyfileinfo)) { _pam_log(LOG_NOTICE, "Couldn't open " SECURETTY_FILE); return PAM_SUCCESS; /* for compatibility with old securetty handling, |