[PATCH] libcli: Overwrite destination in cli_smb2_rename

Stefan (metze) Metzmacher metze at samba.org
Tue Aug 5 15:12:53 MDT 2014


Am 05.08.2014 um 20:47 schrieb Jeremy Allison:
> On Tue, Aug 05, 2014 at 06:42:16PM +0100, Ross Lagerwall wrote:
>> Overwrite the destination in cli_smb2_rename by setting the
>> ReplaceIfExists byte to TRUE.
>>
>> Signed-off-by: Ross Lagerwall <rosslagerwall at gmail.com>
>> ---
>>  source3/libsmb/cli_smb2_fnum.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
>> index 3a04ea1..1c08f7f 100644
>> --- a/source3/libsmb/cli_smb2_fnum.c
>> +++ b/source3/libsmb/cli_smb2_fnum.c
>> @@ -1910,6 +1910,7 @@ NTSTATUS cli_smb2_rename(struct cli_state *cli,
>>  		goto fail;
>>  	}
>>  
>> +	SCVAL(inbuf.data, 0, 0xFF);
>>  	SIVAL(inbuf.data, 16, converted_size_bytes);
>>  	memcpy(inbuf.data + 20, converted_str, converted_size_bytes);
>>  
>> -- 
>> 2.0.3
> 
> I'd prefer SCVAL(inbuf.data, 0, 0x1), but other
> than that LGTM. Reviewed-by: Jeremy Allison <jra at samba.org>
> 
> Can I get a second Team reviewer ?

I'm not sure this is correct.

[MS-CIFS] 3.3.5.10 Receiving an SMB_COM_RENAME Request
http://msdn.microsoft.com/en-us/library/ee441650.aspx

says If there is an existing file with the new name, the rename MUST
fail with STATUS_OBJECT_NAME_COLLISION.

I think cli_rename() should be consistent between SMB1 and SMB2.

metze

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


More information about the samba-technical mailing list