Crivaledaz / Mattermost-LDAP

This module provides an external LDAP authentication in Mattermost for the Team Edition (free).
MIT License
359 stars 71 forks source link

isbug #11

Closed paddy235 closed 6 years ago

paddy235 commented 7 years ago

fedora 389 ldap config_ldap.php:

$hostname = "ldap://ldap.abb.app:10389";

$port = 10389;

LDAP.php:

    public function __construct($hostname, $port = 389)
    {
        if (!is_string($hostname)) 
        {
            throw new InvalidArgumentException('First argument to LDAP must be the hostname of a ldap server (string). Ex: ldap//example.com/ ');
        }

        if (!is_int($port)) 
        {
            throw new InvalidArgumentException('Second argument to LDAP must be the ldap server port (int). Ex : 389');
        }

        $ldap = ldap_connect($hostname)
            or die("Unable to connect to the ldap server : $ldaphost ! Please check your configuration.");

if is $ldap = ldap_connect($hostname,$port) then fail ldap_bind(): Unable to bind to server: Can't contact LDAP server

Crivaledaz commented 7 years ago

Hi,

In fact, this is an error, the line should be $ldap = ldap_connect($hostname,$port), else the $port argument is useless. However, in the php manual, there are two different ways to use ldap_connect($host,$port) :

So I suggest you to only use $hostname = "ldap://ldap.abb.app:10389"; or $hostname = "ldap://ldap.abb.app"; $port = 10389; Note, if you use LDAP 1.x you should use the second option.

I hope this will solve your problem, keep me updated please :)

Thanks for your feedback, I will fix this point in the next commit.

Regards

paddy235 commented 7 years ago

thank you verymatch