[PATCH] Fix libsmb renaming over existing files

Jeremy Allison jra at samba.org
Mon Dec 12 18:56:39 UTC 2016


On Mon, Dec 12, 2016 at 05:04:22PM +0100, Volker Lendecke wrote:
> Hi!
> 
> Review appreciated!

LGTM. Pushed with bug report id attached:

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

as I think we need a back-port on this one.

A question. There are other places in that file
where we also use smb2cli_query_info() but
don't set raw_status after an error.

cli_smb2_qpathinfo_alt_name()
cli_smb2_qfileinfo_basic()
cli_smb2_qpathinfo_streams()
cli_smb2_dskattr()
cli_smb2_query_security_descriptor()
cli_smb2_get_ea_list_path()
cli_smb2_get_user_quota()
cli_smb2_list_user_quota_step()
cli_smb2_get_fs_quota_info()

Shall I prepare an additional patch that sets
raw_status appropriately there also ?

Cheers,

	Jeremy.

> From 135c746f96b3139c833a66c4b70e810d4fc6b400 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Mon, 12 Dec 2016 16:20:29 +0100
> Subject: [PATCH] libsmb: Correctly report error for rename failure
> 
> This prevents renaming a file over an existing one with SMB2
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  source3/libsmb/cli_smb2_fnum.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
> index 325ae78..5a96b05 100644
> --- a/source3/libsmb/cli_smb2_fnum.c
> +++ b/source3/libsmb/cli_smb2_fnum.c
> @@ -1829,6 +1829,10 @@ fail:
>  		cli_smb2_close_fnum(cli, fnum);
>  	}
>  
> +	if (!NT_STATUS_IS_OK(status)) {
> +		cli->raw_status = status;
> +	}
> +
>  	TALLOC_FREE(frame);
>  	return status;
>  }
> -- 
> 2.1.4
> 




More information about the samba-technical mailing list