I try to use ldap-star-tls to connect to a win2003 domain controller and
browse AD.
$ds = ldap_connect("l dap://$ad_server/") ,"389"); // Connect to an LDAP
server
echo $debug?"<BR>LDA P Connection handler:$ds<BR> ":"";
if ($ds == 0) {
echo "<H1>Cannot connect to LDAP server to authenticate</H1>";
echo "<H3>Use the browser back button to continue</H3>";
exit;
}
else {
if (!ldap_set_opti on($ds, LDAP_OPT_PROTOC OL_VERSION, 3)) {
die ("Failed to set LDAP Protocol version to 3, TLS not
supported.");
}
if (!ldap_start_tl s($ds)) {
die ("Ldap_start_tl s failed");
}
if (ldap_bind ($ds, $serv_user, $serv_pass)) { # Bind Ok
The result is:
LDAP Connection handler:Resourc e id #2
Warning: ldap_start_tls( ) [function.ldap-start-tls]: Unable to start TLS:
Connect error in C:\WEBROOT\ad.p hp on line 30
Ldap_start_tls failed
TIA
Luca Bighi
browse AD.
$ds = ldap_connect("l dap://$ad_server/") ,"389"); // Connect to an LDAP
server
echo $debug?"<BR>LDA P Connection handler:$ds<BR> ":"";
if ($ds == 0) {
echo "<H1>Cannot connect to LDAP server to authenticate</H1>";
echo "<H3>Use the browser back button to continue</H3>";
exit;
}
else {
if (!ldap_set_opti on($ds, LDAP_OPT_PROTOC OL_VERSION, 3)) {
die ("Failed to set LDAP Protocol version to 3, TLS not
supported.");
}
if (!ldap_start_tl s($ds)) {
die ("Ldap_start_tl s failed");
}
if (ldap_bind ($ds, $serv_user, $serv_pass)) { # Bind Ok
The result is:
LDAP Connection handler:Resourc e id #2
Warning: ldap_start_tls( ) [function.ldap-start-tls]: Unable to start TLS:
Connect error in C:\WEBROOT\ad.p hp on line 30
Ldap_start_tls failed
TIA
Luca Bighi