php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74788 Cannot use ldap_connect passing a list of IPs
Submitted: 2017-06-20 20:41 UTC Modified: 2017-10-01 06:30 UTC
From: brenocobra at gmail dot com Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 7.0.20 OS: Linux RHEL 7.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 2 = ?
Subscribe to this entry?

 
 [2017-06-20 20:41 UTC] brenocobra at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.ldap-connect
---

No PHP Version 5.3.17 executo o ldap_connect passando uma lista de ip´s de servidores AD e a função identificava o primeiro ativo e a partir deste teste já mando fazer o ldap_bind neste servidor ativo.

No PHP Version 7.0.4 executo o ldap_connect passando uma lista de ip´s de servidores AD e recebo o erro " ldap_connect(): Could not create session handle: Bad parameter to an ldap routine "

"ESTE ERRO OCORRE APENAS QUANDO PASSO UMA "LISTA DE IP´S""

Test script:
---------------
if ($ds = ldap_connect("IP1 IP2 IP3")){
//Conectou OK em algum dos servidores da lista
...

}else{
// Não foi possível conectar a nenhum servidor de AD
}

OBS.: em IP1, IP2 e IP3 passo o endereço IP dos respectivos servidores

Expected result:
----------------
Era esperado que com este teste (if ($ds = ldap_connect("IP1 IP2 IP3")){) fosse validado o primeiro servidor de AD disponível da lista que foi enviada como acontecia na versão 5.3.17.


Patches

bugphp7ldap_connect (last revision 2017-06-20 20:47 UTC by brenocobra at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-27 15:37 UTC] mcmic@php.net
-Summary: Falha ao executar ldap_connect passando uma lista de servidores +Summary: Cannot use ldap_connect passing a list of IPs
 [2017-09-27 15:37 UTC] mcmic@php.net
(just translating)
The problem reported is ldap_connect will fail when passed a list of IPs separated by spaces, while this worked with PHP 5.3.

The english documentation for ldap_connect does indeed state that passing a list of URI is possible (but not a list of IPs), so I’ll need to test this.
Quote: "You can also provide multiple LDAP-URIs separated by a space as one string"

There is no test for this in ext/ldap/tests so one should be added anyway as the feature is documented.
Then this may need to be fixed if it is indeed not working.
 [2017-10-01 06:30 UTC] heiglandreas@php.net
-Status: Open +Status: Not a bug
 [2017-10-01 06:30 UTC] heiglandreas@php.net
The documentation clearly states that a list of URIs can be used. Not a list of IPs! 

This is the result on my local machine (sadly 3v4l.org hasn't ldap-extension installed)

heiglandreas@172.20.10.4 ~ $ php -v
PHP 7.1.8 (cli) (built: Aug  7 2017 15:02:45) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.5, Copyright (c) 1999-2017, by Zend Technologies
heiglandreas@172.20.10.4 ~ $ php -a
Interactive shell

php > var_dump(ldap_connect('ldap://123.234.12.12 ldaps://12.23.34.45'));
php shell code:1:
resource(1) of type (ldap link)


So it works perfectly with LDAP-URIs

Adding a test would be appreciated though ;)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 07:01:29 2024 UTC