diff options
Diffstat (limited to 'src/mod_vcard_ldap.erl')
-rw-r--r-- | src/mod_vcard_ldap.erl | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index 56ba9eb4d..03c00f628 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -74,6 +74,7 @@ search_fields, search_reported, search_reported_attrs, + deref_aliases, matches }). @@ -287,9 +288,11 @@ find_ldap_user(User, State) -> VCardAttrs = State#state.vcard_map_attrs, case eldap_filter:parse(RFC2254_Filter, [{"%u", User}]) of {ok, EldapFilter} -> - case eldap_pool:search(Eldap_ID, [{base, Base}, - {filter, EldapFilter}, - {attributes, VCardAttrs}]) of + case eldap_pool:search(Eldap_ID, + [{base, Base}, + {filter, EldapFilter}, + {deref_aliases, State#state.deref_aliases}, + {attributes, VCardAttrs}]) of #eldap_search_result{entries = [E | _]} -> E; _ -> @@ -572,10 +575,12 @@ search(State, Data) -> Limit = State#state.matches, ReportedAttrs = State#state.search_reported_attrs, Filter = eldap:'and'([SearchFilter, eldap_utils:make_filter(Data, UIDs)]), - case eldap_pool:search(Eldap_ID, [{base, Base}, - {filter, Filter}, - {limit, Limit}, - {attributes, ReportedAttrs}]) of + case eldap_pool:search(Eldap_ID, + [{base, Base}, + {filter, Filter}, + {limit, Limit}, + {deref_aliases, State#state.deref_aliases}, + {attributes, ReportedAttrs}]) of #eldap_search_result{entries = E} -> search_items(E, State); _ -> @@ -779,6 +784,15 @@ parse_options(Host, Opts) -> _ -> [] end end, SearchReported) ++ UIDAttrs), + DerefAliases = case gen_mod:get_opt(deref_aliases, Opts, undefined) of + undefined -> + case ejabberd_config:get_local_option( + {deref_aliases, Host}) of + undefined -> never; + D -> D + end; + D -> D + end, #state{serverhost = Host, myhost = MyHost, eldap_id = Eldap_ID, @@ -801,5 +815,6 @@ parse_options(Host, Opts) -> search_fields = SearchFields, search_reported = SearchReported, search_reported_attrs = SearchReportedAttrs, + deref_aliases = DerefAliases, matches = Matches }. |