[SCM] Samba Shared Repository - branch v4-15-test updated

Jule Anger janger at samba.org
Mon May 9 07:30:01 UTC 2022


The branch, v4-15-test has been updated
       via  e75837c115b s3: smbd: Allow a durable handle on a leased stat-open.
       via  a236b193c42 s4: torture: Add a new test - samba3.smb2.durable-open.stat-open.
      from  aa6022dd222 vfs_gpfs: Ignore pathref fds for gpfs:recalls check

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test


- Log -----------------------------------------------------------------
commit e75837c115bc288758baa51001c66102d2fba61c
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 27 14:08:13 2022 -0700

    s3: smbd: Allow a durable handle on a leased stat-open.
    
    Remove knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15042
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    (back-ported from commit fe7daae8c4692b99ff08d4e3e48034d59ddee245)
    
    Autobuild-User(v4-15-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-15-test): Mon May  9 07:29:28 UTC 2022 on sn-devel-184

commit a236b193c42225a448e3c9c5f289c2812fecb2e9
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 27 12:50:59 2022 -0700

    s4: torture: Add a new test - samba3.smb2.durable-open.stat-open.
    
    Passes against Windows. Shows that Windows allows a durable handle
    on a leased open for READ_ATTRUBUTES only (a stat open).
    
    Mark as knownfail for now.
    
    NB. Not sure why we are testing smb2.durable-open against ad_dc
    as that provisioning has "smb2 leases = no" which precludes
    granting durable handles. Not changing for this bug but this
    should be looked at in future.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15042
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit bb329d4de505d2c01ba45a06311c9dc6d87f8dec)

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

Summary of changes:
 selftest/knownfail                  |  1 +
 source3/smbd/durable.c              |  4 ---
 source4/torture/smb2/durable_open.c | 63 +++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index b5e52753968..cab556be477 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -193,6 +193,7 @@
 ^samba3.smb2.durable-open.delete_on_close2
 ^samba3.smb2.durable-v2-open.app-instance
 ^samba3.smb2.durable-open.reopen1a-lease\(ad_dc\)$
+^samba3.smb2.durable-open.stat-open\(ad_dc\)$
 ^samba3.smb2.durable-v2-open.reopen1a-lease\(ad_dc\)$
 ^samba4.smb2.ioctl.req_resume_key\(ad_dc_ntvfs\) # not supported by s4 ntvfs server
 ^samba4.smb2.ioctl.req_two_resume_keys\(ad_dc_ntvfs\) # not supported by s4 ntvfs server
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index 60e73d6e5e6..edbc6e95749 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -75,10 +75,6 @@ NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
 		return NT_STATUS_NOT_SUPPORTED;
 	}
 
-	if (fsp_get_io_fd(fsp) == -1) {
-		return NT_STATUS_NOT_SUPPORTED;
-	}
-
 	if (is_ntfs_stream_smb_fname(fsp->fsp_name)) {
 		/*
 		 * We do not support durable handles
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 3d78a35d92c..9cd4d88af39 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -2751,6 +2751,67 @@ done:
 	return ret;
 }
 
+/**
+ * durable stat open with lease.
+ */
+static bool test_durable_open_stat_open(struct torture_context *tctx,
+					struct smb2_tree *tree)
+{
+	TALLOC_CTX *mem_ctx = talloc_new(tctx);
+	struct smb2_create io;
+	struct smb2_handle _h;
+	struct smb2_handle *h = NULL;
+	struct smb2_lease ls;
+	NTSTATUS status;
+	char fname[256];
+	bool ret = true;
+	uint64_t lease;
+
+	snprintf(fname, 256, "durable_open_stat_open_%s.dat",
+		 generate_random_str(mem_ctx, 8));
+
+	/* Ensure file doesn't exist. */
+	smb2_util_unlink(tree, fname);
+
+	/* Create a normal file. */
+	smb2_oplock_create(&io, fname, SMB2_OPLOCK_LEVEL_NONE);
+	status = smb2_create(tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	_h = io.out.file.handle;
+	h = &_h;
+	CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+	/* Close. */
+	smb2_util_close(tree, *h);
+	h = NULL;
+
+	/* Now try a leased, durable handle stat open. */
+	lease = random();
+	/* Create with lease */
+	smb2_lease_create(&io,
+			  &ls,
+			  false /* dir */,
+			  fname,
+			  lease,
+			  smb2_util_lease_state("RH"));
+	io.in.durable_open = true;
+	io.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
+	io.in.create_disposition = NTCREATEX_DISP_OPEN;
+
+	status = smb2_create(tree, mem_ctx, &io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
+	CHECK_VAL(io.out.durable_open, true);
+	_h = io.out.file.handle;
+	h = &_h;
+
+done:
+	if (h != NULL) {
+		smb2_util_close(tree, *h);
+	}
+	smb2_util_unlink(tree, fname);
+	talloc_free(mem_ctx);
+	return ret;
+}
 
 struct torture_suite *torture_smb2_durable_open_init(TALLOC_CTX *ctx)
 {
@@ -2786,6 +2847,8 @@ struct torture_suite *torture_smb2_durable_open_init(TALLOC_CTX *ctx)
 				     test_durable_open_alloc_size);
 	torture_suite_add_1smb2_test(suite, "read-only",
 				     test_durable_open_read_only);
+	torture_suite_add_1smb2_test(suite, "stat-open",
+				     test_durable_open_stat_open);
 
 	suite->description = talloc_strdup(suite, "SMB2-DURABLE-OPEN tests");
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list