atom feed9 messages in org.freebsd.freebsd-bugsRE: kern/14201: setpassent() in libc ...
FromSent OnAttachments
robe...@wojo.comOct 7, 1999 10:58 pm 
Robert Wojciechowski Jr.Oct 7, 1999 11:59 pm 
Ruslan ErmilovOct 8, 1999 12:29 am 
Stephane LegrandOct 8, 1999 1:19 am 
Robert Wojciechowski Jr.Oct 8, 1999 2:49 pm 
Robert Wojciechowski Jr.Oct 8, 1999 7:39 pm 
Robert Wojciechowski Jr.Oct 8, 1999 11:09 pm 
Robert Wojciechowski Jr.Oct 11, 1999 12:59 pm 
ac...@FreeBSD.orgOct 16, 1999 4:54 am 
Subject:RE: kern/14201: setpassent() in libc does not function properly
From:Robert Wojciechowski Jr. (robe@wojo.com)
Date:Oct 8, 1999 7:39:39 pm
List:org.freebsd.freebsd-bugs

The following reply was made to PR kern/14201; it has been noted by GNATS.

From: "Robert Wojciechowski Jr." <robe@wojo.com> To: 'Ruslan Ermilov' <ru@ucb.crimea.ua> Cc: free@FreeBSD.org Subject: RE: kern/14201: setpassent() in libc does not function properly Date: Fri, 8 Oct 1999 22:31:04 -0400

Ruslan,

Looks like the original patch works the best. It works well too. If you look in getgrent.c, it contains the right code to handle the stayopen flag:

/* correct, from getgrent.c */ if (!_gr_stayopen) endgrent(); return(rval ? &_gr_group : NULL);

instead of

/* incorrect */ endgrent(); return(rval ? &_gr_group : NULL);

The incorrect code is what getpwent.c contains. A test for this functionality is the following program:

--SNIP-- #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pwd.h>

int main() { setpassent(1); getpwent();

chroot("/usr"); chdir("/"); if(!getpwuid(0)) { printf("setpassent doesn't appear to work\n"); } else { if(!getpwuid(0)) printf("second getpwuid(0) didn't work\n"); else printf("setpassent works\n"); } return 0; } --SNIP--

It passes with flying colors after the fix.

Best regards,

Robert S. Wojciechowski Jr. robe@wojo.com

PGP: 0xF2CA68F2 - http://www.wojo.com/pgpkeys/robertw.asc

-----Original Message----- From: Ruslan Ermilov [mailto:ru@ucb.crimea.ua] Sent: Friday, October 08, 1999 3:20 AM To: Robert Wojciechowski Jr. Cc: free@FreeBSD.org Subject: Re: kern/14201: setpassent() in libc does not function properly

On Fri, Oct 08, 1999 at 12:00:01AM -0700, Robert Wojciechowski Jr. wrote:

The patch in this bug report does not work fully. I patched the endpwent() function, and it works correctly now:

244,246d243 < if (_pw_stayopen) < return; <

It will keep the fd open when setpassent(int stayopen) is passed 1. It's now behaving the way it should ;)

And endpwent() will never close the file :-(

-- Ruslan Ermilov Sysadmin and DBA of the ru@ucb.crimea.ua United Commercial Bank, ru@FreeBSD.org FreeBSD committer, +380.652.247.647 Simferopol, Ukraine

http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age

To Unsubscribe: send mail to majo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message