Create base dn from FQDN?

563 Views Asked by At

I'm creating an application which uses LDAP authentication. However, I'm stuck on the LDAP_SEARCH() function. Basically I need to dynamically create the base_dn from the FQDN (Fully Qualified Domain Name) which the user can specify in the settings.

e.g. DOMAIN.internal

How would I do this?

1

There are 1 best solutions below

1
On BEST ANSWER

You shouldn't. The base object is determined by the directory information tree, and the scope of your search should be as far "down" into the directory information tree as is practicable.. This information comes from the directory administrators. If you need to know which naming contexts are hosted/shadowed by the server, you should query the root DSE. See also: "LDAP: Programming Practices".