[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Apr 28 19:47:02 UTC 2020


The branch, master has been updated
       via  dedb4f24af9 s4:torture: Convert samba3.raw.mkdir test to smb2
       via  34311553d7f s4:torture: Convert samba4.base.tcon test to smb2
       via  c690428ebec Convert samba4.base.mangle test to smb2
       via  18db8bd9c4e Implement alt name query for smb2
       via  67e589c1111 Convert samba4.base.maximum_allowed to smb2
       via  a3ddd679d74 Add SMB2 lsa helper routines
       via  2f55b662a36 smbd: add missing done check from unix_convert_step_stat() refactoring
      from  6233929f722 lib: Remove unused elements from ctdbd_connection

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


- Log -----------------------------------------------------------------
commit dedb4f24af99c8ed5e601bdb30a8ed14de0aae54
Author: David Mulder <dmulder at suse.com>
Date:   Thu Jan 23 07:26:53 2020 -0700

    s4:torture: Convert samba3.raw.mkdir test to smb2
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 888abcaf8ffbec45fc47520bd3f544e3aa6f58f2)
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Apr 28 19:46:32 UTC 2020 on sn-devel-184

commit 34311553d7f3bbc91a86ad5fe51e3b46f3ba505b
Author: David Mulder <dmulder at suse.com>
Date:   Mon Jan 6 09:43:19 2020 -0700

    s4:torture: Convert samba4.base.tcon test to smb2
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit eb167bc43dbe196ef5b3bfd24160c72c74113dea)

commit c690428ebec6f2c71cb6e28283c6ff6e02ac0278
Author: David Mulder <dmulder at suse.com>
Date:   Mon Dec 23 13:58:47 2019 -0700

    Convert samba4.base.mangle test to smb2
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9437b44668c9f7742d6d4fe0891ac4d9fda7c804)

commit 18db8bd9c4e78f4897154432464e51074ecaf0f9
Author: David Mulder <dmulder at suse.com>
Date:   Mon Jan 13 09:19:51 2020 -0700

    Implement alt name query for smb2
    
    Implements smb2_qpathinfo_alt_name() and
    RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION.
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 097df343ce21c8340aee7f42f233fe74b92b47e2)

commit 67e589c1111c4e2b3d9f039c98e0d8e55e8730a5
Author: David Mulder <dmulder at suse.com>
Date:   Fri Dec 20 14:06:13 2019 -0700

    Convert samba4.base.maximum_allowed to smb2
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit d9edfeea668362269d812f82b1957ed16ff56dd4)

commit a3ddd679d7438256f894dc50de917328fab822ab
Author: David Mulder <dmulder at suse.com>
Date:   Fri Dec 20 14:10:49 2019 -0700

    Add SMB2 lsa helper routines
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3763052c2a95ac9bd60f00458389a5245cf5d58d)

commit 2f55b662a361e80409e568c04710a51fdef26b2a
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Apr 28 08:04:41 2020 +0200

    smbd: add missing done check from unix_convert_step_stat() refactoring
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 selftest/knownfail                    |   1 +
 selftest/skip                         |   3 +
 selftest/todo_smb2_tests_to_port.list |   6 -
 source3/selftest/tests.py             |   3 +
 source3/smbd/filename.c               |   3 +
 source4/libcli/raw/interfaces.h       |   4 +-
 source4/libcli/raw/rawfileinfo.c      |   5 +
 source4/libcli/smb2/smb2.h            |  11 ++
 source4/libcli/smb2/util.c            |  53 ++++++++
 source4/libcli/util/clilsa.c          | 140 +++++++++++++++++++
 source4/ntvfs/ntvfs_generic.c         |   1 +
 source4/ntvfs/posix/pvfs_qfileinfo.c  |   1 +
 source4/torture/gentest.c             |   1 +
 source4/torture/raw/acls.c            |   1 +
 source4/torture/smb2/mangle.c         | 245 ++++++++++++++++++++++++++++++++++
 source4/torture/smb2/max_allowed.c    | 192 ++++++++++++++++++++++++++
 source4/torture/smb2/mkdir.c          | 105 +++++++++++++++
 source4/torture/smb2/smb2.c           |   4 +
 source4/torture/smb2/tcon.c           | 146 ++++++++++++++++++++
 source4/torture/smb2/util.c           |  45 +++++++
 source4/torture/smb2/wscript_build    |   4 +
 source4/torture/util_smb.c            |   1 +
 22 files changed, 968 insertions(+), 7 deletions(-)
 create mode 100644 source4/torture/smb2/mangle.c
 create mode 100644 source4/torture/smb2/max_allowed.c
 create mode 100644 source4/torture/smb2/mkdir.c
 create mode 100644 source4/torture/smb2/tcon.c


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 1e2deab5f79..09276dd2261 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -115,6 +115,7 @@
 ^samba4.smb2.charset.*.Testing partial surrogate # This test is currently broken
 ^samba3.smb2.charset.*.Testing partial surrogate # This test is currently broken
 ^samba4.*.base.maximum_allowed		# broken until we implement NTCREATEX_OPTIONS_BACKUP_INTENT
+^samba..*.smb2.maximum_allowed
 .*net.api.delshare.*				# DelShare isn't implemented yet
 ^samba4.smb2.oplock.doc
 ^samba4.smb2.lock.valid-request
diff --git a/selftest/skip b/selftest/skip
index f54a23c9235..d13cf7cd18b 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -158,3 +158,6 @@ bench # don't run benchmarks in our selftest
 ^samba4.blackbox.ktpass # this test isn't portable ...
 ^samba4.rpc.unixinfo # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
 ^samba.tests.dcerpc.unix  # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
+^samba4.smb2.mangle.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
+^samba4.smb2.tcon.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
+^samba4.smb2.mkdir.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
diff --git a/selftest/todo_smb2_tests_to_port.list b/selftest/todo_smb2_tests_to_port.list
index 819ff69e677..a9d7b8b48c5 100644
--- a/selftest/todo_smb2_tests_to_port.list
+++ b/selftest/todo_smb2_tests_to_port.list
@@ -35,8 +35,6 @@ samba3.base.disconnect(nt4_dc_smb1)
 samba3.base.fdpass(ad_dc_smb1)
 samba3.base.fdpass(nt4_dc_smb1)
 samba3.base.lock(nt4_dc_smb1)
-samba3.base.mangle(ad_dc_smb1)
-samba3.base.mangle(nt4_dc_smb1)
 samba3.base.negnowait(ad_dc_smb1)
 samba3.base.negnowait(nt4_dc_smb1)
 samba3.base.ntdeny1(ad_dc_smb1)
@@ -57,10 +55,8 @@ samba3.base.samba3error(ad_dc_smb1)
 samba3.base.samba3error(nt4_dc_smb1)
 samba3.base.secleak(ad_dc_smb1)
 samba3.base.secleak(nt4_dc_smb1)
-samba3.base.tcon(ad_dc_smb1)
 samba3.base.tcondev(ad_dc_smb1)
 samba3.base.tcondev(nt4_dc_smb1)
-samba3.base.tcon(nt4_dc_smb1)
 samba3.base.trans2(ad_dc_smb1)
 samba3.base.trans2(nt4_dc_smb1)
 samba3.base.unlink(ad_dc_smb1)
@@ -104,8 +100,6 @@ samba3.raw.composite(nt4_dc_smb1)
 samba3.raw.eas(ad_dc_smb1)
 samba3.raw.eas(nt4_dc_smb1)
 samba3.raw.lock(nt4_dc_smb1)
-samba3.raw.mkdir(ad_dc_smb1)
-samba3.raw.mkdir(nt4_dc_smb1)
 samba3.raw.notify(nt4_dc_smb1)
 samba3.raw.open(ad_dc_smb1)
 samba3.raw.open(nt4_dc_smb1)
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 03ffc995114..45b8dca56c2 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -826,6 +826,9 @@ for t in tests:
                   "raw.write",]) :
         plansmbtorture4testsuite(t, "nt4_dc_smb1", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc_smb1", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
+    elif t in ["base.mangle", "base.tcon", "raw.mkdir"]:
+        plansmbtorture4testsuite(t, "nt4_dc_smb1_done", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
+        plansmbtorture4testsuite(t, "ad_dc_smb1_done", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
     else:
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index f45a45c8c7f..7ed59794767 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -841,6 +841,9 @@ static NTSTATUS unix_convert_step(struct uc_state *state)
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
+	if (state->done) {
+		return NT_STATUS_OK;
+	}
 
 	/*
 	 * Add to the dirpath that we have resolved so far.
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 2a344f71148..5b398ee2ced 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -464,7 +464,8 @@ enum smb_fileinfo_level {
 		     RAW_FILEINFO_NORMALIZED_NAME_INFORMATION= SMB_QFILEINFO_NORMALIZED_NAME_INFORMATION,
 		     /* SMB2 specific levels */
 		     RAW_FILEINFO_SMB2_ALL_EAS               = 0x0f01,
-		     RAW_FILEINFO_SMB2_ALL_INFORMATION       = 0x1201
+		     RAW_FILEINFO_SMB2_ALL_INFORMATION       = 0x1201,
+		     RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION  = 0x1501
 };
 
 /* union used in qfileinfo() and qpathinfo() backend calls */
@@ -646,6 +647,7 @@ union smb_fileinfo {
 	/* RAW_FILEINFO_NAME_INFO and RAW_FILEINFO_NAME_INFORMATION interfaces */
 	/* RAW_FILEINFO_ALT_NAME_INFO and RAW_FILEINFO_ALT_NAME_INFORMATION interfaces */
 	/* RAW_FILEINFO_NORMALIZED_NAME_INFORMATION interface */
+	/* RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION interface */
 	struct {
 		enum smb_fileinfo_level level;
 		struct {
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index 235b3cd0fa2..b18bc87b6c3 100644
--- a/source4/libcli/raw/rawfileinfo.c
+++ b/source4/libcli/raw/rawfileinfo.c
@@ -158,6 +158,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_
 		return NT_STATUS_OK;
 
 	case RAW_FILEINFO_ALT_NAME_INFORMATION:
+	case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
 		FINFO_CHECK_MIN_SIZE(4);
 		smbcli_blob_pull_string(NULL, mem_ctx, blob, 
 					&parms->alt_name_info.out.fname, 0, 4, STR_UNICODE);
@@ -470,6 +471,10 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session,
 		return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, 
 						       RAW_FILEINFO_SMB2_ALL_EAS, parms);
 
+	case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
+		return smb_raw_fileinfo_passthru_parse(blob, mem_ctx,
+						       RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION, parms);
+
 	}
 
 	return NT_STATUS_INVALID_LEVEL;
diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h
index 73e117a961d..4aadab21c4c 100644
--- a/source4/libcli/smb2/smb2.h
+++ b/source4/libcli/smb2/smb2.h
@@ -101,12 +101,23 @@ struct smb2_transport {
 };
 
 
+/*
+  SMB2 LSA state
+*/
+struct smb2lsa_state {
+	struct dcerpc_binding_handle *binding_handle;
+	struct smb2_tree *ipc_tree;
+	struct policy_handle handle;
+};
+
+
 /*
   SMB2 tree context
 */
 struct smb2_tree {
 	struct smb2_session *session;
 	struct smbXcli_tcon *smbXcli;
+	struct smb2lsa_state *lsa;
 };
 
 /*
diff --git a/source4/libcli/smb2/util.c b/source4/libcli/smb2/util.c
index 882dcb9468b..b2efabb5a44 100644
--- a/source4/libcli/smb2/util.c
+++ b/source4/libcli/smb2/util.c
@@ -285,3 +285,56 @@ bool smb2_util_handle_empty(const struct smb2_handle h)
 
 	return smb2_util_handle_equal(h, empty);
 }
+
+/****************************************************************************
+send a qpathinfo SMB_QUERY_FILE_ALT_NAME_INFO call
+****************************************************************************/
+NTSTATUS smb2_qpathinfo_alt_name(TALLOC_CTX *ctx, struct smb2_tree *tree,
+				 const char *fname, const char **alt_name)
+{
+	union smb_fileinfo parms;
+	TALLOC_CTX *mem_ctx;
+	NTSTATUS status;
+	struct smb2_create create_io = {0};
+
+	mem_ctx = talloc_new(ctx);
+	if (!mem_ctx) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	create_io.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
+	create_io.in.share_access = NTCREATEX_SHARE_ACCESS_NONE;
+	create_io.in.create_disposition = FILE_OPEN;
+	create_io.in.fname = fname;
+	status = smb2_create(tree, mem_ctx, &create_io);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(mem_ctx);
+		return status;
+	}
+
+	parms.alt_name_info.level = RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION;
+	parms.alt_name_info.in.file.handle = create_io.out.file.handle;
+
+	status = smb2_getinfo_file(tree, mem_ctx, &parms);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(mem_ctx);
+		return status;
+	}
+
+	status = smb2_util_close(tree, create_io.out.file.handle);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(mem_ctx);
+		return status;
+	}
+
+	if (!parms.alt_name_info.out.fname.s) {
+		*alt_name = talloc_strdup(ctx, "");
+	} else {
+		*alt_name = talloc_strdup(ctx,
+					  parms.alt_name_info.out.fname.s);
+	}
+
+	talloc_free(mem_ctx);
+
+	return NT_STATUS_OK;
+}
diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c
index b9f220f48ab..8476fd890c3 100644
--- a/source4/libcli/util/clilsa.c
+++ b/source4/libcli/util/clilsa.c
@@ -27,6 +27,7 @@
 
 #include "includes.h"
 #include "libcli/raw/libcliraw.h"
+#include "libcli/smb2/smb2.h"
 #include "libcli/libcli.h"
 #include "libcli/security/security.h"
 #include "librpc/gen_ndr/ndr_lsa.h"
@@ -142,6 +143,81 @@ static NTSTATUS smblsa_connect(struct smbcli_state *cli)
 }
 
 
+static NTSTATUS smb2lsa_connect(struct smb2_tree *tree)
+{
+	struct smb2lsa_state *lsa = NULL;
+	struct dcerpc_pipe *lsa_pipe = NULL;
+	NTSTATUS status;
+	struct lsa_OpenPolicy2 r = {{0}, {0}};
+	const char *system_name = "\\";
+	struct lsa_ObjectAttribute attr = {0};
+	struct lsa_QosInfo qos = {0};
+
+	if (tree->lsa != NULL) {
+		return NT_STATUS_OK;
+	}
+
+	lsa = talloc(tree, struct smb2lsa_state);
+	if (lsa == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	lsa_pipe = dcerpc_pipe_init(lsa, tree->session->transport->ev);
+	if (lsa_pipe == NULL) {
+		talloc_free(lsa);
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	/* open the LSA pipe */
+	status = dcerpc_pipe_open_smb2(lsa_pipe, tree, NDR_LSARPC_NAME);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(lsa);
+		return status;
+	}
+
+	/* bind to the LSA pipe */
+	status = dcerpc_bind_auth_none(lsa_pipe, &ndr_table_lsarpc);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(lsa);
+		return status;
+	}
+	lsa->binding_handle = lsa_pipe->binding_handle;
+
+	/* open a lsa policy handle */
+	qos.len = 0;
+	qos.impersonation_level = 2;
+	qos.context_mode = 1;
+	qos.effective_only = 0;
+
+	attr.len = 0;
+	attr.root_dir = NULL;
+	attr.object_name = NULL;
+	attr.attributes = 0;
+	attr.sec_desc = NULL;
+	attr.sec_qos = &qos;
+
+	r.in.system_name = system_name;
+	r.in.attr = &attr;
+	r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+	r.out.handle = &lsa->handle;
+
+	status = dcerpc_lsa_OpenPolicy2_r(lsa->binding_handle, lsa, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(lsa);
+		return status;
+	}
+
+	if (!NT_STATUS_IS_OK(r.out.result)) {
+		talloc_free(lsa);
+		return r.out.result;
+	}
+
+	tree->lsa = lsa;
+
+	return NT_STATUS_OK;
+}
+
+
 /*
   return the set of privileges for the given sid
 */
@@ -170,6 +246,31 @@ NTSTATUS smblsa_sid_privileges(struct smbcli_state *cli, struct dom_sid *sid,
 }
 
 
+NTSTATUS smb2lsa_sid_privileges(struct smb2_tree *tree, struct dom_sid *sid,
+				TALLOC_CTX *mem_ctx,
+				struct lsa_RightSet *rights)
+{
+	NTSTATUS status;
+	struct lsa_EnumAccountRights r = {{0}, {0}};
+
+	status = smb2lsa_connect(tree);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	r.in.handle = &tree->lsa->handle;
+	r.in.sid = sid;
+	r.out.rights = rights;
+
+	status = dcerpc_lsa_EnumAccountRights_r(tree->lsa->binding_handle, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	return r.out.result;
+}
+
+
 /*
   check if a named sid has a particular named privilege
 */
@@ -207,6 +308,45 @@ NTSTATUS smblsa_sid_check_privilege(struct smbcli_state *cli,
 }
 
 
+NTSTATUS smb2lsa_sid_check_privilege(struct smb2_tree *tree,
+				     const char *sid_str,
+				     const char *privilege)
+{
+	struct lsa_RightSet rights = {0};
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx = NULL;
+	struct dom_sid *sid = NULL;
+	unsigned i;
+
+	mem_ctx = talloc_new(tree);
+	if (!mem_ctx) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	sid = dom_sid_parse_talloc(mem_ctx, sid_str);
+	if (sid == NULL) {
+		talloc_free(mem_ctx);
+		return NT_STATUS_INVALID_SID;
+	}
+
+	status = smb2lsa_sid_privileges(tree, sid, mem_ctx, &rights);
+	if (!NT_STATUS_IS_OK(status)) {
+		talloc_free(mem_ctx);
+		return status;
+	}
+
+	for (i=0;i<rights.count;i++) {
+		if (strcmp(rights.names[i].string, privilege) == 0) {
+			talloc_free(mem_ctx);
+			return NT_STATUS_OK;
+		}
+	}
+
+	talloc_free(mem_ctx);
+	return NT_STATUS_NOT_FOUND;
+}
+
+
 /*
   lookup a SID, returning its name
 */
diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
index 69e046c9143..be6bc830ced 100644
--- a/source4/ntvfs/ntvfs_generic.c
+++ b/source4/ntvfs/ntvfs_generic.c
@@ -862,6 +862,7 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx,
 		
 	case RAW_FILEINFO_ALT_NAME_INFO:
 	case RAW_FILEINFO_ALT_NAME_INFORMATION:
+	case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
 		info->alt_name_info.out.fname.s = talloc_strdup(mem_ctx, info2->generic.out.alt_fname.s);
 		NT_STATUS_HAVE_NO_MEMORY(info->alt_name_info.out.fname.s);
 		info->alt_name_info.out.fname.private_length = info2->generic.out.alt_fname.private_length;
diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c
index 53cde69b1b7..be601a26f97 100644
--- a/source4/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_qfileinfo.c
@@ -254,6 +254,7 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
 
 	case RAW_FILEINFO_ALT_NAME_INFO:
 	case RAW_FILEINFO_ALT_NAME_INFORMATION:
+	case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
 		info->name_info.out.fname.s = pvfs_short_name(pvfs, name, name);
 		return NT_STATUS_OK;
 
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 76712b52397..f6cf4aa28b7 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -1640,6 +1640,7 @@ static bool cmp_fileinfo(int instance,
 
 	case RAW_FILEINFO_ALT_NAME_INFO:
 	case RAW_FILEINFO_ALT_NAME_INFORMATION:
+	case RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION:
 		CHECK_WSTR_EQUAL(alt_name_info.out.fname);
 		break;
 
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 9e3202b6fbd..9d9b6b130f3 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -24,6 +24,7 @@
 #include "libcli/raw/libcliraw.h"
 #include "libcli/libcli.h"
 #include "librpc/gen_ndr/lsa.h"
+#include "libcli/smb2/smb2.h"
 #include "libcli/util/clilsa.h"
 #include "libcli/security/security.h"
 #include "torture/util.h"
diff --git a/source4/torture/smb2/mangle.c b/source4/torture/smb2/mangle.c
new file mode 100644
index 00000000000..f489f25654c
--- /dev/null
+++ b/source4/torture/smb2/mangle.c
@@ -0,0 +1,245 @@
+/*
+   Unix SMB/CIFS implementation.
+   SMB torture tester - mangling test
+   Copyright (C) Andrew Tridgell 2002
+   Copyright (C) David Mulder 2019
+
+   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 "system/filesys.h"
+#include "system/dir.h"
+#include <tdb.h>
+#include "../lib/util/util_tdb.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+#include "torture/util.h"
+#include "torture/smb2/proto.h"
+
+static TDB_CONTEXT *tdb;
+
+#define NAME_LENGTH 20
+
+static unsigned int total, collisions, failures;
+
+static bool test_one(struct torture_context *tctx, struct smb2_tree *tree,
+		     const char *name)
+{
+	struct smb2_handle fnum;
+	const char *shortname;
+	const char *name2;
+	NTSTATUS status;
+	TDB_DATA data;
+	struct smb2_create io = {0};
+
+	total++;
+
+	io.in.fname = name;
+	io.in.desired_access = SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA |
+			       SEC_FILE_EXECUTE;
+	io.in.create_disposition = NTCREATEX_DISP_CREATE;
+	io.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+			     NTCREATEX_SHARE_ACCESS_WRITE |
+			     NTCREATEX_SHARE_ACCESS_DELETE;
+	io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list