Bug 16240 - smbd temporary mkdir name can exceed NAME_MAX for otherwise valid client names
Summary: smbd temporary mkdir name can exceed NAME_MAX for otherwise valid client names
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.25.0rc*
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-09-09 18:10 UTC by Anoop C S
Modified: 2026-10-02 16:31 UTC (History)
2 users (show)

See Also:


Attachments
patch from master for v4-25-test (7.69 KB, patch)
2026-09-24 05:24 UTC, Anoop C S
anoopcs: review? (slow)
npower: review+
Details
patch from master for v4-24-test (7.69 KB, patch)
2026-09-24 05:25 UTC, Anoop C S
anoopcs: review? (slow)
npower: review+
Details
patch from master for v4-23-test (7.69 KB, patch)
2026-09-24 05:26 UTC, Anoop C S
anoopcs: review? (slow)
npower: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anoop C S 2026-09-09 18:10:02 UTC
When "vfs mkdir use tmp name" is enabled, explicitly or through the default Auto behavior, mkdir_internal() prefixes the requested directory name with ".::TMPNAME:D:$SERVERID:". A client supplied basename can be valid and within the filesystem’s NAME_MAX, while the Samba generated temporary basename exceeds it. SMB_VFS_MKDIRAT() then returns ENAMETOOLONG, which is reported to the client as NT_STATUS_OBJECT_NAME_INVALID.

This is generic and does not appear specific to a particular VFS module or file system. It should be reproducible on any filesystem with a 255-byte component limit by creating a sufficiently long directory name while temporary mkdir names are enabled.
Comment 1 Samba QA Contact 2026-09-13 06:09:03 UTC
This bug was referenced in samba master:

523327cce7cf8a977b10c5d57a3477aa2ebac3b8
b8826db2da7dadf1a56310f523e4cef4374cf98b
86c7c3ed32b4d38cd3aa75b3c5bb065380c0319f
Comment 2 Anoop C S 2026-09-24 05:24:52 UTC
Created attachment 19239 [details]
patch from master for v4-25-test
Comment 3 Anoop C S 2026-09-24 05:25:35 UTC
Created attachment 19240 [details]
patch from master for v4-24-test
Comment 4 Anoop C S 2026-09-24 05:26:01 UTC
Created attachment 19241 [details]
patch from master for v4-23-test
Comment 5 Noel Power 2026-09-24 15:01:01 UTC
patches for 4.23-4.25 apply, build and pass the added test, lgtm, assigning to samba-release for inclusion
Comment 6 Samba QA Contact 2026-09-24 21:28:11 UTC
This bug was referenced in samba v4-25-test:

046314d027b5342c82f9a8390cdde0bf792d79d2
f5038cd47559f41c975fd7337d09b1db0270c404
e88dc0b79735e7e7f1c12cddebfa7ba91c081305
Comment 7 Samba QA Contact 2026-09-24 21:59:25 UTC
This bug was referenced in samba v4-25-stable (Release samba-4.25.0):

046314d027b5342c82f9a8390cdde0bf792d79d2
f5038cd47559f41c975fd7337d09b1db0270c404
e88dc0b79735e7e7f1c12cddebfa7ba91c081305
Comment 8 Samba QA Contact 2026-10-01 19:30:05 UTC
This bug was referenced in samba v4-23-test:

2a09aad102746572c12a4f8fbe3ce1aefa7abfe2
33b68fdedc5fc94fa3d660ac2a2b7308ab8eb3f0
160b9ecec8f6a7200d3a496eebee81d7d27e9cf4
Comment 9 Samba QA Contact 2026-10-01 19:47:39 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.13):

2a09aad102746572c12a4f8fbe3ce1aefa7abfe2
33b68fdedc5fc94fa3d660ac2a2b7308ab8eb3f0
160b9ecec8f6a7200d3a496eebee81d7d27e9cf4
Comment 10 Samba QA Contact 2026-10-02 00:38:28 UTC
This bug was referenced in samba v4-24-test:

f203c93231a32e79fde296d2f0769bbcca3ea707
e4e1f2ddac8bb31f7ab0b7a47a2ac39446908b2c
5c529e6efd25e94128695bf29aadecf5e317575d