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

Jule Anger janger at samba.org
Thu Apr 17 17:04:02 UTC 2025


The branch, v4-22-test has been updated
       via  40c8ba32d87 libcli/smb: make smb2_lease_{pull,push} endian safe
       via  93e74025c88 libcli/smb: convert smb2_lease_push() to PUSH_LE_U*
       via  f9a02bb284a libcli/smb: make the last 2 reserved bytes explicit in smb2_lease_push()
       via  db2eac3b62d libcli/smb: convert smb2_lease_pull() to PULL_LE_U*
       via  417feb2851a s3:smbd: work around broken "vfs mkdir use tmp name" on FAT
       via  dadfa06573f vfs: Fix "wide links = yes"
      from  21f1d226e94 python:gp_cert_auto_enrol: fix GUID stringification

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


- Log -----------------------------------------------------------------
commit 40c8ba32d87da607662bf1dde9aa17f3c91399da
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Apr 16 15:18:12 2025 +0200

    libcli/smb: make smb2_lease_{pull,push} endian safe
    
    smbd_smb2_send_lease_break() is already endian safe,
    which means we'll get a mismatch on big endian systems,
    so that smbd_smb2_send_lease_break() sends the lease key
    in reversed order.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Thu Apr 17 11:30:58 UTC 2025 on atb-devel-224
    
    (cherry picked from commit 80d5fa134d51b4b2238f775fea0af3d511bf3144)
    
    Autobuild-User(v4-22-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-22-test): Thu Apr 17 17:03:35 UTC 2025 on atb-devel-224

commit 93e74025c8899d7f19b2ce00d8240ff1c8c0b4f1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Apr 16 15:18:12 2025 +0200

    libcli/smb: convert smb2_lease_push() to PUSH_LE_U*
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    (cherry picked from commit edf9cf4b29dab78f63eec8391cd1cd9eef861612)

commit f9a02bb284ac0530918955a91a9d764a38ad5b51
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Apr 16 15:18:12 2025 +0200

    libcli/smb: make the last 2 reserved bytes explicit in smb2_lease_push()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    (cherry picked from commit cbe438eb1a3c44f5cd46c5e685da9964da64f892)

commit db2eac3b62db3a2398c90ef06f6b6e605d22ef8c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Apr 16 15:18:12 2025 +0200

    libcli/smb: convert smb2_lease_pull() to PULL_LE_U*
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    (cherry picked from commit 31ebf2cd1daeed25fab92ef71f7591fea8c92226)

commit 417feb2851a8d42d47577dc2446ada7d9b9849bb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Apr 16 11:51:28 2025 +0200

    s3:smbd: work around broken "vfs mkdir use tmp name" on FAT
    
    "vfs mkdir use tmp name" creates a name with ":" because the file should
    be invisible for Windows clients. ":" however is an invalid character on
    FAT filesystems and we get EINVAL back. In that case we fall back to not
    using tmp names for mkdir.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15845
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Bjoern Jacke <bjacke at samba.org>
    (cherry picked from commit c2b74ef093aff6175ef8e4572a203e5beacc527f)

commit dadfa06573f3958f88b235c4d2e5ecedab78f6c5
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 3 10:04:42 2025 +0200

    vfs: Fix "wide links = yes"
    
    vfs_wide_links hides symlinks from the rest of smbd, and it implicitly
    follows symlinks. Also, O_PATH will expose symlinks to the rest of
    smbd, remove that.
    
    We also need to do this for posix paths, as deep inside
    rename_internals we want to avoid case-insensitive lookups by setting
    SMB_FILENAME_POSIX_PATH.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15841
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Apr 16 20:56:33 UTC 2025 on atb-devel-224
    
    (cherry picked from commit 9e637a28bd0b5adc2d90df9ca4a1c864a648b0f4)

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

Summary of changes:
 libcli/smb/smb2_lease.c         | 29 +++++++++++++++++------------
 source3/modules/vfs_widelinks.c | 10 ++++++----
 source3/smbd/open.c             |  7 +++++++
 3 files changed, 30 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb2_lease.c b/libcli/smb/smb2_lease.c
index d28477b1911..0fc15e51227 100644
--- a/libcli/smb/smb2_lease.c
+++ b/libcli/smb/smb2_lease.c
@@ -44,21 +44,23 @@ ssize_t smb2_lease_pull(const uint8_t *buf, size_t len,
 		return -1;
 	}
 
-	memcpy(&lease->lease_key, buf, 16);
-	lease->lease_state = IVAL(buf, 16);
+	lease->lease_key.data[0] = PULL_LE_U64(buf, 0);
+	lease->lease_key.data[1] = PULL_LE_U64(buf, 8);
+	lease->lease_state = PULL_LE_U32(buf, 16);
 	lease->lease_version = version;
 
 	switch (version) {
 	case 1:
 		break;
 	case 2:
-		lease->lease_flags = IVAL(buf, 20);
+		lease->lease_flags = PULL_LE_U32(buf, 20);
+		lease->lease_duration = PULL_LE_U64(buf, 24);
 		lease->lease_flags &= SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET;
 		if (lease->lease_flags & SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET) {
-			memcpy(&lease->parent_lease_key, buf+32, 16);
+			lease->parent_lease_key.data[0] = PULL_LE_U64(buf, 32);
+			lease->parent_lease_key.data[1] = PULL_LE_U64(buf, 40);
 		}
-		lease->lease_duration = BVAL(buf, 24);
-		lease->lease_epoch = SVAL(buf, 48);
+		lease->lease_epoch = PULL_LE_U16(buf, 48);
 		break;
 	}
 
@@ -80,14 +82,17 @@ bool smb2_lease_push(const struct smb2_lease *lease, uint8_t *buf, size_t len)
 		return false;
 	}
 
-	memcpy(&buf[0], &lease->lease_key, 16);
-	SIVAL(buf, 16, lease->lease_state);
-	SIVAL(buf, 20, lease->lease_flags);
-	SBVAL(buf, 24, lease->lease_duration);
+	PUSH_LE_U64(buf,  0, lease->lease_key.data[0]);
+	PUSH_LE_U64(buf,  8, lease->lease_key.data[1]);
+	PUSH_LE_U32(buf, 16, lease->lease_state);
+	PUSH_LE_U32(buf, 20, lease->lease_flags);
+	PUSH_LE_U64(buf, 24, lease->lease_duration);
 
 	if (version == 2) {
-		memcpy(&buf[32], &lease->parent_lease_key, 16);
-		SIVAL(buf, 48, lease->lease_epoch);
+		PUSH_LE_U64(buf, 32, lease->parent_lease_key.data[0]);
+		PUSH_LE_U64(buf, 40, lease->parent_lease_key.data[1]);
+		PUSH_LE_U16(buf, 48, lease->lease_epoch);
+		PUSH_LE_U16(buf, 50, 0); /* reserved */
 	}
 
 	return true;
diff --git a/source3/modules/vfs_widelinks.c b/source3/modules/vfs_widelinks.c
index 4339f6de9e0..df00d72707d 100644
--- a/source3/modules/vfs_widelinks.c
+++ b/source3/modules/vfs_widelinks.c
@@ -354,15 +354,17 @@ static int widelinks_openat(vfs_handle_struct *handle,
 				struct widelinks_config,
 				return -1);
 
-	if (config->active &&
-	    (config->cwd != NULL) &&
-	    !(smb_fname->flags & SMB_FILENAME_POSIX_PATH))
-	{
+	if (config->active && (config->cwd != NULL)) {
 		/*
 		 * Module active, openat after chdir (see note 1b above) and not
 		 * a POSIX open (POSIX sees symlinks), so remove O_NOFOLLOW.
 		 */
 		how.flags = (how.flags & ~O_NOFOLLOW);
+#ifdef O_PATH
+		how.flags = (how.flags & ~O_PATH);
+#endif
+		how.resolve = (how.resolve &
+			       ~(VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS));
 	}
 
 	ret = SMB_VFS_NEXT_OPENAT(handle,
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 540dc7a0c60..e23f5d29e6e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4643,6 +4643,13 @@ mkdir_first:
 			      mode);
 	if (ret != 0) {
 		status = map_nt_error_from_unix(errno);
+		if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)
+		    && need_tmpname)
+		{
+			need_tmpname = false;
+			first_atname = smb_fname_atname;
+			goto mkdir_first;
+		}
 		DBG_NOTICE("MKDIRAT failed for '%s': %s\n",
 			   smb_fname_str_dbg(smb_dname), nt_errstr(status));
 		goto restore_orig;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list