]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: work around broken "vfs mkdir use tmp name" on FAT
authorStefan Metzmacher <metze@samba.org>
Wed, 16 Apr 2025 09:51:28 +0000 (11:51 +0200)
committerJule Anger <janger@samba.org>
Thu, 17 Apr 2025 15:59:12 +0000 (15:59 +0000)
"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@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
(cherry picked from commit c2b74ef093aff6175ef8e4572a203e5beacc527f)

source3/smbd/open.c

index 540dc7a0c60f09ff9147e6a0e2d66c0a586390a8..e23f5d29e6e548bd3e80678ecc37ead734c3aa73 100644 (file)
@@ -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;