From 545889a048da0bc58c4a4db4500839ab050518fa Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sun, 21 Feb 2010 11:56:12 +0100 Subject: s4:LDAP server - Enable support for returning referrals through it This is needed for my work regarding the referrals when the domain scope control isn't specified. Signed-off-by: Andrew Bartlett --- source4/ldap_server/ldap_backend.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source4') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 689fd31141..1c5a2b2a04 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -475,6 +475,28 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) queue_reply: ldapsrv_queue_reply(call, ent_r); } + + /* Send back referrals if they do exist (search operations) */ + if (res->refs != NULL) { + char **ref; + struct ldap_SearchResRef *ent_ref; + + for (ref = res->refs; *ref != NULL; ++ref) { + ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultReference); + NT_STATUS_HAVE_NO_MEMORY(ent_r); + + /* Better to have the whole referrals kept here, + * than to find someone further up didn't put + * a value in the right spot in the talloc tree + */ + talloc_steal(ent_r, *ref); + + ent_ref = &ent_r->msg->r.SearchResultReference; + ent_ref->referral = *ref; + + ldapsrv_queue_reply(call, ent_r); + } + } } reply: -- cgit