]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_fruit: lp_case_sensitive() does not return a bool
authorRalph Boehme <slow@samba.org>
Wed, 19 Apr 2017 11:12:55 +0000 (13:12 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 28 Apr 2017 11:17:18 +0000 (13:17 +0200)
lp_case_sensitive() returns an int, not a bool, so with the default
setting of "Auto" by default we set the AAPL flag
SMB2_CRTCTX_AAPL_CASE_SENSITIVE.

This caused the client to believe the volume is case sensitive where it
wasn't, leading to an error when trying to rename files changing only
the case of the name.

Also fix the existing torture test that verifies AAPL context
negotiation and actually expected the server to return "case sensitive",
while the Samba default is really "case insensitive".

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12749

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 36612723b2b18675116b6197183bdfe5e1d9e06f)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-5-test): Fri Apr 28 13:17:19 CEST 2017 on sn-devel-144

source3/modules/vfs_fruit.c
source4/torture/vfs/fruit.c

index 4437d452d2e70aad0d7295b35a46901facce073e..a03f45436fd6877614f93a7a96fc66f1010e8922 100644 (file)
@@ -2186,9 +2186,23 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
        }
 
        if (req_bitmap & SMB2_CRTCTX_AAPL_VOLUME_CAPS) {
-               SBVAL(p, 0,
-                     lp_case_sensitive(SNUM(handle->conn->tcon->compat)) ?
-                     SMB2_CRTCTX_AAPL_CASE_SENSITIVE : 0);
+               int val = lp_case_sensitive(SNUM(handle->conn->tcon->compat));
+               uint64_t caps = 0;
+
+               switch (val) {
+               case Auto:
+                       break;
+
+               case True:
+                       caps |= SMB2_CRTCTX_AAPL_CASE_SENSITIVE;
+                       break;
+
+               default:
+                       break;
+               }
+
+               SBVAL(p, 0, caps);
+
                ok = data_blob_append(req, &blob, p, 8);
                if (!ok) {
                        return NT_STATUS_UNSUCCESSFUL;
index eed3266783864ed819772b0e5cc51dd94e6d6ef5..6c3fee97cc251d45f78e5afa33b86d9229d7b259 100644 (file)
@@ -2068,9 +2068,9 @@ static bool test_aapl(struct torture_context *tctx,
        }
 
        aapl_vol_caps = BVAL(aapl->data.data, 24);
-       if (aapl_vol_caps != SMB2_CRTCTX_AAPL_CASE_SENSITIVE) {
+       if (aapl_vol_caps != 0) {
                /* this will fail on a case insensitive fs ... */
-               torture_warning(tctx,
+               torture_result(tctx, TORTURE_FAIL,
                                "(%s) unexpected vol_caps: %d",
                                __location__, (int)aapl_vol_caps);
        }