LDAP Search with winldap.h on AD Server

前端 未结 1 876
醉酒成梦
醉酒成梦 2021-01-15 11:06

I am trying to do a LDAP search and it is not working on my Active Directory Test Server. I use this code:

#include 
...
LDAP* ld = ldap_ini         


        
1条回答
  •  借酒劲吻你
    2021-01-15 11:41

    Unless otherwise configured, you must bind using a valid account name and password for Microsoft Active Directory servers, otherwise it will return the operations error for all queries except a very small handful.

    i.e. that:

    ldap_simple_bind_s(ld, NULL, NULL);
    

    Needs to be replaced with something like:

    char *username = "cn=aUser,ou=Users,dc=myDomain,dc=extension";
    char *password = "this is the password";
    ldap_simple_bind_s(ld, username, password);
    

    0 讨论(0)
提交回复
热议问题