From cf1eb265891d552fd541d20e5f5a091d37e7352c Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sun, 27 Sep 2020 08:52:58 +0200 Subject: [PATCH 1/3] build: remove smbd_conn private library This is not needed anymore since 6822baa2920f30374ec84363497d97e24f359fab. Needed here for: BUG: https://bugzilla.samba.org/show_bug.cgi?id=14612 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 80ac7fa7c4c728bef4f947872c090fec35fb26f0) --- source3/wscript_build | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/source3/wscript_build b/source3/wscript_build index 5a07eddac44..d86a9fcadbf 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -587,11 +587,6 @@ bld.SAMBA3_LIBRARY('smbconf', pc_files=[], vnum='0') -bld.SAMBA3_LIBRARY('smbd_conn', - source='smbd/conn.c', - deps='samba3-util samba-util FNAME_UTIL', - private_library=True) - bld.SAMBA3_SUBSYSTEM('sysquotas', source=''' lib/sysquotas.c @@ -706,6 +701,7 @@ bld.SAMBA3_LIBRARY('smbd_base', smbd/notify_msg.c smbd/build_options.c smbd/smb1_utils.c + smbd/conn.c ''' + NOTIFY_SOURCES, deps=''' talloc @@ -718,7 +714,6 @@ bld.SAMBA3_LIBRARY('smbd_base', vfs_posixacl inotify samba3core - smbd_conn param_service AVAHI PRINTBASE -- 2.27.0 From 50654139f28e605def8b6003c2b10ab9d337752c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Jan 2021 11:39:51 -0800 Subject: [PATCH 2/3] s3: smbd: Factor out setting up case parameters for a share to a function - conn_setup_case_options(). 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 Reviewed-by: Anoop C S (cherry picked from commit ab7700177c2badbf8ed649985be8029223b6e946) --- source3/smbd/conn.c | 19 +++++++++++++++++++ source3/smbd/proto.h | 1 + source3/smbd/service.c | 11 +---------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 547f55db7d8..62cf1237766 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -232,3 +232,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); +} diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index fea3abfee7d..ae5f82c2de5 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -156,6 +156,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, diff --git a/source3/smbd/service.c b/source3/smbd/service.c index ed38121f292..3802d16179b 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -556,16 +556,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) { -- 2.27.0 From 31bac49613a208d2b5cdcbc30afa48eff6587020 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Jan 2021 11:44:44 -0800 Subject: [PATCH 3/3] s3: smbd: Add call to conn_setup_case_options() to create_conn_struct_as_root(). Ensures temporary DFS share doesn't leave the case parameters set as zero (i.e.: conn->case sensitive = 0 conn->share_case_preserve = 0 and default case is lower which can cause problems doing a DFS_GET_REFERRALS request). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14612 Signed-off-by: Jeremy Allison Reviewed-by: Anoop C S Autobuild-User(master): Anoop C S Autobuild-Date(master): Wed Jan 13 18:14:31 UTC 2021 on sn-devel-184 (cherry picked from commit 39ce73321093a0a5e25f574d0d32d7f88892de46) --- source3/smbd/msdfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 2c31e2b960a..9e1127c339c 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -318,6 +318,8 @@ static NTSTATUS create_conn_struct_as_root(TALLOC_CTX *ctx, vfs_user = get_current_username(); } + conn_setup_case_options(conn); + set_conn_connectpath(conn, connpath); /* -- 2.27.0