More recvfile optimizations

Stefan (metze) Metzmacher metze at
Thu Apr 10 15:58:09 MDT 2014

Am 10.04.2014 23:24, schrieb Jeremy Allison:
> On Thu, Apr 10, 2014 at 11:05:14PM +0200, Stefan (metze) Metzmacher wrote:
>> I don't have a fix.
>> But we would need such check in is_smb2_recvfile_write(), correct?
> Well, there are two ways of doing it.
> First one is to add the :
> smbd_smb2_request_check_session()
> smbd_smb2_request_check_tcon()
> calls into is_smb2_recvfile_write(), which is
> the same way the SMB1 code does it.

I'd just do a smb2srv_open_lookup() to get fsp
(similar to file_fsp_get()), and use fsp->conn.

In future I'd let is_valid_writeX_buffer()
use smb1srv_open_lookup() instead of smb1srv_tcon_lookup().

Then we can add a bool support_recvfile to fsp.
We should not add this for directories or fake files.
SMB_VFS_OPEN should decide if recvfile is supported.

And maybe also add bool support_sendfile.

This way we would integrate something like this:

> Oh yeah, we also need to add:
>         if (state->hdr.nbt[0] != 0x00) {
>                 /* Not a standard NBT packet. Ignore. */
>                 return false;
>         }
> at the top of is_smb2_recvfile_write() to make
> sure we correctly ignore non-NBT packets (not
> that we should get many of those, but it's
> better to be correct...).


>> So we decided to drop support for compilers without support dynamic arrays?
> Yep. Some new Volker code already uses it :-).



More information about the samba-technical mailing list