Padding byte in cifs readx response

Jeremy Allison jra at
Fri Aug 8 13:56:51 MDT 2014

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.

The talloc_realloc() in your patch really worries me.


More information about the samba-technical mailing list