[PATCH] Fix libsmb renaming over existing files

Stefan Metzmacher metze at samba.org
Mon Dec 12 20:11:09 UTC 2016


Am 12.12.2016 um 19:56 schrieb Jeremy Allison:
> 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 ?

The goal would be to remove cli->raw_status in future.

Until then I think it's better to catch this generically
in the caller.

E.g. in cli_rename() and a lot of others we have the following
pattern at the beginning:

        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
                return cli_smb2_rename(cli,
                                        fname_src,
                                        fname_dst);
        }

I think we should change this to:

        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
                cli->raw_status = cli_smb2_rename(cli,
                                        fname_src,
                                        fname_dst);
		return cli->raw_status;
        }


Otherwise we'll miss a lot of places within the cli_smb2_* functions
where we miss to set cli->raw_status.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161212/785be4e3/signature.sig>


More information about the samba-technical mailing list