[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Sun May 6 08:39:04 MDT 2012


The branch, master has been updated
       via  0f02667 lib/param: add support for "SMB3_00"
       via  1512ec7 s3:smb2_negprot: add support for PROTOCOL_SMB3_00
       via  49acba3 s4:libcli/smb2: use PROTOCOL_LATEST
       via  5252ddf s3:torture/test_smb2: add support for PROTOCOL_SMB3_00
       via  43085e9 libcli/smb/smbXcli: add support for PROTOCOL_SMB3_00
       via  abd8017 libcli/smb: add #define PROTOCOL_LATEST PROTOCOL_SMB3_00
       via  7ae2c16 libcli/smb: add PROTOCOL_SMB3_00
       via  44dcad7 libcli/smb: add SMB3_DIALECT_REVISION_300
       via  6aa601b s3:torture: do some query_info and set_info calls in SMB2-SESSION-REAUTH
       via  9dc31c4 s3:libsmb: add smb2cli_set_info*
       via  db39372 s3:libsmb: add smb2cli_query_info*
       via  3709bf6 s3:libsmb: use 'state' instead of 'talloc_tos()' in smb2cli_tcon*
       via  8e3ec7c s3:libsmb: use 'state' instead of 'talloc_tos()' in smb2cli_ioctl*
       via  d651562 s3:libsmb: use 'state' instead of 'talloc_tos()' in smb2cli_create*
       via  850e472 s3:libsmb: remove unused reference to talloc_tos()
       via  3e9b760 s3:idmap_cache: change DEBUG message to level 10
      from  c2b094f s4-s3-upgrade: Max/min password age policy is in seconds, not days

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0f026673eccc349faea56c1168001cfb70b77453
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:31:39 2012 +0200

    lib/param: add support for "SMB3_00"
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Sun May  6 16:38:00 CEST 2012 on sn-devel-104

commit 1512ec777285e731625330ddf8794168748376fb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:35:17 2012 +0200

    s3:smb2_negprot: add support for PROTOCOL_SMB3_00
    
    metze

commit 49acba37e78bc7cbcfe7cc69eea0421da9232999
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:55:59 2012 +0200

    s4:libcli/smb2: use PROTOCOL_LATEST
    
    metze

commit 5252ddf74e514c200a05be5b1dc20bfb358f86c4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:42:28 2012 +0200

    s3:torture/test_smb2: add support for PROTOCOL_SMB3_00
    
    metze

commit 43085e9b8228524ad703ab8f12f0e648af3ef3c2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:33:43 2012 +0200

    libcli/smb/smbXcli: add support for PROTOCOL_SMB3_00
    
    metze

commit abd801714ca84bd96de6466581a81387dd1b8885
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:38:25 2012 +0200

    libcli/smb: add #define PROTOCOL_LATEST PROTOCOL_SMB3_00
    
    metze

commit 7ae2c16f0ff61ce869e643b6b9b22f4d83f5812f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:28:57 2012 +0200

    libcli/smb: add PROTOCOL_SMB3_00
    
    metze

commit 44dcad7310b3cc1625be1fbdf90e3c069c55764f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat May 5 09:33:19 2012 +0200

    libcli/smb: add SMB3_DIALECT_REVISION_300
    
    metze

commit 6aa601b1512ddb6edfc1ea903144b3829dde0ecc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 12:07:11 2012 +0200

    s3:torture: do some query_info and set_info calls in SMB2-SESSION-REAUTH
    
    metze

commit 9dc31c484a3bfc2ffb6aa1f77f7d622cdd3c3df0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 12:02:55 2012 +0200

    s3:libsmb: add smb2cli_set_info*
    
    metze

commit db39372a111ec38ca716c03ac5fd8181644f182d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 09:10:53 2012 +0200

    s3:libsmb: add smb2cli_query_info*
    
    metze

commit 3709bf6b01a948100b55524f5b0c7d732774759a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 12:05:13 2012 +0200

    s3:libsmb: use 'state' instead of 'talloc_tos()' in smb2cli_tcon*
    
    metze

commit 8e3ec7c31a4fbc0b54c7c9d61279c405cdf72dca
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 12:05:13 2012 +0200

    s3:libsmb: use 'state' instead of 'talloc_tos()' in smb2cli_ioctl*
    
    metze

commit d651562aa11db6375b5014d4b255406a1775cbcb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 12:05:13 2012 +0200

    s3:libsmb: use 'state' instead of 'talloc_tos()' in smb2cli_create*
    
    metze

commit 850e47212084482a7ede9d1bc1fe92cc9f297f8f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 12:04:12 2012 +0200

    s3:libsmb: remove unused reference to talloc_tos()
    
    metze

commit 3e9b760406802b8fc8e82c13ac69fbe4a6b921da
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu May 3 14:48:57 2012 +0200

    s3:idmap_cache: change DEBUG message to level 10
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 lib/param/param_enums.c             |    1 +
 libcli/smb/smb2_constants.h         |    1 +
 libcli/smb/smbXcli_base.c           |    1 +
 libcli/smb/smb_constants.h          |    4 +-
 source3/Makefile.in                 |    2 +
 source3/lib/idmap_cache.c           |    3 +-
 source3/libsmb/smb2cli.h            |   56 ++++++++
 source3/libsmb/smb2cli_close.c      |    3 +-
 source3/libsmb/smb2cli_create.c     |    4 +-
 source3/libsmb/smb2cli_flush.c      |    3 +-
 source3/libsmb/smb2cli_ioctl.c      |    2 +-
 source3/libsmb/smb2cli_query_info.c |  254 +++++++++++++++++++++++++++++++++++
 source3/libsmb/smb2cli_set_info.c   |  188 ++++++++++++++++++++++++++
 source3/libsmb/smb2cli_tcon.c       |    7 +-
 source3/libsmb/smb2cli_write.c      |    3 +-
 source3/smbd/smb2_negprot.c         |   15 ++
 source3/torture/test_smb2.c         |  160 +++++++++++++++++++++-
 source3/wscript_build               |    2 +
 source4/libcli/smb2/connect.c       |    2 +-
 19 files changed, 688 insertions(+), 23 deletions(-)
 create mode 100644 source3/libsmb/smb2cli_query_info.c
 create mode 100644 source3/libsmb/smb2cli_set_info.c


Changeset truncated at 500 lines:

diff --git a/lib/param/param_enums.c b/lib/param/param_enums.c
index 42839b4..36234ea 100644
--- a/lib/param/param_enums.c
+++ b/lib/param/param_enums.c
@@ -29,6 +29,7 @@
 
 static const struct enum_list enum_protocol[] = {
 	{PROTOCOL_SMB2_02, "SMB2"}, /* for now keep PROTOCOL_SMB2_02 */
+	{PROTOCOL_SMB3_00, "SMB3_00"},
 	{PROTOCOL_SMB2_24, "SMB2_24"},
 	{PROTOCOL_SMB2_22, "SMB2_22"},
 	{PROTOCOL_SMB2_10, "SMB2_10"},
diff --git a/libcli/smb/smb2_constants.h b/libcli/smb/smb2_constants.h
index b472c76..f4e8b02 100644
--- a/libcli/smb/smb2_constants.h
+++ b/libcli/smb/smb2_constants.h
@@ -79,6 +79,7 @@
 #define SMB2_DIALECT_REVISION_210       0x0210
 #define SMB2_DIALECT_REVISION_222       0x0222
 #define SMB2_DIALECT_REVISION_224       0x0224
+#define SMB3_DIALECT_REVISION_300       0x0300
 #define SMB2_DIALECT_REVISION_2FF       0x02FF
 
 /* SMB2 negotiate security_mode */
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index aad999d..eb9e7d5 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -3212,6 +3212,7 @@ static const struct {
 	{PROTOCOL_SMB2_10,	SMB2_DIALECT_REVISION_210},
 	{PROTOCOL_SMB2_22,	SMB2_DIALECT_REVISION_222},
 	{PROTOCOL_SMB2_24,	SMB2_DIALECT_REVISION_224},
+	{PROTOCOL_SMB3_00,	SMB3_DIALECT_REVISION_300},
 };
 
 struct smbXcli_negprot_state {
diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index 9ee6f41..3b53dab 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -85,8 +85,10 @@ enum protocol_types {
 	PROTOCOL_SMB2_02,
 	PROTOCOL_SMB2_10,
 	PROTOCOL_SMB2_22,
-	PROTOCOL_SMB2_24
+	PROTOCOL_SMB2_24,
+	PROTOCOL_SMB3_00
 };
+#define PROTOCOL_LATEST PROTOCOL_SMB3_00
 
 enum smb_signing_setting {
 	SMB_SIGNING_DEFAULT = -1,
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 8b02d64..c166142 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -628,6 +628,8 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
 	     libsmb/smb2cli_write.o \
 	     libsmb/smb2cli_query_directory.o \
 	     libsmb/smb2cli_ioctl.o \
+	     libsmb/smb2cli_query_info.o \
+	     libsmb/smb2cli_set_info.o \
 	     libsmb/cli_np_tstream.o \
 	     libsmb/smbsock_connect.o \
 	     $(LIBSAMBA_OBJ) \
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 773579b..3669e93 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -54,7 +54,8 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
 		return false;
 	}
 	tmp_id.id = strtol(value, &endptr, 10);
-	DEBUG(0, ("Parsing result of %s, endptr=%s, id=%llu\n", key, endptr, (unsigned long long)tmp_id.id));
+	DEBUG(10, ("Parsing result of %s, endptr=%s, id=%llu\n",
+		   key, endptr, (unsigned long long)tmp_id.id));
 
 	ret = (*endptr == ':');
 	if (ret) {
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index 132fffd..727481a 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -188,4 +188,60 @@ NTSTATUS smb2cli_ioctl(struct cli_state *cli,
 		       DATA_BLOB *out_input_buffer,
 		       DATA_BLOB *out_output_buffer);
 
+struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
+					   struct tevent_context *ev,
+					   struct smbXcli_conn *conn,
+					   uint32_t timeout_msec,
+					   struct smbXcli_session *session,
+					   uint32_t tcon_id,
+					   uint8_t in_info_type,
+					   uint8_t in_file_info_class,
+					   uint32_t in_max_output_length,
+					   const DATA_BLOB *in_input_buffer,
+					   uint32_t in_additional_info,
+					   uint32_t in_flags,
+					   uint64_t in_fid_persistent,
+					   uint64_t in_fid_volatile);
+NTSTATUS smb2cli_query_info_recv(struct tevent_req *req,
+				 TALLOC_CTX *mem_ctx,
+				 DATA_BLOB *out_output_buffer);
+NTSTATUS smb2cli_query_info(struct smbXcli_conn *conn,
+			    uint32_t timeout_msec,
+			    struct smbXcli_session *session,
+			    uint32_t tcon_id,
+			    uint8_t in_info_type,
+			    uint8_t in_file_info_class,
+			    uint32_t in_max_output_length,
+			    const DATA_BLOB *in_input_buffer,
+			    uint32_t in_additional_info,
+			    uint32_t in_flags,
+			    uint64_t in_fid_persistent,
+			    uint64_t in_fid_volatile,
+			    TALLOC_CTX *mem_ctx,
+			    DATA_BLOB *out_output_buffer);
+
+struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
+					 struct tevent_context *ev,
+					 struct smbXcli_conn *conn,
+					 uint32_t timeout_msec,
+					 struct smbXcli_session *session,
+					 uint32_t tcon_id,
+					 uint8_t in_info_type,
+					 uint8_t in_file_info_class,
+					 const DATA_BLOB *in_input_buffer,
+					 uint32_t in_additional_info,
+					 uint64_t in_fid_persistent,
+					 uint64_t in_fid_volatile);
+NTSTATUS smb2cli_set_info_recv(struct tevent_req *req);
+NTSTATUS smb2cli_set_info(struct smbXcli_conn *conn,
+			    uint32_t timeout_msec,
+			    struct smbXcli_session *session,
+			    uint32_t tcon_id,
+			    uint8_t in_info_type,
+			    uint8_t in_file_info_class,
+			    const DATA_BLOB *in_input_buffer,
+			    uint32_t in_additional_info,
+			    uint64_t in_fid_persistent,
+			    uint64_t in_fid_volatile);
+
 #endif /* __SMB2CLI_H__ */
diff --git a/source3/libsmb/smb2cli_close.c b/source3/libsmb/smb2cli_close.c
index e6b9073..246d904 100644
--- a/source3/libsmb/smb2cli_close.c
+++ b/source3/libsmb/smb2cli_close.c
@@ -74,7 +74,6 @@ static void smb2cli_close_done(struct tevent_req *subreq)
 		tevent_req_callback_data(subreq,
 		struct tevent_req);
 	NTSTATUS status;
-	struct iovec *iov;
 	static const struct smb2cli_req_expected_response expected[] = {
 	{
 		.status = NT_STATUS_OK,
@@ -82,7 +81,7 @@ static void smb2cli_close_done(struct tevent_req *subreq)
 	}
 	};
 
-	status = smb2cli_req_recv(subreq, talloc_tos(), &iov,
+	status = smb2cli_req_recv(subreq, NULL, NULL,
 				  expected, ARRAY_SIZE(expected));
 	if (tevent_req_nterror(req, status)) {
 		return;
diff --git a/source3/libsmb/smb2cli_create.c b/source3/libsmb/smb2cli_create.c
index 79a7214..4fa782f 100644
--- a/source3/libsmb/smb2cli_create.c
+++ b/source3/libsmb/smb2cli_create.c
@@ -105,7 +105,7 @@ struct tevent_req *smb2cli_create_send(
 	blob = data_blob_null;
 
 	if (blobs != NULL) {
-		status = smb2_create_blob_push(talloc_tos(), &blob, *blobs);
+		status = smb2_create_blob_push(state, &blob, *blobs);
 		if (tevent_req_nterror(req, status)) {
 			return tevent_req_post(req, ev);
 		}
@@ -170,7 +170,7 @@ static void smb2cli_create_done(struct tevent_req *subreq)
 	}
 	};
 
-	status = smb2cli_req_recv(subreq, talloc_tos(), &iov,
+	status = smb2cli_req_recv(subreq, state, &iov,
 				  expected, ARRAY_SIZE(expected));
 	if (tevent_req_nterror(req, status)) {
 		return;
diff --git a/source3/libsmb/smb2cli_flush.c b/source3/libsmb/smb2cli_flush.c
index d46eeed..738af24 100644
--- a/source3/libsmb/smb2cli_flush.c
+++ b/source3/libsmb/smb2cli_flush.c
@@ -72,7 +72,6 @@ static void smb2cli_flush_done(struct tevent_req *subreq)
 		tevent_req_callback_data(subreq,
 		struct tevent_req);
 	NTSTATUS status;
-	struct iovec *iov;
 	static const struct smb2cli_req_expected_response expected[] = {
 	{
 		.status = NT_STATUS_OK,
@@ -80,7 +79,7 @@ static void smb2cli_flush_done(struct tevent_req *subreq)
 	}
 	};
 
-	status = smb2cli_req_recv(subreq, talloc_tos(), &iov,
+	status = smb2cli_req_recv(subreq, NULL, NULL,
 				  expected, ARRAY_SIZE(expected));
 	if (tevent_req_nterror(req, status)) {
 		return;
diff --git a/source3/libsmb/smb2cli_ioctl.c b/source3/libsmb/smb2cli_ioctl.c
index 188bf1b..58c348d 100644
--- a/source3/libsmb/smb2cli_ioctl.c
+++ b/source3/libsmb/smb2cli_ioctl.c
@@ -176,7 +176,7 @@ static void smb2cli_ioctl_done(struct tevent_req *subreq)
 	}
 	};
 
-	status = smb2cli_req_recv(subreq, talloc_tos(), &iov,
+	status = smb2cli_req_recv(subreq, state, &iov,
 				  expected, ARRAY_SIZE(expected));
 	if (tevent_req_nterror(req, status)) {
 		return;
diff --git a/source3/libsmb/smb2cli_query_info.c b/source3/libsmb/smb2cli_query_info.c
new file mode 100644
index 0000000..366dc4a
--- /dev/null
+++ b/source3/libsmb/smb2cli_query_info.c
@@ -0,0 +1,254 @@
+/*
+   Unix SMB/CIFS implementation.
+   smb2 lib
+   Copyright (C) Stefan Metzmacher 2012
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "client.h"
+#include "async_smb.h"
+#include "../libcli/smb/smbXcli_base.h"
+#include "smb2cli.h"
+#include "libsmb/proto.h"
+#include "lib/util/tevent_ntstatus.h"
+#include "../librpc/ndr/libndr.h"
+
+struct smb2cli_query_info_state {
+	uint8_t fixed[0x28];
+	uint8_t dyn_pad[1];
+	uint32_t max_output_length;
+	struct iovec *recv_iov;
+	DATA_BLOB out_output_buffer;
+};
+
+static void smb2cli_query_info_done(struct tevent_req *subreq);
+
+struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
+					   struct tevent_context *ev,
+					   struct smbXcli_conn *conn,
+					   uint32_t timeout_msec,
+					   struct smbXcli_session *session,
+					   uint32_t tcon_id,
+					   uint8_t in_info_type,
+					   uint8_t in_file_info_class,
+					   uint32_t in_max_output_length,
+					   const DATA_BLOB *in_input_buffer,
+					   uint32_t in_additional_info,
+					   uint32_t in_flags,
+					   uint64_t in_fid_persistent,
+					   uint64_t in_fid_volatile)
+{
+	struct tevent_req *req, *subreq;
+	struct smb2cli_query_info_state *state;
+	uint8_t *fixed;
+	uint8_t *dyn;
+	size_t dyn_len;
+	uint16_t input_buffer_offset = 0;
+	uint32_t input_buffer_length = 0;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct smb2cli_query_info_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->max_output_length = in_max_output_length;
+
+	if (in_input_buffer) {
+		input_buffer_offset = SMB2_HDR_BODY+0x28;
+		input_buffer_length = in_input_buffer->length;
+	}
+
+	fixed = state->fixed;
+
+	SSVAL(fixed, 0x00, 0x29);
+	SCVAL(fixed, 0x02, in_info_type);
+	SCVAL(fixed, 0x03, in_file_info_class); /* reserved */
+	SIVAL(fixed, 0x04, in_max_output_length);
+	SSVAL(fixed, 0x08, input_buffer_offset);
+	SSVAL(fixed, 0x0A, 0); /* reserved */
+	SIVAL(fixed, 0x0C, input_buffer_length);
+	SIVAL(fixed, 0x10, in_additional_info);
+	SIVAL(fixed, 0x14, in_flags);
+	SBVAL(fixed, 0x18, in_fid_persistent);
+	SBVAL(fixed, 0x20, in_fid_volatile);
+
+	if (input_buffer_length > 0) {
+		dyn = in_input_buffer->data;
+		dyn_len = in_input_buffer->length;
+	} else {
+		dyn = state->dyn_pad;
+		dyn_len = sizeof(state->dyn_pad);
+	}
+
+	subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_GETINFO,
+				  0, 0, /* flags */
+				  timeout_msec,
+				  0xFEFF, /* pid */
+				  tcon_id,
+				  session,
+				  state->fixed, sizeof(state->fixed),
+				  dyn, dyn_len);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, smb2cli_query_info_done, req);
+	return req;
+}
+
+static void smb2cli_query_info_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req =
+		tevent_req_callback_data(subreq,
+		struct tevent_req);
+	struct smb2cli_query_info_state *state =
+		tevent_req_data(req,
+		struct smb2cli_query_info_state);
+	NTSTATUS status;
+	struct iovec *iov;
+	uint8_t *fixed;
+	uint8_t *dyn;
+	size_t dyn_len;
+	uint32_t dyn_ofs = SMB2_HDR_BODY + 0x08;
+	uint32_t output_buffer_offset;
+	uint32_t output_buffer_length;
+	static const struct smb2cli_req_expected_response expected[] = {
+	{
+		.status = NT_STATUS_OK,
+		.body_size = 0x09
+	},
+	{
+		.status = STATUS_BUFFER_OVERFLOW,
+		.body_size = 0x09
+	}
+	};
+
+	status = smb2cli_req_recv(subreq, state, &iov,
+				  expected, ARRAY_SIZE(expected));
+	if (tevent_req_nterror(req, status)) {
+		return;
+	}
+
+	state->recv_iov = iov;
+	fixed = (uint8_t *)iov[1].iov_base;
+	dyn = (uint8_t *)iov[2].iov_base;
+	dyn_len = iov[2].iov_len;
+
+	output_buffer_offset = SVAL(fixed, 0x02);
+	output_buffer_length = IVAL(fixed, 0x04);
+
+	if ((output_buffer_offset > 0) && (output_buffer_length > 0)) {
+		if (output_buffer_offset != dyn_ofs) {
+			tevent_req_nterror(
+				req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+			return;
+		}
+
+		if (output_buffer_length < dyn_len) {
+			tevent_req_nterror(
+				req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+			return;
+		}
+
+		if (output_buffer_length > state->max_output_length) {
+			tevent_req_nterror(
+				req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+			return;
+		}
+
+		state->out_output_buffer.data = dyn;
+		state->out_output_buffer.length = output_buffer_length;
+	}
+
+	tevent_req_done(req);
+}
+
+NTSTATUS smb2cli_query_info_recv(struct tevent_req *req,
+				 TALLOC_CTX *mem_ctx,
+				 DATA_BLOB *out_output_buffer)
+{
+	struct smb2cli_query_info_state *state =
+		tevent_req_data(req,
+		struct smb2cli_query_info_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		tevent_req_received(req);
+		return status;
+	}
+
+	talloc_steal(mem_ctx, state->recv_iov);
+	if (out_output_buffer) {
+		*out_output_buffer = state->out_output_buffer;
+	}
+
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
+NTSTATUS smb2cli_query_info(struct smbXcli_conn *conn,
+			    uint32_t timeout_msec,
+			    struct smbXcli_session *session,
+			    uint32_t tcon_id,
+			    uint8_t in_info_type,
+			    uint8_t in_file_info_class,
+			    uint32_t in_max_output_length,
+			    const DATA_BLOB *in_input_buffer,
+			    uint32_t in_additional_info,
+			    uint32_t in_flags,
+			    uint64_t in_fid_persistent,
+			    uint64_t in_fid_volatile,
+			    TALLOC_CTX *mem_ctx,
+			    DATA_BLOB *out_output_buffer)
+{
+	TALLOC_CTX *frame = talloc_stackframe();
+	struct tevent_context *ev;
+	struct tevent_req *req;
+	NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+	if (smbXcli_conn_has_async_calls(conn)) {
+		/*
+		 * Can't use sync call while an async call is in flight
+		 */
+		status = NT_STATUS_INVALID_PARAMETER_MIX;
+		goto fail;
+	}
+	ev = tevent_context_init(frame);
+	if (ev == NULL) {
+		goto fail;
+	}
+	req = smb2cli_query_info_send(frame, ev,
+				      conn, timeout_msec,
+				      session, tcon_id,
+				      in_info_type,
+				      in_file_info_class,
+				      in_max_output_length,
+				      in_input_buffer,
+				      in_additional_info,
+				      in_flags,
+				      in_fid_persistent,
+				      in_fid_volatile);
+	if (req == NULL) {
+		goto fail;
+	}
+	if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+		goto fail;
+	}
+	status = smb2cli_query_info_recv(req, mem_ctx,
+					 out_output_buffer);
+ fail:
+	TALLOC_FREE(frame);
+	return status;
+}
diff --git a/source3/libsmb/smb2cli_set_info.c b/source3/libsmb/smb2cli_set_info.c
new file mode 100644
index 0000000..2ffb3ec
--- /dev/null
+++ b/source3/libsmb/smb2cli_set_info.c
@@ -0,0 +1,188 @@
+/*
+   Unix SMB/CIFS implementation.
+   smb2 lib
+   Copyright (C) Stefan Metzmacher 2012
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the


-- 
Samba Shared Repository


More information about the samba-cvs mailing list