From: php at gunnarwrobel dot de
Operating system: Gentoo 2004.2
PHP version: 4.3.8
PHP Bug Type: LDAP related
Bug description: ldap_bind does a dns lookup for "localhost" (mod_php not CLI)
Description:
------------
After connecting to OpenLDAP on "localhost" subsequent binding fails.
This only happens in mod_php, not with CLI.
Apparently the ldap_bind function of mod_php is unable to resolve
"localhost".
This might be related to bug #29587
Regards
Gunnar
Reproduce code:
---------------
<?
$ds=ldap_connect("localhost", 389);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if(!ldap_bind($ds,"uid=myuid,dc=mydom,dc=de","mypass"))
{
print "<br />Error<br />";
print(ldap_error($ds));
}
?>
Expected result:
----------------
No error.
Actual result:
--------------
Error
Can't contact LDAP server.
TCPdump reports a request to the name server:
10:20:35.050539 IP myserver.mydom.info.41604 > dns2.arcor-ip.de.domain:
60613+ AAAA? localhost. (27)
10:20:35.061182 IP dns2.arcor-ip.de.domain > myserver.mydom.info.41604:
60613 NXDomain 0/1/0 (102)
--
Edit bug report at http://bugs.php.net/?id=30107&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30107&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30107&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30107&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30107&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30107&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30107&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30107&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30107&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30107&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30107&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30107&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30107&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30107&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30107&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30107&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30107&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30107&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30107&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30107&r=mysqlcfg