Bug 15410 - renaming files via explorer broken if msdfs root = yes set
Summary: renaming files via explorer broken if msdfs root = yes set
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.18.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-30 13:41 UTC by Björn Jacke
Modified: 2023-11-03 16:59 UTC (History)
3 users (show)

See Also:


Attachments
log (920.39 KB, text/plain)
2023-06-30 13:41 UTC, Björn Jacke
no flags Details
network capture (23.48 KB, application/vnd.tcpdump.pcap)
2023-06-30 13:42 UTC, Björn Jacke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Jacke 2023-06-30 13:41:51 UTC
Created attachment 17966 [details]
log

If

 host msdfs = yes
 msdfs root = yes

is enabled renaming files via explorer is broken with 4.18. See attached log and network capture.
Comment 1 Björn Jacke 2023-06-30 13:42:25 UTC
Created attachment 17967 [details]
network capture
Comment 2 Jeremy Allison 2023-06-30 16:09:00 UTC
What version of Windows ? The DFS names are not starting with '\' from this client.
Comment 3 Jeremy Allison 2023-06-30 16:23:03 UTC
Just checked the server code, we cope with that. Still looking..
Comment 4 Björn Jacke 2023-06-30 16:59:30 UTC
(In reply to Jeremy Allison from comment #2)
the client is an up-to-date Windows 10 machine
Comment 5 Ralph Böhme 2023-06-30 20:01:05 UTC
Is it the case that DFS path normilation should only be called for SMB2-CREATE requests, but not for others? In the case here, the request is SMB2-SETINFO with RENAME info level. The path is a local relative path, not a DFS path, but the SMB2 packet has the DFS flag set. So when we process the path in our rename code, we trigger DFS path processing which ends up with a local path of ".".
Comment 6 Jeremy Allison 2023-06-30 20:25:51 UTC
(In reply to Ralph Böhme from comment #5)

I think that's the case. But I thought I had tests for that.
Comment 7 Jeremy Allison 2023-06-30 20:28:36 UTC
Yes, I do test this. Check out:

source3/torture/test_smb2.c

        /*
         * Now show that renames use relative,
         * not full DFS paths.
         */

        /* Full DFS path should fail. */
        status = smb2_dfs_rename(cli,
                                 fid_persistent,
                                 fid_volatile,
                                 "ANY\\NAME\\renamed_file");
        if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND)) {
                printf("%s:%d Rename of %s -> %s should fail "
                        "with NT_STATUS_OBJECT_PATH_NOT_FOUND. Got %s\n",
                        __FILE__,
                        __LINE__,
                        "BAD\\BAD\\file",
                        "ANY\\NAME\\renamed_file",
                        nt_errstr(status));
                goto err;
        }
        /* Relative DFS path should succeed. */
        status = smb2_dfs_rename(cli,
                                 fid_persistent,
                                 fid_volatile,
                                 "renamed_file");
        if (!NT_STATUS_IS_OK(status)) {
                printf("%s:%d: Rename of %s -> %s should succeed. "
                        "Got %s\n",
                        __FILE__,
                        __LINE__,
                        "BAD\\BAD\\file",
                        "renamed_file",
                        nt_errstr(status));
                goto err;
        }
Comment 8 Jeremy Allison 2023-06-30 20:29:50 UTC
The tests must not be comprehensive enough. I don't have time to look at this today, maybe next week. If you want to take over I won't object.
Comment 9 Ralph Böhme 2023-11-03 15:45:03 UTC
Fixed by 2c40e28908e9fab8dce7e50d3357b513d9af78c4 in 4.19.