Arjun babu
Arjun babu

Reputation: 617

ldap_search function returns errorcode 10 using c++ Win32 api?

i am using ldap functions to get user attributes value using win32 api.

the user name is arun.

in ldap_functions like init,set_options,connect,bind is succeed.but ldap search function is returned error code 10.

here my code

errorCode = ldap_search_s(
                    pLdapConnection,    // Session handle
                    pMyDN,              // DN to start search
                    LDAP_SCOPE_SUBTREE, // Scope  LDAP_SCOPE_BASE LDAP_SCOPE_SUBTREE
                    pMyFilter,          // Filter
                    NULL,               // Retrieve list of attributes
                    0,                  // Get both attributes and values
                    &pSearchResult);

in pMyDN specified `"DC=SANJU,DC=CO,DC=IN"...

the return code 10 gives error is LDAP_REFERRAL.but i cant get it.

But i put pMyDN value into "OU=Marketing,DC=SANJU,DC=CO,DC=IN"

Now,search function succeed,So what is the problem?

i need this function without using OU, can anyone help?

Upvotes: 1

Views: 1233

Answers (3)

Arjun babu
Arjun babu

Reputation: 617

whether DNS and AD in different URL(IP) without trusted rule,this problem will occured.

Upvotes: 1

Terry Gardner
Terry Gardner

Reputation: 11134

LDAP response do not use error codes, they use result codes - so called because non-zero responses aren't necessarily errors. 10 is a case in point, it's a referral. The referral will contain information about the server which can process the request. If a directory proxy server is not in place to follow the referral, the LDAP client must follow the referral for itself.

Compare operation responses also use result codes to transmit the result of a compare.

Upvotes: 0

Saddam Abu Ghaida
Saddam Abu Ghaida

Reputation: 6729

LDAP_REFERRAL: sent by Directory Server if the given base DN is an entry not handled by the current server and if the referral URL identifies a different server to handle the entry.

Upvotes: 2

Related Questions