LDAP 검색을 수행하려고하는데 내 Active Directory 테스트 서버에서 작동하지 않습니다. 이 코드를 사용합니다 :AD 서버에서 winldap.h를 사용하여 LDAP 검색
#include <winldap.h>
...
LDAP* ld = ldap_init("AD-servername", 389);
int myVersion =LDAP_VERSION3;
ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &myVersion);
ldap_connect(ld, NULL);
//ldap_simple_bind_s(ld, NULL, NULL); I tried using this line too. but got the same error
LDAPMessage *pMsg = NULL;
int retVal = ldap_search_s(ld, "dc=myDomain,dc=extension", LDAP_SCOPE_SUBTREE, "(samAccountName=testaccount)", NULL, NULL, &pMsg);
//retVal = 1 which is LDAP_OPERATIONS_ERROR
내가 뭘 잘못하고 있니?
:
같은 것을 대체 할 필요가? 2 대신에 하나의 DN만을 사용하려 했습니까? 간단한 필터를 사용해보십시오. – besworland
'ldap_set_option'과'ldap_connect'는 둘 다'LDAP_SUCCESS'를 리턴합니다. 내 실제 DN은'dc = dl, dc = intern'이며 내 도메인 이름 ->'dl.intern'입니다. –