php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30107 ldap_bind does a dns lookup for "localhost" (mod_php not CLI)
Submitted: 2004-09-16 10:27 UTC Modified: 2004-09-16 10:43 UTC
From: php at gunnarwrobel dot de Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4.3.8 OS: Gentoo 2004.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at gunnarwrobel dot de
New email:
PHP Version: OS:

 

 [2004-09-16 10:27 UTC] php at gunnarwrobel dot de
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)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-16 10:43 UTC] sniper@php.net
It's either a bug in openldap (unlikely) or misconfigured system of yours. Check your /etc/hosts and /etc/resolv.conf files. See also:

http://www.netsys.com/openldap-software/2002/08/msg00020.html

This is absolutely not a PHP bug whatsoever..

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 15:01:30 2025 UTC