summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-12-07 03:48:40 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-12-07 03:48:40 +0000
commit678a3da1587d4d9b55b7bba08dd34904fdd74005 (patch)
treed8a6119499d7747ce52b9024e7e95f448e741024
parent195f436790b6c2bc4ab92b1463814192ca2cc3bb (diff)
Catch SIGINT and SIGQUIT via the kbintr() signal handler.
Now that getpass() is interuptible we need to catch these so that the "Password unchanged." message is printed.
-rw-r--r--usr.bin/passwd/local_passwd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/passwd/local_passwd.c b/usr.bin/passwd/local_passwd.c
index 932e9fe6026..ae4e14eb7ae 100644
--- a/usr.bin/passwd/local_passwd.c
+++ b/usr.bin/passwd/local_passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: local_passwd.c,v 1.22 2001/11/19 19:02:15 mpech Exp $ */
+/* $OpenBSD: local_passwd.c,v 1.23 2001/12/07 03:48:39 millert Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static const char sccsid[] = "from: @(#)local_passwd.c 5.5 (Berkeley) 5/6/91";*/
-static const char rcsid[] = "$OpenBSD: local_passwd.c,v 1.22 2001/11/19 19:02:15 mpech Exp $";
+static const char rcsid[] = "$OpenBSD: local_passwd.c,v 1.23 2001/12/07 03:48:39 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -152,6 +152,9 @@ getnewpasswd(pw, lc, authenticated)
int tries, pwd_tries;
char buf[_PASSWORD_LEN+1], salt[_PASSWORD_LEN];
+ (void)signal(SIGINT, kbintr);
+ (void)signal(SIGQUIT, kbintr);
+
if (!authenticated) {
(void)printf("Changing local password for %s.\n", pw->pw_name);
if (uid && pw->pw_passwd[0] &&
@@ -187,6 +190,9 @@ getnewpasswd(pw, lc, authenticated)
(void)printf("Couldn't generate salt.\n");
pw_error(NULL, 0, 0);
}
+ (void)signal(SIGINT, SIG_DFL);
+ (void)signal(SIGQUIT, SIG_DFL);
+
return(crypt(buf, salt));
}