[PATCH] libcli: Overwrite destination in cli_smb2_rename

Jeremy Allison jra at samba.org
Tue Aug 5 15:37:10 MDT 2014


On Tue, Aug 05, 2014 at 02:31:18PM -0700, Jeremy Allison wrote:
> On Tue, Aug 05, 2014 at 02:27:44PM -0700, Jeremy Allison wrote:
> > which is what we want for libsmbclient really :-(.
> > 
> > SMB1 has several methods of renaming, the NTTrans
> > rename overwrites the destination by default.
> 
> Ah, no - checked more carefully and no it
> doesn't :-(.
> 
> Inside smbd for NTTrans rename we call:
> 
>                         status = rename_internals(ctx, conn, req,
>                                                   smb_fname_old, smb_fname_new,
>                                                   attrs, False, src_has_wcard,
>                                                   dest_has_wcard,
>                                                   DELETE_ACCESS);
>                         break;
> 
> where the 'False' bool is the 'replace_if_exists'
> parameter. So we return NT_STATUS_OBJECT_NAME_COLLISION
> in this case.
> 
> Sorry for the mistake :-(. Yep, looks like we
> can't use this in SMB1.

However.... (email thinking in real-time here :-).
SMB1 trans2 SMB_FILE_RENAME_INFORMATION *does*
have a client supplied replace_if_exists flag,
the same as SMB2. So we could move to that
instead.

Jeremy.


More information about the samba-technical mailing list