s3: smbd: Factor out setting up case parameters for a share to a function - conn_setu...
authorJeremy Allison <jra@samba.org>
Tue, 12 Jan 2021 19:39:51 +0000 (11:39 -0800)
committerKarolin Seeger <kseeger@samba.org>
Wed, 20 Jan 2021 10:27:16 +0000 (10:27 +0000)
Will allow it to be reused in the msdfs temporary share code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14612

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit ab7700177c2badbf8ed649985be8029223b6e946)

source3/smbd/conn.c
source3/smbd/proto.h
source3/smbd/service.c

index 6d9ea419f8df2a58ba9da0444499d2a56d19ad79..6a94d344f12631485f67ee54e3d913f363d93c80 100644 (file)
@@ -228,3 +228,22 @@ void conn_free(connection_struct *conn)
 
        conn_free_internal(conn);
 }
+
+/*
+ * Correctly initialize a share with case options.
+ */
+void conn_setup_case_options(connection_struct *conn)
+{
+       int snum = conn->params->service;
+
+       if (lp_case_sensitive(snum) == Auto) {
+               /* We will be setting this per packet. Set to be case
+               * insensitive for now. */
+               conn->case_sensitive = false;
+       } else {
+               conn->case_sensitive = (bool)lp_case_sensitive(snum);
+       }
+
+       conn->case_preserve = lp_preserve_case(snum);
+       conn->short_case_preserve = lp_short_preserve_case(snum);
+}
index 2ea90405b477a607a0277f09d3afce447b6a047f..206406a9fe9c051dab4a81a1abe97eb272b75798 100644 (file)
@@ -154,6 +154,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn);
 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint64_t vuid);
 void conn_free(connection_struct *conn);
+void conn_setup_case_options(connection_struct *conn);
 void conn_force_tdis(
        struct smbd_server_connection *sconn,
        bool (*check_fn)(struct connection_struct *conn,
index 03125a30dad56acb2b23838936ebcbe1aab638ac..bf5e474ddfff7ba07bc7ad492e6f5481c21407d0 100644 (file)
@@ -569,16 +569,7 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
                      ( lp_enable_asu_support() && strequal(dev,"ADMIN$")) );
 
        /* Case options for the share. */
-       if (lp_case_sensitive(snum) == Auto) {
-               /* We will be setting this per packet. Set to be case
-                * insensitive for now. */
-               conn->case_sensitive = False;
-       } else {
-               conn->case_sensitive = (bool)lp_case_sensitive(snum);
-       }
-
-       conn->case_preserve = lp_preserve_case(snum);
-       conn->short_case_preserve = lp_short_preserve_case(snum);
+       conn_setup_case_options(conn);
 
        conn->encrypt_level = lp_smb_encrypt(snum);
        if (conn->encrypt_level > SMB_SIGNING_OFF) {