[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Apr 18 15:15:04 MDT 2012


The branch, master has been updated
       via  916297e Fix samba3.raw.samba3hide test - ensure we set up POSIX capabilities before doing POSIX calls like chmod.
       via  c1dbbbc Add smb_raw_setfsinfo() - currently only available level is SMB_SET_CIFS_UNIX_INFO.
       via  124be4c Ensure we have 12 bytes of data for a SMB_SET_CIFS_UNIX_INFO call. Add debug.
      from  b0aaa49 s4-torture: Fix the raw.notify mask test

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


- Log -----------------------------------------------------------------
commit 916297e0454317cbfe400b2d7fa60073bcccb8d6
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 18 12:38:06 2012 -0700

    Fix samba3.raw.samba3hide test - ensure we set up POSIX capabilities
    before doing POSIX calls like chmod.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Wed Apr 18 23:14:40 CEST 2012 on sn-devel-104

commit c1dbbbc40ce6f4f522603078979d6e44dfaf7b36
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 18 12:37:20 2012 -0700

    Add smb_raw_setfsinfo() - currently only available level is SMB_SET_CIFS_UNIX_INFO.

commit 124be4cf8830c149076b7007b15f43f184a6e531
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 18 12:36:19 2012 -0700

    Ensure we have 12 bytes of data for a SMB_SET_CIFS_UNIX_INFO call. Add debug.

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

Summary of changes:
 source3/smbd/trans2.c            |    5 ++-
 source4/libcli/raw/interfaces.h  |   20 ++++++++++
 source4/libcli/raw/libcliraw.h   |    1 +
 source4/libcli/raw/rawfsinfo.c   |   73 ++++++++++++++++++++++++++++++++++++++
 source4/torture/raw/samba3hide.c |   37 +++++++++++++++++++
 5 files changed, 135 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index dcf771a..63ee76b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -3648,13 +3648,16 @@ static void call_trans2setfsinfo(connection_struct *conn,
 	switch(info_level) {
 		case SMB_SET_CIFS_UNIX_INFO:
 			if (!lp_unix_extensions()) {
+				DEBUG(2,("call_trans2setfsinfo: "
+					"SMB_SET_CIFS_UNIX_INFO is invalid with "
+					"unix extensions off\n"));
 				reply_nterror(req,
 					      NT_STATUS_INVALID_LEVEL);
 				return;
 			}
 
 			/* There should be 12 bytes of capabilities set. */
-			if (total_data < 8) {
+			if (total_data < 12) {
 				reply_nterror(
 					req,
 					NT_STATUS_INVALID_PARAMETER);
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 695c13f..8ce5ca2 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -1344,6 +1344,26 @@ union smb_fsinfo {
 };
 
 
+enum smb_setfsinfo_level {
+		RAW_SETFS_UNIX_INFO                      = SMB_SET_CIFS_UNIX_INFO};
+
+union smb_setfsinfo {
+	/* generic interface */
+	struct {
+		enum smb_fsinfo_level level;
+	} generic;
+
+	/* TRANS2 RAW_QFS_UNIX_INFO interface */
+	struct {
+		enum smb_fsinfo_level level;
+
+		struct {
+			uint16_t major_version;
+			uint16_t minor_version;
+			uint64_t capability;
+		} in;
+	} unix_info;
+};
 
 enum smb_open_level {
 	RAW_OPEN_OPEN,
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index 81bf715..b7e5e21 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -280,6 +280,7 @@ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_ope
 bool smbcli_transport_process(struct smbcli_transport *transport);
 const char *smbcli_errstr(struct smbcli_tree *tree);
 NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fsinfo *fsinfo);
+NTSTATUS smb_raw_setfsinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_setfsinfo *set_fsinfo);
 NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms);
 NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_shadow_copy *info);
 NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms);
diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c
index 15599ad..08f68dd 100644
--- a/source4/libcli/raw/rawfsinfo.c
+++ b/source4/libcli/raw/rawfsinfo.c
@@ -332,3 +332,76 @@ _PUBLIC_ NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree,
 	struct smbcli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo);
 	return smb_raw_fsinfo_recv(req, mem_ctx, fsinfo);
 }
+
+/****************************************************************************
+ Set FSInfo raw interface (async recv)
+****************************************************************************/
+static NTSTATUS smb_raw_setfsinfo_recv(struct smbcli_request *req,
+			     TALLOC_CTX *mem_ctx,
+			     union smb_setfsinfo *set_fsinfo)
+{
+	DATA_BLOB blob = data_blob_null;
+	NTSTATUS status;
+
+	if (set_fsinfo->generic.level != RAW_SETFS_UNIX_INFO) {
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	status = smb_raw_qfsinfo_blob_recv(req, mem_ctx, &blob);
+	data_blob_free(&blob);
+	return status;
+}
+
+/****************************************************************************
+ Set FSInfo raw interface (async send)
+****************************************************************************/
+static struct smbcli_request *smb_raw_setfsinfo_send(struct smbcli_tree *tree,
+						TALLOC_CTX *mem_ctx,
+						union smb_setfsinfo *set_fsinfo)
+{
+	struct smb_trans2 tp;
+	uint16_t info_level;
+	uint16_t setup = TRANSACT2_SETFSINFO;
+
+	if (set_fsinfo->generic.level != RAW_SETFS_UNIX_INFO) {
+		return NULL;
+	}
+	tp.in.max_setup = 0;
+	tp.in.flags = 0;
+	tp.in.timeout = 0;
+	tp.in.setup_count = 1;
+	tp.in.max_param = 0;
+	tp.in.max_data = 0xFFFF;
+	tp.in.setup = &setup;
+	tp.in.timeout = 0;
+
+	tp.in.params = data_blob_talloc(mem_ctx, NULL, 4);
+	if (!tp.in.params.data) {
+		return NULL;
+	}
+	info_level = (uint16_t)set_fsinfo->generic.level;
+	SSVAL(tp.in.params.data, 0, 0);
+	SSVAL(tp.in.params.data, 2, info_level);
+
+	tp.in.data = data_blob_talloc(mem_ctx, NULL, 12);
+	if (!tp.in.data.data) {
+		return NULL;
+	}
+
+	SSVAL(tp.in.data.data, 0, set_fsinfo->unix_info.in.major_version);
+	SSVAL(tp.in.data.data, 2, set_fsinfo->unix_info.in.minor_version);
+	SBVAL(tp.in.data.data, 4, set_fsinfo->unix_info.in.capability);
+
+	return smb_raw_trans2_send(tree, &tp);
+}
+
+/****************************************************************************
+ Set FSInfo raw interface (sync interface)
+****************************************************************************/
+_PUBLIC_ NTSTATUS smb_raw_setfsinfo(struct smbcli_tree *tree,
+			TALLOC_CTX *mem_ctx,
+			union smb_setfsinfo *set_fsinfo)
+{
+	struct smbcli_request *req = smb_raw_setfsinfo_send(tree, mem_ctx, set_fsinfo);
+	return smb_raw_setfsinfo_recv(req, mem_ctx, set_fsinfo);
+}
diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c
index 5ecf4f6..c3a572c 100644
--- a/source4/torture/raw/samba3hide.c
+++ b/source4/torture/raw/samba3hide.c
@@ -114,6 +114,36 @@ static bool smbcli_file_exists(struct smbcli_tree *tree, const char *fname)
 	return NT_STATUS_IS_OK(smbcli_getatr(tree, fname, NULL, NULL, NULL));
 }
 
+static NTSTATUS smbcli_setup_unix(struct smbcli_tree *tree)
+{
+	union smb_fsinfo fsinfo;
+	union smb_setfsinfo set_fsinfo;
+	NTSTATUS status;
+
+	ZERO_STRUCT(fsinfo);
+	ZERO_STRUCT(set_fsinfo);
+
+	fsinfo.generic.level = RAW_QFS_UNIX_INFO;
+	status = smb_raw_fsinfo(tree, NULL, &fsinfo);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("smb_raw_fsinfo failed %s\n",
+			nt_errstr(status));
+		return status;
+	}
+
+	set_fsinfo.generic.level = RAW_SETFS_UNIX_INFO;
+	set_fsinfo.unix_info.in.major_version = fsinfo.unix_info.out.major_version;
+	set_fsinfo.unix_info.in.minor_version = fsinfo.unix_info.out.minor_version;
+	set_fsinfo.unix_info.in.capability = fsinfo.unix_info.out.capability;
+
+	status = smb_raw_setfsinfo(tree, NULL, &set_fsinfo);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("smb_raw_setfsinfo failed %s\n",
+			nt_errstr(status));
+	}
+	return status;
+}
+
 static NTSTATUS smbcli_chmod(struct smbcli_tree *tree, const char *fname,
 			     uint64_t permissions)
 {
@@ -139,6 +169,13 @@ bool torture_samba3_hide(struct torture_context *torture)
 		torture_fail(torture, "torture_open_connection_share failed\n");
 	}
 
+	status = smbcli_setup_unix(cli->tree);
+	if (!NT_STATUS_IS_OK(status)) {
+		torture_fail(torture,
+			talloc_asprintf(torture, "smbcli_setup_unix failed %s\n",
+				nt_errstr(status)));
+	}
+
 	status = torture_second_tcon(torture, cli->session, "hideunread",
 				     &hideunread);
 	torture_assert_ntstatus_ok(torture, status, "second_tcon(hideunread) failed\n");


-- 
Samba Shared Repository


More information about the samba-cvs mailing list