r2525: fix a search response when the backend didn't support Search
authorStefan Metzmacher <metze@samba.org>
Wed, 22 Sep 2004 13:08:30 +0000 (13:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:02 +0000 (12:59 -0500)
we return LDAP error 32 (noSuchObject) now instead of a protocol error

metze

source/ldap_server/ldap_server.c

index f4ebd0d74c4b3b42e26a9eb6a8b688e78c84637a..bb52a1bbb3917a97b8cd5c4e195d3cfc65ec55be 100644 (file)
@@ -279,7 +279,22 @@ static void ldapsrv_SearchRequest(struct ldapsrv_call *call)
        part = ldapsrv_get_partition(call->conn, req->basedn);
 
        if (!part->ops->Search) {
-               ldapsrv_unwilling(call, 2);
+               struct ldap_Result *done;
+               struct ldapsrv_reply *done_r;
+
+               done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone);
+               if (!done_r) {
+                       ldapsrv_terminate_connection(call->conn, "ldapsrv_init_reply() failed");
+                       return;
+               }
+
+               done = &done_r->msg.r.SearchResultDone;
+               done->resultcode = 32;
+               done->dn = NULL;
+               done->errormessage = NULL;
+               done->referral = NULL;
+
+               ldapsrv_queue_reply(call, done_r);
                return;
        }