s3:libsmb/async_smb: don't remove pending requests if the mid is set
authorStefan Metzmacher <metze@samba.org>
Wed, 8 Jun 2011 08:20:25 +0000 (10:20 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 10 Jun 2011 17:27:05 +0000 (19:27 +0200)
If the mid was set explicitly, it means the request expects more than
one reply, so leave it in the pending array.

metze

source3/libsmb/async_smb.c

index 2e0ddb9fdb0730f47c25112a842b8753f6acd0b5..c09a886f5e1225fd7085e6824a89c7cf396839f4 100644 (file)
@@ -153,6 +153,14 @@ void cli_smb_req_unset_pending(struct tevent_req *req)
        int num_pending = talloc_array_length(cli->pending);
        int i;
 
+       if (state->mid != 0) {
+               /*
+                * This is a [nt]trans[2] request which waits
+                * for more than one reply.
+                */
+               return;
+       }
+
        if (num_pending == 1) {
                /*
                 * The pending read_smb tevent_req is a child of
@@ -193,6 +201,13 @@ void cli_smb_req_unset_pending(struct tevent_req *req)
 
 static int cli_smb_req_destructor(struct tevent_req *req)
 {
+       struct cli_smb_state *state = tevent_req_data(
+               req, struct cli_smb_state);
+       /*
+        * Make sure we really remove it from
+        * the pending array on destruction.
+        */
+       state->mid = 0;
        cli_smb_req_unset_pending(req);
        return 0;
 }