From b41d44eda3ae7d72b3ddcfbd749b19f900bcd958 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 12 Aug 2011 17:40:04 +0200 Subject: s3:libsmb: keep a cli_smb_state->one_way This moves the SMB1 specific stuff to cli_smb_req_create(), instead of having it in the core dispatching code. metze --- source3/libsmb/async_smb.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index b07eee9e10..5f2a6441e3 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -89,6 +89,8 @@ struct cli_smb_state { int chain_num; int chain_length; struct tevent_req **chained_requests; + + bool one_way; }; static uint16_t cli_alloc_mid(struct cli_state *cli) @@ -411,6 +413,22 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx, tevent_req_oom(result); } } + + switch (smb_command) { + case SMBtranss: + case SMBtranss2: + case SMBnttranss: + case SMBntcancel: + state->one_way = true; + break; + case SMBlockingX: + if ((wct == 8) && + (CVAL(vwv+3, 0) == LOCKING_ANDX_OPLOCK_RELEASE)) { + state->one_way = true; + } + break; + } + return result; } @@ -561,21 +579,10 @@ static void cli_smb_sent(struct tevent_req *subreq) return; } - switch (CVAL(state->header, smb_com)) { - case SMBtranss: - case SMBtranss2: - case SMBnttranss: - case SMBntcancel: + if (state->one_way) { state->inbuf = NULL; tevent_req_done(req); return; - case SMBlockingX: - if ((CVAL(state->header, smb_wct) == 8) && - (CVAL(state->vwv+3, 0) == LOCKING_ANDX_OPLOCK_RELEASE)) { - state->inbuf = NULL; - tevent_req_done(req); - return; - } } if (!cli_smb_req_set_pending(req)) { -- cgit