From the samba-technical list. Date: Fri, 8 Jan 2021 15:27:20 +0530 From: Shilpa K via samba-technical <samba-technical@lists.samba.org> To: samba-technical <samba-technical@lists.samba.org> Subject: Initializing case based parameters during share switch in create_conn_struct_tos_cwd() Hello, We are creating DFS referrals when a folder is created under the share root. In one instance, an user was trying to create a folder with the name "FOLDER~1" (with exactly 8 chars in the folder name) from Windows. So, we created the DFS referral with the name ending "FOLDER~1" and returned the error STATUS_PATH_NOT_COVERED to the client. Then,the client had sent DFS_GET_REFERRALS request. While processing this request, when unix_convert() is called as part of returning the referral, it was normalizing the name to lowercase because the name is a mangled name and the below parameters were null: conn->case sensitive = 0 conn->share_case_preserve = 0 and default case is lower The case_sensitive and short_case_preserve were null because we were not initializing these values in conn struct to the share configuration that we were switching to. We are using below settings for the share: case sensitive = no preserve case = yes short preserve case = yes default case = lower I used the code changes that are in the below patch and now we return the folder name in the referral as is. Could you please review this patch and let me know if it is fine? Thanks, Shilpa diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 50014e1832..d39d7ee859 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -427,6 +427,17 @@ static NTSTATUS create_conn_struct_as_root(TALLOC_CTX *ctx, } conn->fs_capabilities = SMB_VFS_FS_CAPABILITIES(conn, &conn->ts_res); + + /* Case options for the share. */ + if (lp_case_sensitive(snum) == Auto) { + conn->case_sensitive = False; + } else { + conn->case_sensitive = lp_case_sensitive(snum) == 1; + } + + conn->case_preserve = lp_preserve_case(snum); + conn->short_case_preserve = lp_short_preserve_case(snum); + *pconn = conn; return NT_STATUS_OK;
Created attachment 16394 [details] git-am fix for master. Without this the new share is left with: conn->case sensitive = 0 conn->share_case_preserve = 0 and default case is lower which isn't correct.
https://gitlab.com/samba-team/samba/-/merge_requests/1756
This bug was referenced in samba master: ab7700177c2badbf8ed649985be8029223b6e946 39ce73321093a0a5e25f574d0d32d7f88892de46
Created attachment 16395 [details] git-am fix for 4.13.next. Back-port from master (cherry-pick of 3 patches, not 2 as we need the smb_conn build fix also).
Created attachment 16396 [details] git-am fix for 4.12.next. Back-port from master (cherry-pick of 3 patches, not 2 as we need the smb_conn build fix also).
Comment on attachment 16395 [details] git-am fix for 4.13.next. Submitter confirms this works. Date: Mon, 18 Jan 2021 15:55:15 +0530 From: Shilpa K via samba-technical <samba-technical@lists.samba.org> To: Jeremy Allison <jra@samba.org> Cc: samba-technical <samba-technical@lists.samba.org> Subject: Re: Initializing case based parameters during share switch in create_conn_struct_tos_cwd() Hi Jeremy, Thanks for the patch. I have verified that it fixes the problem. Regards, Shilpa
Reassigning to Karolin for inclusion in 4.12 and 4.13.
(In reply to Ralph Böhme from comment #7) Pushed to autobuild-v4-{13,12}-test.
This bug was referenced in samba v4-13-test: a6ec2580b4dc41bf78cab5bac282f4cd618adcf2 d13354f08f573251f32e532166b3e5808ebdc634 4e48d658f8d750c350ebbf33314323a9a9ee1ebc
This bug was referenced in samba v4-12-test: 7ec45672a30a428c3162275f5d47245a012ce81a d89ccfc1c7d23b6e2a3bc80c1acd189000ca7cbd 50c2ea410b4acd5a311d3509c2554ae8e035dd1c
Closing out bug report. Thanks!
This bug was referenced in samba v4-13-stable (Release samba-4.13.4): a6ec2580b4dc41bf78cab5bac282f4cd618adcf2 d13354f08f573251f32e532166b3e5808ebdc634 4e48d658f8d750c350ebbf33314323a9a9ee1ebc
This bug was referenced in samba v4-12-stable (Release samba-4.12.12): 7ec45672a30a428c3162275f5d47245a012ce81a d89ccfc1c7d23b6e2a3bc80c1acd189000ca7cbd 50c2ea410b4acd5a311d3509c2554ae8e035dd1c