The following flags are valid integer values for the LDAP_OPT_DEREF (as taken from the documentation for ldap_read()):
LDAP_DEREF_NEVER (int 0) - (default) aliases are never dereferenced.
LDAP_DEREF_SEARCHING (int 1) - aliases should be dereferenced during the search but not when locating the base object of the search.
LDAP_DEREF_FINDING (int 2) - aliases should be dereferenced when locating the base object but not during the search.
LDAP_DEREF_ALWAYS (int 3) - aliases should be dereferenced always.
Example:
ldap_set_option($ds,LDAP_OPT_DEREF,LDAP_DEREF_ALWAYS);?>
These are defined in the draft C API (presumably from the original LDAP API). See draft-ietf-ldapext-ldap-c-api-xx.txt included in the OpenLDAP source code distribution.