>From d4cec58c3043273896af477eb22bfbba37b9b030 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Jun 2018 14:49:17 -0700 Subject: [PATCH] s3: smbd: Correctly return the used values for FILE_CASE_SENSITIVE_SEARCH and FILE_CASE_PRESERVED_NAMES on this share. conn->fs_capabilities always lies about the underlying case sensitive/case preserving properties as there is no way for statvfs to retrieve this or glibc to return it (all current fs_capabilities calls arbitrarily add FILE_CASE_SENSITIVE_SEARCH| FILE_CASE_PRESERVED_NAMES regardless of how the underlying filesystem was mounted). Return the lp_case_XXX parameters instead as these are what we use actually use in the name lookup code. This will be very important in the future for SMB2 POSIX extensions where we may be exporting a ZFS or XFS filesystem mounted as "case-insensitive". Signed-off-by: Jeremy Allison --- source3/smbd/trans2.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index af7a0d72484..3d2e277a771 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3565,7 +3565,28 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_ex_dev, (u "share", "fake_fscaps", 0); - SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH| + /* + * conn->fs_capabilities always lies about the + * underlying case sensitive/case preserving properties + * as there is no way for statvfs to retrieve this + * or glibc to return it (all current fs_capabilities + * calls arbitrarily add FILE_CASE_SENSITIVE_SEARCH| + * FILE_CASE_PRESERVED_NAMES regardless of how the + * underlying filesystem was mounted). + * + * Return the lp_case_XXX parameters instead as these + * are what we use actually use in the name lookup code. + */ + additional_flags &= ~(FILE_CASE_SENSITIVE_SEARCH| + FILE_CASE_PRESERVED_NAMES); + if (lp_case_sensitive(SNUM(conn))) { + additional_flags |= FILE_CASE_SENSITIVE_SEARCH; + } + if (lp_preserve_case(SNUM(conn))) { + additional_flags |= FILE_CASE_PRESERVED_NAMES; + } + + SIVAL(pdata,0, FILE_SUPPORTS_OBJECT_IDS|FILE_UNICODE_ON_DISK| additional_flags); /* FS ATTRIBUTES */ -- 2.17.1