cli->bufsize usage

Jeremy Allison jra at
Thu Feb 15 14:45:26 GMT 2007

On Wed, Feb 14, 2007 at 08:19:49AM -0800, Herb Lewis wrote:
> In cli_initialise cli->bufsize is set to CLI_BUFFER_SIZE+4
> (CLI_BUFFER_SIZE is defined as 0xffff) then cli->outbuf and
> cli->inbuf are malloced for cli->bufsize+SAFETY_MARGIN
> (SAFETY_MARGIN is defined as 1024). cli->max_xmit is set to
> cli->bufsize (CLI_BUFFER_SIZE+4).
> In cli_negprot cli->bufsize could be reset to
> CLI_SAMBA_MAX_LARGE_READX_SIZE (defined as 127*1024) and the
> cli->inbuf and cli->outbuf malloced for that + SAFETY_MARGIN
> (after correctly freeing the previous value) but then
> cli->max_xmit = MIN(cli->max_xmit, CLI_BUFFER_SIZE)
> (using CLI_BUFFER_SIZE instead of the possibly larger
> value in cli->bufsize) This seems incorrect to me unless
> I am missing something here.

> cli_api seems to always be called with the maxlen (mdrcnt)
> parameter using CLI_BUFFER_SIZE not the value in cli->bufsize.
> Isn't this also incorrect?

No, I don't think so - the large READX/WRITEX code path
is a special case. You still need to tell the server
that your max size is <= 64k - the large READX/WRITEX
path just ignores this but everything else has to


More information about the samba-technical mailing list