diff options
author | Thorsten Kukuk <kukuk@thkukuk.de> | 2003-11-24 14:46:06 +0000 |
---|---|---|
committer | Thorsten Kukuk <kukuk@thkukuk.de> | 2003-11-24 14:46:06 +0000 |
commit | 133dfdf24686821d5c716a711c26ee141bd96843 (patch) | |
tree | 0d6352a194e4273de17bf40e2b4f067bffd7594f | |
parent | 5bd5fb9f27e6cd355202896ed2fe873a36dcf9da (diff) | |
download | pam-133dfdf24686821d5c716a711c26ee141bd96843.tar.gz pam-133dfdf24686821d5c716a711c26ee141bd96843.tar.bz2 pam-133dfdf24686821d5c716a711c26ee141bd96843.zip |
Relevant BUGIDs:
Purpose of commit:
bugfix for pam_securetty
Commit summary:
---------------
Move the first usage of uttyname ofter the initialisation
(Bug # 848316). This move was forgetten with the last changes.
-rw-r--r-- | modules/pam_securetty/pam_securetty.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/pam_securetty/pam_securetty.c b/modules/pam_securetty/pam_securetty.c index a5ae0df8..274b3b74 100644 --- a/modules/pam_securetty/pam_securetty.c +++ b/modules/pam_securetty/pam_securetty.c @@ -97,11 +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); } - /* 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; - } - user_pwd = getpwnam(username); if (user_pwd == NULL) { return PAM_IGNORE; @@ -119,6 +114,11 @@ static int securetty_perform_check(pam_handle_t *pamh, int flags, int ctrl, 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; + } + if (stat(SECURETTY_FILE, &ttyfileinfo)) { _pam_log(LOG_NOTICE, "Couldn't open " SECURETTY_FILE); return PAM_SUCCESS; /* for compatibility with old securetty handling, @@ -146,10 +146,10 @@ static int securetty_perform_check(pam_handle_t *pamh, int flags, int ctrl, } else { ptname[0] = '\0'; } - + retval = 1; - while ((fgets(ttyfileline, sizeof(ttyfileline)-1, ttyfile) != NULL) + while ((fgets(ttyfileline, sizeof(ttyfileline)-1, ttyfile) != NULL) && retval) { if (ttyfileline[strlen(ttyfileline) - 1] == '\n') ttyfileline[strlen(ttyfileline) - 1] = '\0'; |