s3: Fix early tldap_search cancels
authorVolker Lendecke <vl@samba.org>
Sun, 20 Mar 2011 09:35:18 +0000 (10:35 +0100)
committerVolker Lendecke <vlendec@samba.org>
Sun, 20 Mar 2011 10:26:57 +0000 (11:26 +0100)
A callback of tldap_search_send might not interested in the rest of the results
and could do a TALLOC_FREE of the search request. In this case, "subreq" is
already free'ed. So we have to set it to pending before the callback is called.
The TALLOC_FREE of the search request will set it to non-pending again via
tldap_msg_destructor.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Mar 20 11:26:57 CET 2011 on sn-devel-104

source3/lib/tldap.c

index db5d562effeeff722e409174dfe276215fc2a219..2f45a056df8c0a05f407c673168c5e2984b51a2f 100644 (file)
@@ -1703,11 +1703,11 @@ static void tldap_search_done(struct tevent_req *subreq)
        switch (state->result->type) {
        case TLDAP_RES_SEARCH_ENTRY:
        case TLDAP_RES_SEARCH_REFERENCE:
-               tevent_req_notify_callback(req);
                if (!tldap_msg_set_pending(subreq)) {
                        tevent_req_nomem(NULL, req);
                        return;
                }
+               tevent_req_notify_callback(req);
                break;
        case TLDAP_RES_SEARCH_RESULT:
                TALLOC_FREE(subreq);