From: "Dmitry V. Levin" <ldv@altlinux.org>
To: kbd@lists.altlinux.org
Subject: [kbd] [PATCH 3/3] vlock: introduce short delays after non-fatal PAM errors
Date: Mon, 25 Nov 2013 01:48:36 +0400 [thread overview]
Message-ID: <20131124214835.GC20405@altlinux.org> (raw)
Add a short delay after PAM errors like PAM_AUTH_ERR that are likely
to be non-fatal, so that in case when they are fatal, there would be
a delay between continuous attempts that are doomed to fail.
For example, fatal PAM configuration errors like unreadable
/etc/pam.d/vlock file usually result to immediate PAM_AUTH_ERR,
the same error as returned by more likely authentication error
due to incorrect password.
---
src/vlock/auth.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/vlock/auth.c b/src/vlock/auth.c
index 76945c0..da135ce 100644
--- a/src/vlock/auth.c
+++ b/src/vlock/auth.c
@@ -35,6 +35,8 @@
/* Delay after fatal PAM errors, in seconds. */
#define LONG_DELAY 10
+/* Delay after other PAM errors, in seconds. */
+#define SHORT_DELAY 1
static int
do_account_password_management (pam_handle_t *pamh)
@@ -117,6 +119,7 @@ get_password (pam_handle_t * pamh, const char *username, const char *tty)
fflush (stdout);
pam_end (pamh, rc);
pamh = 0;
+ sleep (SHORT_DELAY);
break;
}
@@ -135,7 +138,7 @@ get_password (pam_handle_t * pamh, const char *username, const char *tty)
if (is_vt || isatty (STDIN_FILENO))
{
/* Ignore error. */
- sleep (1);
+ sleep (SHORT_DELAY);
break;
}
@@ -162,6 +165,7 @@ get_password (pam_handle_t * pamh, const char *username, const char *tty)
default:
printf ("%s.\n\n\n", pam_strerror (pamh, rc));
fflush (stdout);
+ sleep (SHORT_DELAY);
}
}
}
--
ldv
reply other threads:[~2013-11-24 21:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131124214835.GC20405@altlinux.org \
--to=ldv@altlinux.org \
--cc=kbd@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.