[Samba] php ldap unable bind to Samba4 AD after 4.4.2

Kelvin Yip kelvin at icshk.com
Mon Apr 18 06:59:39 UTC 2016


Hi all,

 

Before Samba 4.4.2, I use the following php code to connect to samba. Now, I
can only use "ldap server require strong auth = no" to connect to Samba
4.4.2.

I tried ldap server require strong auth = allow_sasl_over_tls or Yes. and
switch to ldaps://127.0.0.1. None of the combination works.

Does anyone figure out what should I do to connect samba ldap with "strong
auth" ??

Thanks a million.

 

        $ldapServer = "ldap://127.0.0.1";

 

        $ds=ldap_connect($ldapServer) or die("Could not connect to LDAP
server.");  // must be a valid LDAP server!

        ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

        ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);

 

        if ($ds) {

                        if ($_POST["UserName"]){

                                $ldaprdn = 'MYDOMAIN' . "\\" .
$_POST["UserName"];

                        } else if ($_POST["UserName"]){

                                $ldaprdn = 'MYDOMAIN' . "\\" .
$_POST["UserName"];

                        }                                               

                       $ldapbind = @ldap_bind($ds, $ldaprdn,
$_POST["Password"]);

                }



More information about the samba mailing list