Initializing case based parameters during share switch in create_conn_struct_tos_cwd()

Shilpa K shilpa.krishnareddy at gmail.com
Fri Jan 8 09:57:20 UTC 2021


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;


More information about the samba-technical mailing list