You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2001/07/02 13:56:24 UTC

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;
  
  
  

Re: cvs commit: apr/user/unix userinfo.c

Posted by Jeff Trawick <tr...@attglobal.net>.
trawick@apache.org writes:

> 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.

This really sucks, but whatcha gonna do?

See /usr/local/apache/corefiles/httpd.core.20 if you're curious.
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...