Finding AD root name
My application performes LDAP search, and i don't have the DN input parameter, so i have to get it by myself...
I find out the following way:
I pass NULL to ldap_bind_s insteasd of the the Domain DN parameter, then i call ldap_search_s with NULL as DN to start search param and LDAP_SCOPE_BASE as Scope.
As a result i get a single entry with the property "rootDomainNamingContext" that contains the Root Domain Name that i was looking for.
So, is it a better way to find this Root domain name?
and what willl the use of binding with NULL parameter instead of DN affects?
I believe that's all you can do, bind with NULL get the root dn, then disconnect and reconnect with the correct dn. At least that is what I'd do.