Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 1999 14:50:01 -0700 (PDT)
From:      "Robert Wojciechowski Jr." <robertw@wojo.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   RE: kern/14201: setpassent() in libc does not function properly
Message-ID:  <199910082150.OAA29972@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/14201; it has been noted by GNATS.

From: "Robert Wojciechowski Jr." <robertw@wojo.com>
To: 'Ruslan Ermilov' <ru@ucb.crimea.ua>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: RE: kern/14201: setpassent() in libc does not function properly
Date: Fri, 8 Oct 1999 17:43:59 -0400 

 A test for this bug is:
 
 #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;
 }
 
 Right now, the second getpwuid(0) call fails.  Adding the if (!_pw_stayopen)
 before the endpwent() in both getpwnam() and getpwuid() lets this test pass,
 but is it a sufficient fix?
 
 Is a closing call to endpwent() necessary for a program to correctly close
 the database?
 
 Robert S. Wojciechowski Jr.
 robertw@wojo.com
 
 PGP: 0xF2CA68F2 - http://www.wojo.com/pgpkeys/robertw.asc
 
 


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199910082150.OAA29972>