patch: multi-part nttrans replies

Sam Liddicott sam at liddicott.com
Tue Jul 1 12:13:25 GMT 2008


I've re-worked yesterdays patch, I think this more a smoother piece of work.


http://repo.or.cz/w/Samba/vfs_proxy.git?a=commit;h=f2b823ba59637dcfca77442f257a0215aefd1086

It preserves the old request_more model for better encapsulation and
uses the same function to check completeness as to unpack into smb_nttrans

I'm not sure if DLIST_FIND from my dlinklist.h was put into mainline:
http://repo.or.cz/w/Samba/vfs_proxy.git?a=blob;f=source/lib/util/dlinklist.h;hb=v4-0-vfs-proxy

This patch allows smb_raw_nttrans_recv to handle multi-part responses
even when used asynchronously from a callback.

smbcli_request has:
 1. a new member async_cli_helper which can contain an smbclient
    library specific helper callback, and some private data.
 2. a new in_parts member, which is a list of the smb_request_buffer's
    of responses to a request

smbcli_transport_finish_recv() will append receive buffers to
req->in_parts, if there is a helper callback, and then consult the
helper callback to decide if all response parts have arrived (or
if enough parts have arrived in the case of an error).

smbcli_request_receive_more() has been modified to read the
extra response parts from req->in_parts where these exist
in order to preserve the semantics for *_recv handlers.

smb_raw_nttrans_recv and smb_raw_nttrans_recv_helper are now merely
thin wrappers for smb_raw_nttrans_recv_parts which has been refactored
from smb_raw_nttrans_recv, and uses the same logic to either merely check
or actually process the reponse parts into the smb_nttrans struct.

This means that in order to support multi-part responses only a small
change is required to the *_recv function, and that at the option of
the author it could either store state so it can process just the new
response part, or process all the parts in order each time.

Once all parts are gathered, the state may need to be reset so that
the parts can be properly processed.
<http://repo.or.cz/w/Samba/vfs_proxy.git?a=blob;f=source/lib/util/dlinklist.h;h=d079a4b9c0a19a1c3f02b61d255c6d3ffa546688;hb=v4-0-vfs-proxy>




More information about the samba-technical mailing list