[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Thu Apr 17 11:31:01 UTC 2025


The branch, master has been updated
       via  80d5fa134d5 libcli/smb: make smb2_lease_{pull,push} endian safe
       via  edf9cf4b29d libcli/smb: convert smb2_lease_push() to PUSH_LE_U*
       via  cbe438eb1a3 libcli/smb: make the last 2 reserved bytes explicit in smb2_lease_push()
       via  31ebf2cd1da libcli/smb: convert smb2_lease_pull() to PULL_LE_U*
       via  c2b74ef093a s3:smbd: work around broken "vfs mkdir use tmp name" on FAT
      from  9e637a28bd0 vfs: Fix "wide links = yes"

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


- Log -----------------------------------------------------------------
commit 80d5fa134d51b4b2238f775fea0af3d511bf3144
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

commit edf9cf4b29dab78f63eec8391cd1cd9eef861612
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>

commit cbe438eb1a3c44f5cd46c5e685da9964da64f892
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>

commit 31ebf2cd1daeed25fab92ef71f7591fea8c92226
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>

commit c2b74ef093aff6175ef8e4572a203e5beacc527f
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>

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

Summary of changes:
 libcli/smb/smb2_lease.c | 29 +++++++++++++++++------------
 source3/smbd/open.c     |  7 +++++++
 2 files changed, 24 insertions(+), 12 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/smbd/open.c b/source3/smbd/open.c
index df6606f0215..c49b8ab8c92 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4625,6 +4625,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