Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Jun 2001 11:14:45 +0300
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@FreeBSD.org, markm@FreeBSD.org
Subject:   Re: PAM forgets to unblock signals [was Terminal line discipline is  broken [sorta]]
Message-ID:  <3B1F37F5.64107FD3@FreeBSD.org>
References:  <Pine.BSF.4.21.0106071155480.1587-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------0187D36358D776179D0170D9
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit

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


--------------0187D36358D776179D0170D9
Content-Type: text/plain; charset=koi8-r;
 name="misc_conv.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="misc_conv.c.diff"

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 */

--------------0187D36358D776179D0170D9--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B1F37F5.64107FD3>