[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Jun 9 20:39:01 UTC 2021
The branch, master has been updated
via 52a42111121 smbd: return correct timestamps for quota fake file
via e093eaed104 smbd: handle fake file handles in fdos_mode()
via 51b0fd0c566 smbd: add dosmode_from_fake_filehandle()
via 1e338d51602 smbtorture: verify attributes on fake quota file handle
from 694dc56faf8 gpo: Apply Group Policy GNOME Settings
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 52a421111218d94d2e5cb131648bcdf5411d910b
Author: Ralph Boehme <slow at samba.org>
Date: Mon Jun 7 19:02:56 2021 +0200
smbd: return correct timestamps for quota fake file
Prior to 572d4e3a56eef00e29f93482daa21647af7310d0 it was sufficient to
initialize struct timespec to zero to return NTTIME 0 (ie not set) over
SMB.
This fixes the same problem from bug 14714 where the timestamps in an SMB2 CLOSE
response.
Windows of course does return *some* timestamps, but as it's neither documented
nor was I able to figure out where they would be coming from, as well as the
Windows client apparently doesn't care, I didn't bother with implementing some
sophisticated heuristic to return some timestamps.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Jun 9 20:38:02 UTC 2021 on sn-devel-184
commit e093eaed1046638193d973c39fa9df74e41148d3
Author: Ralph Boehme <slow at samba.org>
Date: Fri Jun 4 15:54:20 2021 +0200
smbd: handle fake file handles in fdos_mode()
This ensures SMB requests on the quote fake file "$Extend/$Quota" don't hit the
VFS, where specifically in vfs_gpfs we log an error message if we fail to read
the DOS attributes for a file with
vfs_gpfs_get_dos_attributes: Getting winattrs failed for $Extend/$Quota
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 51b0fd0c566ff6bf112ab9752d9b105a6bb786a8
Author: Ralph Boehme <slow at samba.org>
Date: Fri Jun 4 16:31:20 2021 +0200
smbd: add dosmode_from_fake_filehandle()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1e338d51602a7dca6108e5e8704f5cdde4740713
Author: Ralph Boehme <slow at samba.org>
Date: Mon Jun 7 19:03:05 2021 +0200
smbtorture: verify attributes on fake quota file handle
The expected DOS attributes are taken from a Windows 2016 server. The expected
timestamps are what Samba has returned before commit 572d4e3a56eef00e29f9348:
NTTIME(0), ie no value.
The upcoming fix will restore this behaviour. Windows of course does
return *some* timestamps, but as it's neither documented nor was I able to
figure out where they would be coming from, as well as the Windows client apparently
doesn't care, I didn't bother with implementing some sophisticated heuristic to
return some timestamps.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/knownfail | 1 +
source3/include/fake_file.h | 1 +
source3/smbd/dosmode.c | 5 ++++
source3/smbd/fake_file.c | 15 +++++++++++
source3/smbd/filename.c | 5 ++++
source4/torture/smb2/create.c | 63 +++++++++++++++++++++++++++++++++++++++++++
6 files changed, 90 insertions(+)
Changeset truncated at 500 lines:
diff --git a/selftest/knownfail b/selftest/knownfail
index 0be542c5c1e..84d2999500a 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -144,6 +144,7 @@
^samba4.raw.acls.*.create_owner_file
^samba4.smb2.create.*.acldir
^samba4.smb2.create.*.impersonation
+^samba4.smb2.create.quota-fake-file\(ad_dc_ntvfs\) # not supported by the NTVFS
^samba4.smb2.acls.*.generic
^samba4.smb2.acls.*.inheritflags
^samba4.smb2.acls.*.owner
diff --git a/source3/include/fake_file.h b/source3/include/fake_file.h
index 00ebc88f7a7..c267df25188 100644
--- a/source3/include/fake_file.h
+++ b/source3/include/fake_file.h
@@ -47,5 +47,6 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint32_t access_mask,
files_struct **result);
NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
+uint32_t dosmode_from_fake_filehandle(const struct fake_file_handle *ffh);
#endif /* _FAKE_FILE_H */
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index ac6afe77464..bcca7e0a50a 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -28,6 +28,7 @@
#include "lib/param/loadparm.h"
#include "lib/util/tevent_ntstatus.h"
#include "lib/util/string_wrappers.h"
+#include "fake_file.h"
static NTSTATUS get_file_handle_for_metadata(connection_struct *conn,
const struct smb_filename *smb_fname,
@@ -753,6 +754,10 @@ uint32_t fdos_mode(struct files_struct *fsp)
DBG_DEBUG("%s\n", fsp_str_dbg(fsp));
+ if (fsp->fake_file_handle != NULL) {
+ return dosmode_from_fake_filehandle(fsp->fake_file_handle);
+ }
+
if (!VALID_STAT(fsp->fsp_name->st)) {
return 0;
}
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index e786ad67b72..92ea14a76da 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -115,6 +115,21 @@ enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname)
return ret;
}
+uint32_t dosmode_from_fake_filehandle(const struct fake_file_handle *ffh)
+{
+ if (ffh->type != FAKE_FILE_TYPE_QUOTA) {
+ DBG_ERR("Unexpected fake_file_handle: %d\n", ffh->type);
+ log_stack_trace();
+ return FILE_ATTRIBUTE_NORMAL;
+ }
+
+ /* This is what Windows 2016 returns */
+ return FILE_ATTRIBUTE_HIDDEN
+ | FILE_ATTRIBUTE_SYSTEM
+ | FILE_ATTRIBUTE_DIRECTORY
+ | FILE_ATTRIBUTE_ARCHIVE;
+}
+
/****************************************************************************
Open a fake quota file with a share mode.
****************************************************************************/
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 44a58a20c1f..11022dca703 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1972,6 +1972,11 @@ static NTSTATUS filename_convert_internal(TALLOC_CTX *ctx,
return NT_STATUS_NO_MEMORY;
}
smb_fname->st = (SMB_STRUCT_STAT) { .st_ex_nlink = 1 };
+ smb_fname->st.st_ex_btime = (struct timespec){0, SAMBA_UTIME_OMIT};
+ smb_fname->st.st_ex_atime = (struct timespec){0, SAMBA_UTIME_OMIT};
+ smb_fname->st.st_ex_mtime = (struct timespec){0, SAMBA_UTIME_OMIT};
+ smb_fname->st.st_ex_ctime = (struct timespec){0, SAMBA_UTIME_OMIT};
+
*_smb_fname = smb_fname;
return NT_STATUS_OK;
}
diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
index c97dfef16d3..5c559bf2d1d 100644
--- a/source4/torture/smb2/create.c
+++ b/source4/torture/smb2/create.c
@@ -2707,6 +2707,68 @@ done:
return ret;
}
+/*
+ test opening quota fakefile handle and returned attributes
+*/
+static bool test_smb2_open_quota_fake_file(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ const char *fname = "$Extend\\$Quota:$Q:$INDEX_ALLOCATION";
+ struct smb2_create create;
+ struct smb2_handle h = {{0}};
+ NTSTATUS status;
+ bool ret = true;
+
+ create = (struct smb2_create) {
+ .in.desired_access = SEC_RIGHTS_FILE_READ,
+ .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
+ .in.share_access = NTCREATEX_SHARE_ACCESS_MASK,
+ .in.create_disposition = NTCREATEX_DISP_OPEN,
+ .in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
+ .in.fname = fname,
+ };
+
+ status = smb2_create(tree, tree, &create);
+ torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+ "smb2_create failed\n");
+ h = create.out.file.handle;
+
+ torture_assert_u64_equal_goto(tctx,
+ create.out.file_attr,
+ FILE_ATTRIBUTE_HIDDEN
+ | FILE_ATTRIBUTE_SYSTEM
+ | FILE_ATTRIBUTE_DIRECTORY
+ | FILE_ATTRIBUTE_ARCHIVE,
+ ret,
+ done,
+ "Wrong attributes\n");
+
+ torture_assert_u64_equal_goto(tctx,
+ create.out.create_time, 0,
+ ret,
+ done,
+ "create_time is not 0\n");
+ torture_assert_u64_equal_goto(tctx,
+ create.out.access_time, 0,
+ ret,
+ done,
+ "access_time is not 0\n");
+ torture_assert_u64_equal_goto(tctx,
+ create.out.write_time, 0,
+ ret,
+ done,
+ "write_time is not 0\n");
+ torture_assert_u64_equal_goto(tctx,
+ create.out.change_time, 0,
+ ret,
+ done,
+ "change_time is not 0\n");
+
+done:
+ smb2_util_close(tree, h);
+ return ret;
+}
+
/*
basic testing of SMB2 read
*/
@@ -2727,6 +2789,7 @@ struct torture_suite *torture_smb2_create_init(TALLOC_CTX *ctx)
torture_suite_add_1smb2_test(suite, "nulldacl", test_create_null_dacl);
torture_suite_add_1smb2_test(suite, "mkdir-dup", test_mkdir_dup);
torture_suite_add_1smb2_test(suite, "dir-alloc-size", test_dir_alloc_size);
+ torture_suite_add_1smb2_test(suite, "quota-fake-file", test_smb2_open_quota_fake_file);
suite->description = talloc_strdup(suite, "SMB2-CREATE tests");
--
Samba Shared Repository
More information about the samba-cvs
mailing list