Bruce Evans wrote:
On Wed, 6 Jun 2001, Maxim Sobolev wrote:
It is very strange, but control keys [^C,^Z etc] no longer work (nop)
in the /bin/sh and bash2 after today's build/installworld. I see this
misbehaviour on two machines.
PAM now blocks keyboard signals when reading the password, and usually
forgets to unblock them. I use the workaround of backing out the broken
code (rev.1.4 of /usr/src/contrib/libpam/libpam_misc/misc_conv.c).
That explains... Attached patch solved the problem for me.
Even more strange that /bin/tcsh doesn't
have this problem.
This may be a bug in tcsh.
Maybe...
-Maxim
Index: misc_conv.c
===
RCS file: /home/ncvs/src/contrib/libpam/libpam_misc/misc_conv.c,v
retrieving revision 1.4
diff -d -u -r1.4 misc_conv.c
--- misc_conv.c 2001/06/04 20:59:49 1.4
+++ misc_conv.c 2001/06/07 08:10:55
@@ -132,6 +132,7 @@
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 @@
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,27 @@
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 */