summaryrefslogtreecommitdiff
path: root/pam
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-01-24 00:48:56 +0100
committerBastien Nocera <hadess@hadess.net>2020-01-24 00:51:13 +0100
commit6089ba6f40b1411ab3eea0a9472ddc94151b2799 (patch)
tree8b22463e644814c2630c88e5744283fe34bca6a8 /pam
parentee6e8a6fa3f8d494e0e19f17b3a663913fd2342d (diff)
pam: Better debug when timeout is invalid
Diffstat (limited to 'pam')
-rw-r--r--pam/pam_fprintd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pam/pam_fprintd.c b/pam/pam_fprintd.c
index ab17282..015d6a8 100644
--- a/pam/pam_fprintd.c
+++ b/pam/pam_fprintd.c
@@ -45,6 +45,7 @@
#define DEFAULT_MAX_TRIES 3
#define DEFAULT_TIMEOUT 30
+#define MIN_TIMEOUT 10
#define DEBUG_MATCH "debug="
#define MAX_TRIES_MATCH "max-tries="
@@ -654,10 +655,15 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
pam_syslog (pamh, LOG_DEBUG, "max_tries specified as: %d", max_tries);
} else if (str_has_prefix (argv[i], TIMEOUT_MATCH) && strlen(argv[i]) <= strlen (TIMEOUT_MATCH) + 2) {
timeout = atoi (argv[i] + strlen (TIMEOUT_MATCH));
- if (timeout < 10)
- timeout = DEFAULT_TIMEOUT;
- if (debug)
- pam_syslog (pamh, LOG_DEBUG, "timeout specified as: %d", timeout);
+ if (timeout < MIN_TIMEOUT) {
+ if (debug) {
+ pam_syslog (pamh, LOG_DEBUG, "timeout %d secs too low, using %d",
+ timeout, MIN_TIMEOUT);
+ }
+ timeout = MIN_TIMEOUT;
+ } else if (debug) {
+ pam_syslog (pamh, LOG_DEBUG, "timeout specified as: %d secs", timeout);
+ }
}
}
}