summaryrefslogtreecommitdiff
path: root/user/unix
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2001-07-02 11:56:22 +0000
committerJeff Trawick <trawick@apache.org>2001-07-02 11:56:22 +0000
commit8992d1368cdc994ca109472476e95cd948b57876 (patch)
treeb0e4c93ea71d95a4cc1faa3df39397305c693d02 /user/unix
parentc7687a569dff70b6a7caf94eb901dafbf9de458d (diff)
downloadapr-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.c4
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;