[kbd] [PATCH 2/2] vlock: handle disappearing ttys gracefully

Dmitry V. Levin ldv at altlinux.org
Fri Jan 23 20:49:13 MSK 2015


vlock used to check for disappearing ttys after PAM_INCOMPLETE error
returned by pam_authenticate.  This change extends the check to cover
other non-fatal error codes that could be returned by pam_authenticate.

Reported-by: Kyle Manna <kyle at kylemanna.com>
---
 src/vlock/auth.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/vlock/auth.c b/src/vlock/auth.c
index dc47ee8..eddce51 100644
--- a/src/vlock/auth.c
+++ b/src/vlock/auth.c
@@ -143,7 +143,9 @@ get_password (pam_handle_t * pamh, const char *username, const char *tty)
 				sleep (LONG_DELAY);
 				break;
 
-			case PAM_INCOMPLETE:
+			default:
+				printf ("%s.\n\n\n", pam_strerror (pamh, rc));
+				fflush (stdout);
 				/*
 				 * EOF encountered on read?
 				 * If not on VT, check stdin.
@@ -161,11 +163,6 @@ get_password (pam_handle_t * pamh, const char *username, const char *tty)
 					"Cancelled lock of %s on %s for %s by (uid=%u)",
 					locked_name (), tty, username, uid);
 				return EXIT_FAILURE;
-
-			default:
-				printf ("%s.\n\n\n", pam_strerror (pamh, rc));
-				fflush (stdout);
-				sleep (SHORT_DELAY);
 		}
 	}
 }

-- 
ldv


More information about the kbd mailing list