s3:lib/tldap: make use of tevent_req_defer_callback()
authorStefan Metzmacher <metze@samba.org>
Wed, 8 Jan 2014 18:46:01 +0000 (19:46 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 17 Jan 2014 11:38:09 +0000 (12:38 +0100)
In tldap_msg_received() we call tevent_req_error() for more than
one request, if we do that we need to use tevent_req_defer_callback()
otherwise we're likely to crash, as a triggered callback may
invalidate our state.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/lib/tldap.c

index b094c2d3c2904d4fe808cf2fdab01011a6576663..a566a91adb7f5a1a2c8b9b540687becf917553b9 100644 (file)
@@ -650,6 +650,8 @@ static void tldap_msg_received(struct tevent_req *subreq)
  fail:
        while (talloc_array_length(ld->pending) > 0) {
                req = ld->pending[0];
+               state = tevent_req_data(req, struct tldap_msg_state);
+               tevent_req_defer_callback(req, state->ev);
                talloc_set_destructor(req, NULL);
                tldap_msg_destructor(req);
                tevent_req_error(req, status);