From 417feb2851a8d42d47577dc2446ada7d9b9849bb Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2025 11:51:28 +0200 Subject: [PATCH] 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 Reviewed-by: Bjoern Jacke (cherry picked from commit c2b74ef093aff6175ef8e4572a203e5beacc527f) --- source3/smbd/open.c | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.47.2