cli->bufsize usage

Herb Lewis hlewis at
Wed Feb 14 16:19:49 GMT 2007

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?

I'm not that familiar with the client code so I wanted another
opinion here before making any changes.


More information about the samba-technical mailing list