summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-11 10:47:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:54 -0500
commitdc86ab3e454d7219608d01879145dec5609acaa3 (patch)
tree5feacd2c479a6532ddb078d2b55db4144cc4e826 /source4/libcli/smb2
parentcf83b29b582c4475e5c065dae7e214faf4710222 (diff)
downloadsamba-dc86ab3e454d7219608d01879145dec5609acaa3.tar.gz
samba-dc86ab3e454d7219608d01879145dec5609acaa3.tar.bz2
samba-dc86ab3e454d7219608d01879145dec5609acaa3.zip
r15532: add a BOOL body_dynamic_present, because the body_dynamic_size can be 0
also if the dynamic flag should be set metze (This used to be commit 7829100e1ee79f4f5d24004af221288e19c09b3e)
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r--source4/libcli/smb2/close.c2
-rw-r--r--source4/libcli/smb2/create.c2
-rw-r--r--source4/libcli/smb2/find.c2
-rw-r--r--source4/libcli/smb2/flush.c2
-rw-r--r--source4/libcli/smb2/getinfo.c2
-rw-r--r--source4/libcli/smb2/ioctl.c2
-rw-r--r--source4/libcli/smb2/keepalive.c2
-rw-r--r--source4/libcli/smb2/logoff.c2
-rw-r--r--source4/libcli/smb2/negprot.c2
-rw-r--r--source4/libcli/smb2/read.c2
-rw-r--r--source4/libcli/smb2/request.c17
-rw-r--r--source4/libcli/smb2/session.c2
-rw-r--r--source4/libcli/smb2/setinfo.c2
-rw-r--r--source4/libcli/smb2/tcon.c2
-rw-r--r--source4/libcli/smb2/tdis.c2
-rw-r--r--source4/libcli/smb2/write.c2
16 files changed, 29 insertions, 18 deletions
diff --git a/source4/libcli/smb2/close.c b/source4/libcli/smb2/close.c
index 3e559fe893..4483f3c75b 100644
--- a/source4/libcli/smb2/close.c
+++ b/source4/libcli/smb2/close.c
@@ -32,7 +32,7 @@ struct smb2_request *smb2_close_send(struct smb2_tree *tree, struct smb2_close *
{
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_CLOSE, 0x18, 0);
+ req = smb2_request_init_tree(tree, SMB2_OP_CLOSE, 0x18, False, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.flags);
diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c
index c7bb190559..339258a0df 100644
--- a/source4/libcli/smb2/create.c
+++ b/source4/libcli/smb2/create.c
@@ -67,7 +67,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
NTSTATUS status;
DATA_BLOB blob = data_blob(NULL, 0);
- req = smb2_request_init_tree(tree, SMB2_OP_CREATE, 0x38, 1);
+ req = smb2_request_init_tree(tree, SMB2_OP_CREATE, 0x38, True, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.oplock_flags);
diff --git a/source4/libcli/smb2/find.c b/source4/libcli/smb2/find.c
index aa14347022..e811095f42 100644
--- a/source4/libcli/smb2/find.c
+++ b/source4/libcli/smb2/find.c
@@ -33,7 +33,7 @@ struct smb2_request *smb2_find_send(struct smb2_tree *tree, struct smb2_find *io
struct smb2_request *req;
NTSTATUS status;
- req = smb2_request_init_tree(tree, SMB2_OP_FIND, 0x20, 1);
+ req = smb2_request_init_tree(tree, SMB2_OP_FIND, 0x20, True, 0);
if (req == NULL) return NULL;
SCVAL(req->out.body, 0x02, io->in.level);
diff --git a/source4/libcli/smb2/flush.c b/source4/libcli/smb2/flush.c
index d9178aeb9f..596eb26009 100644
--- a/source4/libcli/smb2/flush.c
+++ b/source4/libcli/smb2/flush.c
@@ -31,7 +31,7 @@ struct smb2_request *smb2_flush_send(struct smb2_tree *tree, struct smb2_flush *
{
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_FLUSH, 0x18, 0);
+ req = smb2_request_init_tree(tree, SMB2_OP_FLUSH, 0x18, False, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0); /* pad? */
diff --git a/source4/libcli/smb2/getinfo.c b/source4/libcli/smb2/getinfo.c
index d52ff03922..57a363b63f 100644
--- a/source4/libcli/smb2/getinfo.c
+++ b/source4/libcli/smb2/getinfo.c
@@ -32,7 +32,7 @@ struct smb2_request *smb2_getinfo_send(struct smb2_tree *tree, struct smb2_getin
{
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_GETINFO, 0x28, 0);
+ req = smb2_request_init_tree(tree, SMB2_OP_GETINFO, 0x28, False, 0);
if (req == NULL) return NULL;
/* this seems to be a bug, they use 0x29 but only send 0x28 bytes */
diff --git a/source4/libcli/smb2/ioctl.c b/source4/libcli/smb2/ioctl.c
index 533f12c9d3..ffe029e16e 100644
--- a/source4/libcli/smb2/ioctl.c
+++ b/source4/libcli/smb2/ioctl.c
@@ -32,7 +32,7 @@ struct smb2_request *smb2_ioctl_send(struct smb2_tree *tree, struct smb2_ioctl *
NTSTATUS status;
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_IOCTL, 0x38,
+ req = smb2_request_init_tree(tree, SMB2_OP_IOCTL, 0x38, True,
io->in.in.length+io->in.out.length);
if (req == NULL) return NULL;
diff --git a/source4/libcli/smb2/keepalive.c b/source4/libcli/smb2/keepalive.c
index b800bdb3b1..ac31afd4dc 100644
--- a/source4/libcli/smb2/keepalive.c
+++ b/source4/libcli/smb2/keepalive.c
@@ -31,7 +31,7 @@ struct smb2_request *smb2_keepalive_send(struct smb2_transport *transport)
{
struct smb2_request *req;
- req = smb2_request_init(transport, SMB2_OP_KEEPALIVE, 0x04, 0);
+ req = smb2_request_init(transport, SMB2_OP_KEEPALIVE, 0x04, False, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0);
diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c
index 977c1e57af..cfaa389ef8 100644
--- a/source4/libcli/smb2/logoff.c
+++ b/source4/libcli/smb2/logoff.c
@@ -31,7 +31,7 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session)
{
struct smb2_request *req;
- req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, 0);
+ req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, False, 0);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid);
diff --git a/source4/libcli/smb2/negprot.c b/source4/libcli/smb2/negprot.c
index a3cf8eb018..c3b72186a9 100644
--- a/source4/libcli/smb2/negprot.c
+++ b/source4/libcli/smb2/negprot.c
@@ -33,7 +33,7 @@ struct smb2_request *smb2_negprot_send(struct smb2_transport *transport,
{
struct smb2_request *req;
- req = smb2_request_init(transport, SMB2_OP_NEGPROT, 0x26, 0);
+ req = smb2_request_init(transport, SMB2_OP_NEGPROT, 0x26, False, 0);
if (req == NULL) return NULL;
/* this seems to be a bug, they use 0x24 but the length is 0x26 */
diff --git a/source4/libcli/smb2/read.c b/source4/libcli/smb2/read.c
index da2d3bb7c9..82e9b13280 100644
--- a/source4/libcli/smb2/read.c
+++ b/source4/libcli/smb2/read.c
@@ -31,7 +31,7 @@ struct smb2_request *smb2_read_send(struct smb2_tree *tree, struct smb2_read *io
{
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_READ, 0x31, 0);
+ req = smb2_request_init_tree(tree, SMB2_OP_READ, 0x31, False, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0); /* pad */
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index 2476270d49..136b81e977 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -31,10 +31,19 @@
initialise a smb2 request
*/
struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_t opcode,
- uint16_t body_fixed_size, uint32_t body_dynamic_size)
+ uint16_t body_fixed_size, BOOL body_dynamic_present,
+ uint32_t body_dynamic_size)
{
struct smb2_request *req;
+ if (body_dynamic_present) {
+ if (body_dynamic_size == 0) {
+ body_dynamic_size = 1;
+ }
+ } else {
+ body_dynamic_size = 0;
+ }
+
req = talloc(transport, struct smb2_request);
if (req == NULL) return NULL;
@@ -95,10 +104,12 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_
initialise a smb2 request for tree operations
*/
struct smb2_request *smb2_request_init_tree(struct smb2_tree *tree, uint16_t opcode,
- uint16_t body_fixed_size, uint32_t body_dynamic_size)
+ uint16_t body_fixed_size, BOOL body_dynamic_present,
+ uint32_t body_dynamic_size)
{
struct smb2_request *req = smb2_request_init(tree->session->transport, opcode,
- body_fixed_size, body_dynamic_size);
+ body_fixed_size, body_dynamic_present,
+ body_dynamic_size);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, tree->session->uid);
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index 1d1b97600a..83e6d1ae00 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -69,7 +69,7 @@ struct smb2_request *smb2_session_setup_send(struct smb2_session *session,
NTSTATUS status;
req = smb2_request_init(session->transport, SMB2_OP_SESSSETUP,
- 0x10, io->in.secblob.length);
+ 0x10, True, io->in.secblob.length);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid);
diff --git a/source4/libcli/smb2/setinfo.c b/source4/libcli/smb2/setinfo.c
index c445880440..432034b13b 100644
--- a/source4/libcli/smb2/setinfo.c
+++ b/source4/libcli/smb2/setinfo.c
@@ -33,7 +33,7 @@ struct smb2_request *smb2_setinfo_send(struct smb2_tree *tree, struct smb2_setin
NTSTATUS status;
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_SETINFO, 0x20, io->in.blob.length);
+ req = smb2_request_init_tree(tree, SMB2_OP_SETINFO, 0x20, True, io->in.blob.length);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.level);
diff --git a/source4/libcli/smb2/tcon.c b/source4/libcli/smb2/tcon.c
index 3fc14075a5..8b94936c42 100644
--- a/source4/libcli/smb2/tcon.c
+++ b/source4/libcli/smb2/tcon.c
@@ -54,7 +54,7 @@ struct smb2_request *smb2_tree_connect_send(struct smb2_tree *tree,
NTSTATUS status;
req = smb2_request_init(tree->session->transport, SMB2_OP_TCON,
- 0x08, 1);
+ 0x08, True, 0);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, tree->session->uid);
diff --git a/source4/libcli/smb2/tdis.c b/source4/libcli/smb2/tdis.c
index 9ea58113b3..f89e5c8e90 100644
--- a/source4/libcli/smb2/tdis.c
+++ b/source4/libcli/smb2/tdis.c
@@ -31,7 +31,7 @@ struct smb2_request *smb2_tdis_send(struct smb2_tree *tree)
{
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_TDIS, 0x04, 0);
+ req = smb2_request_init_tree(tree, SMB2_OP_TDIS, 0x04, False, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0);
diff --git a/source4/libcli/smb2/write.c b/source4/libcli/smb2/write.c
index adf690c1b3..1edce3f773 100644
--- a/source4/libcli/smb2/write.c
+++ b/source4/libcli/smb2/write.c
@@ -32,7 +32,7 @@ struct smb2_request *smb2_write_send(struct smb2_tree *tree, struct smb2_write *
NTSTATUS status;
struct smb2_request *req;
- req = smb2_request_init_tree(tree, SMB2_OP_WRITE, 0x30, io->in.data.length);
+ req = smb2_request_init_tree(tree, SMB2_OP_WRITE, 0x30, True, io->in.data.length);
if (req == NULL) return NULL;
status = smb2_push_o16s32_blob(&req->out, 0x02, io->in.data);