From bb9f5ceeb37df2485f2a9d18fb441e64b168378c Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Sun, 3 Apr 2016 05:06:05 +0200 Subject: [PATCH 1/3] s3:smbd/service disable case-sensitivity for SMB2/3 connections in SMB2, there is no flag to let us know if the client wants to have case-sensitive behavior, so in Auto mode, disable case-sensitivity Bug: https://bugzilla.samba.org/show_bug.cgi?id=11438 Signed-off-by: Christian Ambach Reviewed-by: Jeremy Allison --- source3/smbd/service.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 2777a09..e4a910a 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -212,7 +212,9 @@ bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir) { /* We need this uglyness due to DOS/Win9x clients that lie about case insensitivity. */ enum remote_arch_types ra_type = get_remote_arch(); - if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) { + if (conn->sconn->using_smb2) { + conn->case_sensitive = false; + } else if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) { /* Client can't support per-packet case sensitive pathnames. */ conn->case_sensitive = False; } else { -- 2.8.0.rc3.226.g39d4020 From 32427768610cbe2e5dfe199ab7865b061ea57919 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Sun, 3 Apr 2016 05:16:45 +0200 Subject: [PATCH 2/3] s3:smbd/service apply some code formatting reduce indentation in switch statement, obey 80 char line limit, use C99 bool Signed-off-by: Christian Ambach Reviewed-by: Jeremy Allison --- source3/smbd/service.c | 52 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/source3/smbd/service.c b/source3/smbd/service.c index e4a910a..34cc369 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -181,6 +181,7 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath) bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir) { int snum; + enum remote_arch_types ra_type; if (!conn) { last_conn = NULL; @@ -206,30 +207,35 @@ bool set_current_service(connection_struct *conn, uint16_t flags, bool do_chdir) last_conn = conn; last_flags = flags; - /* Obey the client case sensitivity requests - only for clients that support it. */ + /* + * Obey the client case sensitivity requests - only for clients that + * support it. */ switch (lp_case_sensitive(snum)) { - case Auto: - { - /* We need this uglyness due to DOS/Win9x clients that lie about case insensitivity. */ - enum remote_arch_types ra_type = get_remote_arch(); - if (conn->sconn->using_smb2) { - conn->case_sensitive = false; - } else if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) { - /* Client can't support per-packet case sensitive pathnames. */ - conn->case_sensitive = False; - } else { - conn->case_sensitive = !(flags & FLAG_CASELESS_PATHNAMES); - } - } - break; - case True: - conn->case_sensitive = True; - break; - default: - conn->case_sensitive = False; - break; - } - return(True); + case Auto: + /* + * We need this uglyness due to DOS/Win9x clients that lie + * about case insensitivity. */ + ra_type = get_remote_arch(); + if (conn->sconn->using_smb2) { + conn->case_sensitive = false; + } else if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) { + /* + * Client can't support per-packet case sensitive + * pathnames. */ + conn->case_sensitive = false; + } else { + conn->case_sensitive = + !(flags & FLAG_CASELESS_PATHNAMES); + } + break; + case True: + conn->case_sensitive = true; + break; + default: + conn->case_sensitive = false; + break; + } + return true; } /**************************************************************************** -- 2.8.0.rc3.226.g39d4020 From a9ccd50b63421187c18bfb04001d225d212cdc2a Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Tue, 5 Apr 2016 02:58:48 +0200 Subject: [PATCH 3/3] s3:smbd/filename remove smelly code not sure how this chunk ended up there, but I agree with the statement in the comment that behavior should not depend on developer mode make test does not seem to depend on it anymore. This piece had some bad influence on the tests I wrote for case insensitivite behavior of SMB2/3, so let us remove this technical debt. Signed-off-by: Christian Ambach Reviewed-by: Jeremy Allison --- source3/smbd/filename.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 89c8bd6..7062060 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -942,34 +942,6 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, TALLOC_FREE(found_name); } /* end else */ -#ifdef DEVELOPER - /* - * This sucks! - * We should never provide different behaviors - * depending on DEVELOPER!!! - */ - if (VALID_STAT(smb_fname->st)) { - bool delete_pending; - uint32_t name_hash; - - status = file_name_hash(conn, - smb_fname_str_dbg(smb_fname), - &name_hash); - if (!NT_STATUS_IS_OK(status)) { - goto fail; - } - - get_file_infos(vfs_file_id_from_sbuf(conn, - &smb_fname->st), - name_hash, - &delete_pending, NULL); - if (delete_pending) { - status = NT_STATUS_DELETE_PENDING; - goto fail; - } - } -#endif - /* * Add to the dirpath that we have resolved so far. */ -- 2.8.0.rc3.226.g39d4020