Padding byte in cifs readx response

Christof Schmitt cs at
Fri Aug 8 17:25:11 MDT 2014

On Fri, Aug 08, 2014 at 12:56:51PM -0700, Jeremy Allison wrote:
> On Thu, Aug 07, 2014 at 04:16:45PM -0700, Christof Schmitt wrote:
> > 
> > Thanks. Attached is an updated patch series. I think the only remaining
> > issue is that 'make test' now fails against the source4 DC, the source3
> > file server should be good.
> One more comment. struct smb_request contains the 'cmd'
> field, which means that reply_outbuf() *knows* when it's
> creating an outbuf for a readX reply.
> Can't you just always add the pad byte inside:
> void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
> {
>         char *outbuf;
>         if (!create_outbuf(req, req, (const char *)req->inbuf, &outbuf, num_words,
>                            num_bytes)) {
>                 smb_panic("could not allocate output buffer\n");
>         }
>         req->outbuf = (uint8_t *)outbuf;
> }
> by adding 1 to num_bytes when cmd==readX and then
> using srv_set_message() or some version of the code
> inside there to fix up the outbuf at creation time.

Yes, that sounds like a good approach. I will use that in the next
update, it should also make the patch smaller.

> The talloc_realloc() in your patch really worries me.


More information about the samba-technical mailing list