Fix bug #9196 - defer_open is triggered multiple times on the same request.
authorJeremy Allison <jra@samba.org>
Fri, 14 Dec 2012 16:56:52 +0000 (08:56 -0800)
committerKarolin Seeger <kseeger@samba.org>
Thu, 17 Jan 2013 08:09:16 +0000 (09:09 +0100)
get_deferred_open_message_state_smb2() is buggy in that it is checking
the wrong things to determine if an open is in the deferred state.

It checks if (smb2req->async == NULL) which is incorrect,
as we're not always async in a deferred open - remove this.

It should check instead state->open_was_deferred as this
is explicity set to 'true' when an open is going deferred,
so add this check.

Signed-off-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a8658bcb67927282288af5a579e3e66d3eaaac7b)

source3/smbd/smb2_create.c

index 5a9044d8d74a89d289ff60ddeb9e7a2df28986b6..5b81099928f764c73fadde23d63f7bf463591c0a 100644 (file)
@@ -893,9 +893,6 @@ bool get_deferred_open_message_state_smb2(struct smbd_smb2_request *smb2req,
        if (!smb2req) {
                return false;
        }
-       if (!smb2req->async) {
-               return false;
-       }
        req = smb2req->subreq;
        if (!req) {
                return false;
@@ -904,6 +901,9 @@ bool get_deferred_open_message_state_smb2(struct smbd_smb2_request *smb2req,
        if (!state) {
                return false;
        }
+       if (!state->open_was_deferred) {
+               return false;
+       }
        if (p_request_time) {
                *p_request_time = state->request_time;
        }