[PATCH] vfs_fruit case sensitivity bug

Jeremy Allison jra at samba.org
Fri Apr 21 18:06:19 UTC 2017


On Fri, Apr 21, 2017 at 12:52:57PM +0200, Ralph Böhme via samba-technical wrote:
> Hi!
> 
> Attached is the patch for bug 12749:
> 
> The commit message should explain what it's about. :)
> 
> Please review & push if happy. Thanks!

LGTM. Pushed !

> From 1e22ab36a512eb9ed198d4a2b552846275320ff6 Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> Date: Wed, 19 Apr 2017 13:12:55 +0200
> Subject: [PATCH] vfs_fruit: lp_case_sensitive() does not return a bool
> 
> 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 at samba.org>
> ---
>  source3/modules/vfs_fruit.c | 20 +++++++++++++++++---
>  source4/torture/vfs/fruit.c |  4 ++--
>  2 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
> index b747145..bcc4a12 100644
> --- a/source3/modules/vfs_fruit.c
> +++ b/source3/modules/vfs_fruit.c
> @@ -2201,9 +2201,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;
> diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
> index 5182c00..bb8f36e 100644
> --- a/source4/torture/vfs/fruit.c
> +++ b/source4/torture/vfs/fruit.c
> @@ -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);
>  	}
> -- 
> 2.9.3
> 




More information about the samba-technical mailing list