]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorThorsten Kukuk <kukuk@thkukuk.de>
Mon, 24 Nov 2003 14:46:06 +0000 (14:46 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Mon, 24 Nov 2003 14:46:06 +0000 (14:46 +0000)
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.

modules/pam_securetty/pam_securetty.c

index a5ae0df8ed1e6e257790c4b4583ec171d6d88ad6..274b3b7439e05e4b78215dc37d8b1d765d94a25a 100644 (file)
@@ -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';