Date: Wed, 19 Feb 1997 00:19:06 -0700 (MST) From: marcs@znep.com To: FreeBSD-gnats-submit@freebsd.org Subject: ports/2766: sudo doesn't let you enter password sometimes Message-ID: <199702190719.AAA27052@vole.worldgate.com> Resent-Message-ID: <199702190720.XAA09376@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2766 >Category: ports >Synopsis: sudo doesn't let you enter password sometimes >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 18 23:20:04 PST 1997 >Last-Modified: >Originator: Marc Slemko >Organization: >Release: FreeBSD 2.2-GAMMA i386 >Environment: Using the sudo.v1.5.3 package on 2.2-GAMMA as of a day or two ago. >Description: Once in a while, when you go to enter your password in sudo it will time out right away and print the password prompt then put you back in your shell; you don't get a chance to enter it. This happened very occasionally on 2.1-stable, but seems to happen a lot on 2.2 especially using screen. >How-To-Repeat: >Fix: Apply the following patch. sudo was using the results of sysconf(_SC_OPEN_MAX) to set the nfds for select(). That's broken, especially with the changes in 2.2. *** tgetpass.c.dist Wed Feb 19 00:09:13 1997 --- tgetpass.c Wed Feb 19 00:09:21 1997 *************** *** 206,223 **** tv.tv_sec = timeout; tv.tv_usec = 0; - /* how many file descriptors may we have? */ - #ifdef HAVE_SYSCONF - n = sysconf(_SC_OPEN_MAX); - #else - n = getdtablesize(); - #endif /* HAVE_SYSCONF */ - /* * get password or return empty string if nothing to read by timeout */ buf[0] = '\0'; ! if (select(n, &readfds, 0, 0, &tv) > 0 && fgets(buf, sizeof(buf), input)) { n = strlen(buf); if (buf[n - 1] == '\n') buf[n - 1] = '\0'; --- 206,216 ---- tv.tv_sec = timeout; tv.tv_usec = 0; /* * get password or return empty string if nothing to read by timeout */ buf[0] = '\0'; ! if (select(fileno(input)+1, &readfds, 0, 0, &tv) > 0 && fgets(buf, sizeof(buf), input)) { n = strlen(buf); if (buf[n - 1] == '\n') buf[n - 1] = '\0'; >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702190719.AAA27052>