From dc90cd89a7fef3b0a744ef1873193cf2c9d75cad Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 19 Apr 2007 20:50:49 +0000 Subject: r22389: Start preparing for multiple encryption contexts in the server. Allow server to reflect back to calling client the encryption context that was sent. Jeremy. (This used to be commit b49e90335d1e589916b5ab4992e3c4a2d221ca7e) --- source3/smbd/aio.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/smbd/aio.c') diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index a85cf901ae..6b403e1e36 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -49,8 +49,10 @@ static struct aio_extra *aio_list_head; of the aio_read call. *****************************************************************************/ -static struct aio_extra *create_aio_ex_read(files_struct *fsp, size_t buflen, - uint16 mid) +static struct aio_extra *create_aio_ex_read(files_struct *fsp, + size_t buflen, + uint16 mid, + const char *inbuf) { struct aio_extra *aio_ex = SMB_MALLOC_P(struct aio_extra); @@ -66,6 +68,14 @@ static struct aio_extra *create_aio_ex_read(files_struct *fsp, size_t buflen, SAFE_FREE(aio_ex); return NULL; } + /* Save the first 8 bytes of inbuf for possible enc data. */ + aio_ex->inbuf = SMB_MALLOC_ARRAY(char, 8); + if (!aio_ex->inbuf) { + SAFE_FREE(aio_ex->outbuf); + SAFE_FREE(aio_ex); + return NULL; + } + memcpy(aio_ex->inbuf, inbuf, 8); DLIST_ADD(aio_list_head, aio_ex); aio_ex->fsp = fsp; aio_ex->read_req = True; @@ -408,7 +418,7 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) aio_ex->acb.aio_nbytes, (int)nread ) ); } - smb_setlen(outbuf,outsize - 4); + smb_setlen(outbuf,outsize - 4,aio_ex->inbuf); show_msg(outbuf); if (!send_smb(smbd_server_fd(),outbuf)) { exit_server_cleanly("handle_aio_read_complete: send_smb " -- cgit