posix_getpwnam() and empty names in server-side included php files?
| From: | Jerry | Date: | Wed, 28 Jun 2000 18:55:24 +0000 |
| Subject: | posix_getpwnam() and empty names in server-side included php files? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3637@lists.php.net to get a copy of this message | ||
This has been an annoying problem:
I have a 'phonebook' search page that searches for users in our ldap
database. Part of the information the ldap database holds is the user's
username.
I take the username and pass it to posix_getpwnam() to get that user's
'dir' entry. I can then check to see if the user has a public web page
and link to it.
One of our users, when matched in the search, causes the php script to
fail--or more spefically, the entire connection is terminated, and 'the
document contained no data'. Viewing the transcript of all data
transferred shows that no data at all is returned: no headers or
document.
This is the line where the 'crash' occurs:
$userInfo = posix_getpwnam($user);
Note that all other users that I've tested work fine when the search
returns them; but if someone does a search that returns the one 'bad'
user, the connection gets terminated with absolutely no data returned.
This only happens if the PHP script is called as a server-side include!
<!--#include virtual="bad.php3" -->
You can see a test page at:
http://www.acusd.edu/ac/etc/people.shtml?name=jerold
will return data
http://www.acusd.edu/ac/etc/people.shtml?name=magnin
will return nothing
http://www.acusd.edu/ac/etc/bad.php3?name=magnin
will return data
The latter URL is for the PHP script that the 'people.shtml' file does
an 'include' for.
One data point: this user has no name in the password file. This is the
only user for which that is true. The user has an entry, but the name
field is empty. I don't have access to change the password file, though
I've recommended this be changed. Why this would matter only for
server-side includes, I don't know, so I don't know that this is really
the problem.
Now, I guess I'm assuming that this is really a system problem and not a
PHP problem. But I'd like to find some way of ensuring that my script
doesn't crash when it runs into a problem like this.
I have tried:
1. Increasing the maximum memory that PHP allows itself in php3.ini.
2. Putting the posix_getpwnam() call into an 'eval' statement.
Neither matters.
Has anyone run into anything like this before?
Jerry
http://www.acusd.edu/~jerry/