From owner-freebsd-current Thu Jun 7 1:16: 2 2001 Delivered-To: freebsd-current@freebsd.org Received: from kalaid.f2f.com.ua (kalaid.f2f.com.ua [62.149.0.33]) by hub.freebsd.org (Postfix) with ESMTP id D7B4537B403; Thu, 7 Jun 2001 01:15:54 -0700 (PDT) (envelope-from sobomax@mail-in.net) Received: from Mail-In.Net (borey.f2f.com.ua [62.149.0.24]) by kalaid.f2f.com.ua (8.11.3/8.11.1) with ESMTP id f578GvC46718; Thu, 7 Jun 2001 11:17:01 +0300 (EEST) (envelope-from sobomax@mail-in.net) Received: from vega.vega.com (das0-l44.uic-in.net [212.35.189.171]) by Mail-In.Net (8.11.3/8.H.Z) with ESMTP id f578GGR53486; Thu, 7 Jun 2001 11:16:16 +0300 (EEST) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.3/8.11.3) with ESMTP id f578Eq011875; Thu, 7 Jun 2001 11:14:52 +0300 (EEST) (envelope-from sobomax@FreeBSD.org) Message-ID: <3B1F37F5.64107FD3@FreeBSD.org> Date: Thu, 07 Jun 2001 11:14:45 +0300 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.77 [en] (WinNT; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: Bruce Evans Cc: current@FreeBSD.org, markm@FreeBSD.org Subject: Re: PAM forgets to unblock signals [was Terminal line discipline is broken [sorta]] References: Content-Type: multipart/mixed; boundary="------------0187D36358D776179D0170D9" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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') { /* 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