Bug 14612 - Temporary DFS share setup doesn't set case parameters in the same way as a regular share definition does.
Summary: Temporary DFS share setup doesn't set case parameters in the same way as a re...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.13.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-12 19:16 UTC by Jeremy Allison
Modified: 2021-01-20 11:33 UTC (History)
2 users (show)

See Also:


Attachments
git-am fix for master. (3.72 KB, patch)
2021-01-12 19:56 UTC, Jeremy Allison
no flags Details
git-am fix for 4.13.next. (5.82 KB, patch)
2021-01-13 20:26 UTC, Jeremy Allison
anoopcs: review+
slow: review+
Details
git-am fix for 4.12.next. (5.81 KB, patch)
2021-01-13 20:27 UTC, Jeremy Allison
anoopcs: review+
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2021-01-12 19:16:09 UTC
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;
Comment 1 Jeremy Allison 2021-01-12 19:56:36 UTC
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.
Comment 3 Samba QA Contact 2021-01-13 18:15:03 UTC
This bug was referenced in samba master:

ab7700177c2badbf8ed649985be8029223b6e946
39ce73321093a0a5e25f574d0d32d7f88892de46
Comment 4 Jeremy Allison 2021-01-13 20:26:18 UTC
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).
Comment 5 Jeremy Allison 2021-01-13 20:27:29 UTC
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 6 Jeremy Allison 2021-01-19 22:18:38 UTC
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
Comment 7 Ralph Böhme 2021-01-20 08:38:57 UTC
Reassigning to Karolin for inclusion in 4.12 and 4.13.
Comment 8 Karolin Seeger 2021-01-20 09:26:51 UTC
(In reply to Ralph Böhme from comment #7)
Pushed to autobuild-v4-{13,12}-test.
Comment 9 Samba QA Contact 2021-01-20 10:28:12 UTC
This bug was referenced in samba v4-13-test:

a6ec2580b4dc41bf78cab5bac282f4cd618adcf2
d13354f08f573251f32e532166b3e5808ebdc634
4e48d658f8d750c350ebbf33314323a9a9ee1ebc
Comment 10 Samba QA Contact 2021-01-20 11:30:03 UTC
This bug was referenced in samba v4-12-test:

7ec45672a30a428c3162275f5d47245a012ce81a
d89ccfc1c7d23b6e2a3bc80c1acd189000ca7cbd
50c2ea410b4acd5a311d3509c2554ae8e035dd1c
Comment 11 Karolin Seeger 2021-01-20 11:33:12 UTC
Closing out bug report.

Thanks!