diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-08-05 08:04:11 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:29:18 -0500 |
commit | 133ef281c08b3c0f35b57d935e343674d69b39b3 (patch) | |
tree | 042f579defd3fd5a4a4f0cd844cf2df90d910b66 /source3 | |
parent | 5d2031915e9fa56cb1ccdc55a489bd62225ce739 (diff) | |
download | samba-133ef281c08b3c0f35b57d935e343674d69b39b3.tar.gz samba-133ef281c08b3c0f35b57d935e343674d69b39b3.tar.bz2 samba-133ef281c08b3c0f35b57d935e343674d69b39b3.zip |
r24229: Push allocating InBuffer/OutBuffer into reply_transs
(This used to be commit 39a7809aa4c34bb26178589245c419df44796e22)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/ipc.c | 50 | ||||
-rw-r--r-- | source3/smbd/process.c | 2 |
2 files changed, 33 insertions, 19 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 2e6b03fb94..8ded5754fb 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -495,11 +495,7 @@ static NTSTATUS handle_trans(connection_struct *conn, Reply to a SMBtrans. ****************************************************************************/ -int reply_trans(connection_struct *conn, - char *inbuf, - char *outbuf, - int size, - int bufsize) +void reply_trans(connection_struct *conn, struct smb_request *req) { int outsize = 0; unsigned int dsoff; @@ -508,12 +504,21 @@ int reply_trans(connection_struct *conn, unsigned int pscnt; struct trans_state *state; NTSTATUS result; + char *inbuf, *outbuf; + int size, bufsize; START_PROFILE(SMBtrans); + if (!(reply_prep_legacy(req, &inbuf, &outbuf, &size, &bufsize))) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + END_PROFILE(SMBtrans); + return; + } + if (SVAL(inbuf, smb_wct) < 10) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); END_PROFILE(SMBtrans); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + return; } dsoff = SVAL(inbuf, smb_dsoff); @@ -525,14 +530,16 @@ int reply_trans(connection_struct *conn, if (!NT_STATUS_IS_OK(result)) { DEBUG(2, ("Got invalid trans request: %s\n", nt_errstr(result))); + reply_nterror(req, result); END_PROFILE(SMBtrans); - return ERROR_NT(result); + return; } if ((state = TALLOC_P(conn->mem_ctx, struct trans_state)) == NULL) { DEBUG(0, ("talloc failed\n")); + reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBtrans); - return ERROR_NT(NT_STATUS_NO_MEMORY); + return; } state->cmd = SMBtrans; @@ -566,8 +573,9 @@ int reply_trans(connection_struct *conn, DEBUG(0,("reply_trans: data malloc fail for %u " "bytes !\n", (unsigned int)state->total_data)); TALLOC_FREE(state); + reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBtrans); - return(ERROR_DOS(ERRDOS,ERRnomem)); + return; } /* null-terminate the slack space */ memset(&state->data[state->total_data], 0, 100); @@ -589,8 +597,9 @@ int reply_trans(connection_struct *conn, "bytes !\n", (unsigned int)state->total_param)); SAFE_FREE(state->data); TALLOC_FREE(state); + reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBtrans); - return(ERROR_DOS(ERRDOS,ERRnomem)); + return; } /* null-terminate the slack space */ memset(&state->param[state->total_param], 0, 100); @@ -616,8 +625,9 @@ int reply_trans(connection_struct *conn, SAFE_FREE(state->data); SAFE_FREE(state->param); TALLOC_FREE(state); + reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBtrans); - return(ERROR_DOS(ERRDOS,ERRnomem)); + return; } if (inbuf+smb_vwv14+(state->setup_count*SIZEOFWORD) > inbuf + size) @@ -643,27 +653,30 @@ int reply_trans(connection_struct *conn, TALLOC_FREE(state); if (!NT_STATUS_IS_OK(result)) { + reply_nterror(req, result); END_PROFILE(SMBtrans); - return ERROR_NT(result); + return; } if (outsize == 0) { + reply_nterror(req, NT_STATUS_INTERNAL_ERROR); END_PROFILE(SMBtrans); - return ERROR_NT(NT_STATUS_INTERNAL_ERROR); + return; } END_PROFILE(SMBtrans); - return outsize; + reply_post_legacy(req, outsize); + return; } DLIST_ADD(conn->pending_trans, state); /* We need to send an interim response then receive the rest of the parameter/data bytes */ - outsize = set_message(inbuf,outbuf,0,0,True); - show_msg(outbuf); + reply_outbuf(req, 0, 0); + show_msg((char *)req->outbuf); END_PROFILE(SMBtrans); - return outsize; + return; bad_param: @@ -672,7 +685,8 @@ int reply_trans(connection_struct *conn, SAFE_FREE(state->param); TALLOC_FREE(state); END_PROFILE(SMBtrans); - return ERROR_NT(NT_STATUS_INVALID_PARAMETER); + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + return; } /**************************************************************************** diff --git a/source3/smbd/process.c b/source3/smbd/process.c index f455b39a52..f593c5e177 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -725,7 +725,7 @@ static const struct smb_message_struct { /* 0x22 */ { "SMBsetattrE",reply_setattrE,NULL,AS_USER | NEED_WRITE }, /* 0x23 */ { "SMBgetattrE",reply_getattrE,NULL,AS_USER }, /* 0x24 */ { "SMBlockingX",reply_lockingX,NULL,AS_USER }, -/* 0x25 */ { "SMBtrans",reply_trans,NULL,AS_USER | CAN_IPC }, +/* 0x25 */ { "SMBtrans",NULL,reply_trans,AS_USER | CAN_IPC }, /* 0x26 */ { "SMBtranss",reply_transs,NULL,AS_USER | CAN_IPC}, /* 0x27 */ { "SMBioctl",reply_ioctl,NULL,0}, /* 0x28 */ { "SMBioctls",NULL, NULL,AS_USER}, |