summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-06-04 20:59:49 +0000
committermarkm <markm@FreeBSD.org>2001-06-04 20:59:49 +0000
commitde2da57776a6827d39a75f7e204c1e851031457f (patch)
tree94608d9578519f4130e3a89b65989132152032b8 /contrib
parent2357540bf08c861c50a2b6792e9819cee136e3db (diff)
downloadFreeBSD-src-de2da57776a6827d39a75f7e204c1e851031457f.zip
FreeBSD-src-de2da57776a6827d39a75f7e204c1e851031457f.tar.gz
In the same manner as getpass(3), block SIGINTR and SIGSTP while we are
actually reading the line.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libpam/libpam_misc/misc_conv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/libpam/libpam_misc/misc_conv.c b/contrib/libpam/libpam_misc/misc_conv.c
index 1395b17..b0f62a2 100644
--- a/contrib/libpam/libpam_misc/misc_conv.c
+++ b/contrib/libpam/libpam_misc/misc_conv.c
@@ -135,6 +135,7 @@ static char *read_string(int echo, const char *prompt)
char line[INPUTSIZE];
struct sigaction old_sig;
int delay, nc, have_term=0;
+ sigset_t oset, nset;
D(("called with echo='%s', prompt='%s'.", echo ? "ON":"OFF" , prompt));
@@ -150,6 +151,14 @@ static char *read_string(int echo, const char *prompt)
term_tmp.c_lflag &= ~(ECHO);
}
have_term = 1;
+ /*
+ * note - blocking signals isn't necessarily the
+ * right thing, but we leave it for now.
+ */
+ sigemptyset(&nset);
+ sigaddset(&nset, SIGINT);
+ sigaddset(&nset, SIGTSTP);
+ (void)_sigprocmask(SIG_BLOCK, &nset, &oset);
} else if (!echo) {
D(("<warning: cannot turn echo off>"));
@@ -204,8 +213,10 @@ static char *read_string(int echo, const char *prompt)
}
/* getting here implies that the timer expired */
- if (have_term)
+ if (have_term) {
+ (void)_sigprocmask(SIG_SETMASK, &oset, NULL);
(void) tcsetattr(STDIN_FILENO, TCSADRAIN, &term_before);
+ }
memset(line, 0, INPUTSIZE); /* clean up */
return NULL;
OpenPOWER on IntegriCloud