summaryrefslogtreecommitdiffstats
path: root/contrib/libpam
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-06-07 08:45:23 +0000
committermarkm <markm@FreeBSD.org>2001-06-07 08:45:23 +0000
commit08c505f1583b0af1214197fea359a1863bd7a953 (patch)
tree4c3b58c09988d66115ebc74082a3ce908868af30 /contrib/libpam
parent3bf60cd1547fbc06bebd77310d41ec219b9dd94f (diff)
downloadFreeBSD-src-08c505f1583b0af1214197fea359a1863bd7a953.zip
FreeBSD-src-08c505f1583b0af1214197fea359a1863bd7a953.tar.gz
Fix bug introduced by myself that often resulted in a session having
SIGINTR (^C) and SIGSTP (^Z) masked. Reported by: bde, sobomax Submitted by: sobomax
Diffstat (limited to 'contrib/libpam')
-rw-r--r--contrib/libpam/libpam_misc/misc_conv.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/contrib/libpam/libpam_misc/misc_conv.c b/contrib/libpam/libpam_misc/misc_conv.c
index b0f62a2..51069c8 100644
--- a/contrib/libpam/libpam_misc/misc_conv.c
+++ b/contrib/libpam/libpam_misc/misc_conv.c
@@ -132,6 +132,7 @@ static int get_delay(void)
static char *read_string(int echo, const char *prompt)
{
struct termios term_before, term_tmp;
+ char *input;
char line[INPUTSIZE];
struct sigaction old_sig;
int delay, nc, have_term=0;
@@ -191,8 +192,6 @@ static char *read_string(int echo, const char *prompt)
if (expired) {
delay = get_delay();
} else if (nc > 0) { /* we got some user input */
- char *input;
-
if (nc > 0 && line[nc-1] == '\n') { /* <NUL> terminate */
line[--nc] = '\0';
} else {
@@ -201,25 +200,25 @@ static char *read_string(int echo, const char *prompt)
input = x_strdup(line);
_pam_overwrite(line);
- return input; /* return malloc()ed string */
+ goto cleanexit; /* return malloc()ed string */
} else if (nc == 0) { /* Ctrl-D */
- char *input;
-
D(("user did not want to type anything"));
input = x_strdup("");
- return input; /* return malloc()ed string */
+ goto cleanexit; /* return malloc()ed string */
}
}
}
/* getting here implies that the timer expired */
+ memset(line, 0, INPUTSIZE); /* clean up */
+ input = NULL;
+
+cleanexit:
if (have_term) {
(void)_sigprocmask(SIG_SETMASK, &oset, NULL);
(void) tcsetattr(STDIN_FILENO, TCSADRAIN, &term_before);
}
-
- memset(line, 0, INPUTSIZE); /* clean up */
- return NULL;
+ return input;
}
/* end of read_string functions */
OpenPOWER on IntegriCloud