ldap-start-tls to connect to AD server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Luca Bighi

    #1

    ldap-start-tls to connect to AD server

    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
Working...