Subject: lib/2442: getpass.c changes have bugs and block SIGINT/SIGTSTP forever
To: None <gnats-bugs@NetBSD.ORG>
From: James Michael Chacon <jmc@hedgehog.com>
List: netbsd-bugs
Date: 05/19/1996 18:06:20
>Number: 2442
>Category: lib
>Synopsis: getpass.c changes block SIGINT/SIGTSTP and don't reset them.
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 19 21:35:03 1996
>Last-Modified:
>Originator: James Chacon
>Organization:
>Release: may-18-96
>Environment:
System: NetBSD quix 1.1B NetBSD 1.1B (QUIX) #28: Sun May 19 04:28:32 PDT 1996 root@quix:/export/data/src-current/NetBSD-current/src/sys/arch/i386/compile/QUIX i386
>Description:
The changes to getpass.c from May 16th changed the sigblock()
calls to use the POSIX style sigprocmask calls instead. However the
last sigprocmask gets called with the wrong sigmask. Calling it with
the new mask doesn't do a whole lot of good since it's already set to those :-)
Anyways, any program which calls getpass has those 2 signals blocked
and this gets transmitted to all children of the process. This means
after logging in control-C no longer works and suspending a shell no
longer works either. The attached patch fixes this.
>How-To-Repeat:
Compile libc and install it from a may-17 sup or later. Notice
that any program which calls getpass() loses on SIGINT/SIGTSTP after that.
For instance, logging in on the console/telnet/ssh/etc.
>Fix:
Index: getpass.c
===================================================================
RCS file: /export/data/src-current/cvs/NetBSD-current/src/lib/libc/gen/getpass.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 getpass.c
*** getpass.c 1996/05/17 14:18:41 1.1.1.2
--- getpass.c 1996/05/20 00:50:24
***************
*** 95,101 ****
term.c_lflag |= ECHO;
(void)tcsetattr(fileno(fp), TCSAFLUSH|TCSASOFT, &term);
}
! (void)sigprocmask(SIG_SETMASK, &nset, NULL);
if (fp != stdin)
(void)fclose(fp);
return(buf);
--- 95,101 ----
term.c_lflag |= ECHO;
(void)tcsetattr(fileno(fp), TCSAFLUSH|TCSASOFT, &term);
}
! (void)sigprocmask(SIG_SETMASK, &oset, NULL);
if (fp != stdin)
(void)fclose(fp);
return(buf);
>Audit-Trail:
>Unformatted: