From owner-freebsd-hackers Wed Aug 26 13:31:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA10356 for freebsd-hackers-outgoing; Wed, 26 Aug 1998 13:31:19 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from lituussun (irc.ladapt.org [195.25.51.6]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id NAA10351 for ; Wed, 26 Aug 1998 13:31:15 -0700 (PDT) (envelope-from stephane@lituus.fr) Received: from (sequoia.lituus.fr) [193.252.208.74] by lituussun with esmtp (Exim 1.82 #1) id 0zBn4W-0001DC-00; Wed, 26 Aug 1998 22:25:42 +0100 Received: (from root@localhost) by sequoia.lituus.fr (8.9.1/8.9.1) id VAA02683; Mon, 24 Aug 1998 21:58:18 +0200 (CEST) (envelope-from root) Date: Mon, 24 Aug 1998 21:58:18 +0200 (CEST) Message-Id: <199808241958.VAA02683@sequoia.lituus.fr> From: Stephane Legrand MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: hackers@FreeBSD.ORG Cc: mackler@barter.dewline.com Subject: getpwnam() and getpwuid() functions in libc (was ProFTPD - pwd.db) In-Reply-To: <199808190614.CAA26143@barter.dewline.com> References: <199808190614.CAA26143@barter.dewline.com> X-Mailer: VM 6.34 under 20.3 "Vatican City" XEmacs Lucid Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, I tested the patch proposed by Adam Mackler on FreeBSD-current and it works well. It corrects a problem with ProFTPD. As the ProFTPD author (Floody ) say, the FreeBSD libc seems to be really different from the others *BSD for that particular point. Should the endpwent() function be called only if _pw_stayopen is false (as the patch suggests and as others *BSD seem do) ? Adam Mackler writes: > > Date: Thu, 6 Aug 1998 17:50:08 -0400 > > From: Floody > > Reply-To: proftpd-l@evcom.net > > To: Karl Pielorz > > Cc: proftpd-l@evcom.net > > Subject: Re: [proftpd-l] New ProFTPd user - Security, Incoming and pwd.db? > > > > Ok. I put up a test FreeBSD 2.2.7 system. There appears to be a libc > > problem with the setpassent() function, which doesn't work on FreeBSD as > > documented in the man pages (or on any other BSD). This is the heart of > > the problem. There is no workaround until libc is fixed. > > Hi: > > I think the following patch may fix the problem, but I'm afraid > I don't know how to rebuild my c library. If you find out if this > works can you let me know? Thanks. > > > *** getpwent.c Wed Aug 19 02:00:13 1998 > --- getpwent.c.dist Wed Aug 19 01:58:33 1998 > *************** > *** 194,201 **** > if (rval && (_pw_passwd.pw_name[0] == '+'|| > _pw_passwd.pw_name[0] == '-')) rval = 0; > > ! if (!_pw_stayopen) > ! endpwent(); > return(rval ? &_pw_passwd : (struct passwd *)NULL); > } > > --- 194,200 ---- > if (rval && (_pw_passwd.pw_name[0] == '+'|| > _pw_passwd.pw_name[0] == '-')) rval = 0; > > ! endpwent(); > return(rval ? &_pw_passwd : (struct passwd *)NULL); > } > > > -- > Adam Mackler > Dewline Communications, LLC > 212-505-9149 > -- stephane@lituus.fr | systeme d'exploitation FreeBSD http://195.25.51.6/stephane/ | http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message