summaryrefslogtreecommitdiff
path: root/modules/pam_securetty
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_securetty')
-rw-r--r--modules/pam_securetty/pam_securetty.c14
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';