summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Danneman <steven.danneman@isilon.com>2010-09-22 13:23:49 -0700
committerSteven Danneman <steven.danneman@isilon.com>2010-09-22 17:52:53 -0700
commitbf1a4b2bc411cba18980d00bf630aa61fc4e4699 (patch)
tree155e9fe15776bc1e17c7ea7871e1eabc4e03a89d
parent7e31704762b63ac580f3b778520d9f5f7d212cbe (diff)
downloadsamba-bf1a4b2bc411cba18980d00bf630aa61fc4e4699.tar.gz
samba-bf1a4b2bc411cba18980d00bf630aa61fc4e4699.tar.bz2
samba-bf1a4b2bc411cba18980d00bf630aa61fc4e4699.zip
s4:libcli:smb2 Rename pending_id to async_id and make 64-bit
Match MS-SMB2 - 2.2.1.1 SMB2 Packet Header - ASYNC
-rw-r--r--libcli/smb/smb2_constants.h5
-rw-r--r--source4/libcli/smb2/cancel.c2
-rw-r--r--source4/libcli/smb2/smb2.h6
-rw-r--r--source4/libcli/smb2/transport.c2
-rw-r--r--source4/torture/smb2/util.c1
5 files changed, 10 insertions, 6 deletions
diff --git a/libcli/smb/smb2_constants.h b/libcli/smb/smb2_constants.h
index a3885f9b7d..6d29d6e9ea 100644
--- a/libcli/smb/smb2_constants.h
+++ b/libcli/smb/smb2_constants.h
@@ -28,7 +28,7 @@
#define SMB2_HDR_EPOCH 0x06
#define SMB2_HDR_STATUS 0x08
#define SMB2_HDR_OPCODE 0x0c
-#define SMB2_HDR_CREDIT 0x0e
+#define SMB2_HDR_CREDIT 0x0e
#define SMB2_HDR_FLAGS 0x10
#define SMB2_HDR_NEXT_COMMAND 0x14
#define SMB2_HDR_MESSAGE_ID 0x18
@@ -38,6 +38,9 @@
#define SMB2_HDR_SIGNATURE 0x30 /* 16 bytes */
#define SMB2_HDR_BODY 0x40
+/* offsets into header elements for an async SMB2 request */
+#define SMB2_HDR_ASYNC_ID 0x20
+
/* header flags */
#define SMB2_HDR_FLAG_REDIRECT 0x01
#define SMB2_HDR_FLAG_ASYNC 0x02
diff --git a/source4/libcli/smb2/cancel.c b/source4/libcli/smb2/cancel.c
index 65f02187c1..28ef3099f3 100644
--- a/source4/libcli/smb2/cancel.c
+++ b/source4/libcli/smb2/cancel.c
@@ -53,7 +53,7 @@ NTSTATUS smb2_cancel(struct smb2_request *r)
SIVAL(c->out.hdr, SMB2_HDR_FLAGS, 0x00000002);
SSVAL(c->out.hdr, SMB2_HDR_CREDIT, 0x0030);
- SIVAL(c->out.hdr, SMB2_HDR_PID, r->cancel.pending_id);
+ SBVAL(c->out.hdr, SMB2_HDR_ASYNC_ID, r->cancel.async_id);
SBVAL(c->out.hdr, SMB2_HDR_MESSAGE_ID, c->seqnum);
if (r->session) {
SBVAL(c->out.hdr, SMB2_HDR_SESSION_ID, r->session->uid);
diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h
index 26b9bcb2a1..aaafedd28f 100644
--- a/source4/libcli/smb2/smb2.h
+++ b/source4/libcli/smb2/smb2.h
@@ -167,7 +167,7 @@ struct smb2_request {
/* each request is in one of 3 possible states */
enum smb2_request_state state;
-
+
struct smb2_transport *transport;
struct smb2_session *session;
struct smb2_tree *tree;
@@ -177,13 +177,13 @@ struct smb2_request {
struct {
bool do_cancel;
bool can_cancel;
- uint32_t pending_id;
+ uint64_t async_id;
} cancel;
/* the NT status for this request. Set by packet receive code
or code detecting error. */
NTSTATUS status;
-
+
struct smb2_request_buffer in;
struct smb2_request_buffer out;
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c
index dffd1acd2b..04b2d38327 100644
--- a/source4/libcli/smb2/transport.c
+++ b/source4/libcli/smb2/transport.c
@@ -302,7 +302,7 @@ static NTSTATUS smb2_transport_finish_recv(void *private_data, DATA_BLOB blob)
if ((flags & SMB2_HDR_FLAG_ASYNC) &&
NT_STATUS_EQUAL(req->status, STATUS_PENDING)) {
req->cancel.can_cancel = true;
- req->cancel.pending_id = IVAL(hdr, SMB2_HDR_PID);
+ req->cancel.async_id = BVAL(hdr, SMB2_HDR_ASYNC_ID);
for (i=0; i< req->cancel.do_cancel; i++) {
smb2_cancel(req);
}
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 96981125c2..8feb96857d 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -322,6 +322,7 @@ NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
r.in.length = 5;
r.in.offset = 0;
+ // What is the purpose of this? Server returns EOF.
smb2_read(tree, tree, &r);
return NT_STATUS_OK;