diff options
author | Jeff Trawick <trawick@apache.org> | 2001-07-02 11:56:22 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2001-07-02 11:56:22 +0000 |
commit | 8992d1368cdc994ca109472476e95cd948b57876 (patch) | |
tree | b0e4c93ea71d95a4cc1faa3df39397305c693d02 /user/unix | |
parent | c7687a569dff70b6a7caf94eb901dafbf9de458d (diff) | |
download | apr-8992d1368cdc994ca109472476e95cd948b57876.tar.gz |
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.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61853 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'user/unix')
-rw-r--r-- | user/unix/userinfo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/user/unix/userinfo.c b/user/unix/userinfo.c index ac0b386fb..aa062f442 100644 --- a/user/unix/userinfo.c +++ b/user/unix/userinfo.c @@ -74,6 +74,10 @@ static apr_status_t getpwnam_safe(const char *username, #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; |