From owner-freebsd-ports Tue Feb 18 23:20:11 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id XAA09397 for ports-outgoing; Tue, 18 Feb 1997 23:20:11 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id XAA09376; Tue, 18 Feb 1997 23:20:06 -0800 (PST) Resent-Date: Tue, 18 Feb 1997 23:20:06 -0800 (PST) Resent-Message-Id: <199702190720.XAA09376@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-ports Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, marcs@znep.com Received: from vole.worldgate.com (marcs@vole.worldgate.com [198.161.84.13]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA09276 for ; Tue, 18 Feb 1997 23:19:08 -0800 (PST) Received: (from marcs@localhost) by vole.worldgate.com (8.8.5/8.8.5) id AAA27052; Wed, 19 Feb 1997 00:19:06 -0700 (MST) Message-Id: <199702190719.AAA27052@vole.worldgate.com> Date: Wed, 19 Feb 1997 00:19:06 -0700 (MST) From: marcs@znep.com Reply-To: marcs@znep.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/2766: sudo doesn't let you enter password sometimes Sender: owner-ports@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >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: