Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 10787 invoked by uid 500); 2 Jul 2001 11:56:27 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 10767 invoked by uid 1121); 2 Jul 2001 11:56:24 -0000 Date: 2 Jul 2001 11:56:24 -0000 Message-ID: <20010702115624.10764.qmail@apache.org> From: trawick@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/user/unix userinfo.c trawick 01/07/02 04:56:23 Modified: . CHANGES user/unix userinfo.c Log: Handle the weird case where getpwnam() returns NULL but errno is zero. This led to a segfault on apache.org when apache did a home directory lookup on an invalid user name. This isn't cool on the part of libc, but oh well. Revision Changes Path 1.117 +3 -0 apr/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apr/CHANGES,v retrieving revision 1.116 retrieving revision 1.117 diff -u -r1.116 -r1.117 --- CHANGES 2001/06/27 19:40:29 1.116 +++ CHANGES 2001/07/02 11:56:19 1.117 @@ -1,5 +1,8 @@ Changes with APR b1 + *) Handle the weird case where getpwnam() returns NULL but errno is zero. + [Jeff Trawick] + *) Add apr_file_flags_get() which returns the flags that were originally passed in to apr_file_open(). [Cliff Woolley] 1.12 +4 -0 apr/user/unix/userinfo.c Index: userinfo.c =================================================================== RCS file: /home/cvs/apr/user/unix/userinfo.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- userinfo.c 2001/03/08 16:05:12 1.11 +++ userinfo.c 2001/07/02 11:56:22 1.12 @@ -74,6 +74,10 @@ #else if ((*pw = getpwnam(username)) == NULL) { #endif + if (errno == 0) { + /* this can happen with getpwnam() on FreeBSD 4.3 */ + return APR_EGENERAL; + } return errno; } return APR_SUCCESS;