diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-07-17 09:36:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:11 -0500 |
commit | a5bafffd66f511375dda4c974e6a1f152fc7aa16 (patch) | |
tree | 4a8765fbc275ba7c6a4cf30db99850bbc94e1891 /source4/libcli/smb2/transport.c | |
parent | 152ea280f1982831c31071eec5c5a17f072073b0 (diff) | |
download | samba-a5bafffd66f511375dda4c974e6a1f152fc7aa16.tar.gz samba-a5bafffd66f511375dda4c974e6a1f152fc7aa16.tar.bz2 samba-a5bafffd66f511375dda4c974e6a1f152fc7aa16.zip |
r17083: - implement SMB2 Cancel in the client
- the 0xffffffffffffffff seqnum is reserved for SMB2 Break (oplock breaks)
so don't use it in a request. we should someday try to test this...
metze
(This used to be commit 730cdc4475822e28cb400116641294a7f98ad0b5)
Diffstat (limited to 'source4/libcli/smb2/transport.c')
-rw-r--r-- | source4/libcli/smb2/transport.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c index c970bf7147..ea8c4804ff 100644 --- a/source4/libcli/smb2/transport.c +++ b/source4/libcli/smb2/transport.c @@ -152,8 +152,10 @@ static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob) int len; struct smb2_request *req = NULL; uint64_t seqnum; + uint32_t flags; uint16_t buffer_code; uint32_t dynamic_size; + uint32_t i; buffer = blob.data; len = blob.length; @@ -165,7 +167,8 @@ static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob) goto error; } - seqnum = BVAL(hdr, SMB2_HDR_SEQNUM); + flags = IVAL(hdr, SMB2_HDR_FLAGS); + seqnum = BVAL(hdr, SMB2_HDR_SEQNUM); /* match the incoming request against the list of pending requests */ for (req=transport->pending_recv; req; req=req->next) { @@ -190,8 +193,13 @@ static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob) req->status = NT_STATUS(IVAL(hdr, SMB2_HDR_STATUS)); if (NT_STATUS_EQUAL(req->status, STATUS_PENDING)) { - /* the server has helpfully told us that this request is still being - processed. how useful :) */ + if (flags & 0x00000002) { + req->cancel.can_cancel = True; + req->cancel.pending_id = IVAL(hdr, SMB2_HDR_PID); + for (i=0; i< req->cancel.do_cancel; i++) { + smb2_cancel(req); + } + } talloc_free(buffer); return NT_STATUS_OK; } |