summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-05 09:46:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:19 -0500
commit3bb9f20bc3df85d8c099999dbc2c372eac245c28 (patch)
tree00ad45fc5b86693752760340f38ba23ad5c5ea0d /source3/smbd
parentabc519ff43fc71b3353704227d1941285062a256 (diff)
downloadsamba-3bb9f20bc3df85d8c099999dbc2c372eac245c28.tar.gz
samba-3bb9f20bc3df85d8c099999dbc2c372eac245c28.tar.bz2
samba-3bb9f20bc3df85d8c099999dbc2c372eac245c28.zip
r24235: Make handle_trans reply to errors itself
(This used to be commit 06d0c74b74754c55f4c8ef0899bda08476e7dd4b)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c76
1 files changed, 29 insertions, 47 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index c56d167806..51403cd8b2 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -396,22 +396,22 @@ static int named_pipe(connection_struct *conn, uint16 vuid,
return 0;
}
-static NTSTATUS handle_trans(connection_struct *conn,
- struct smb_request *req,
- struct trans_state *state,
- int *outsize)
+static void handle_trans(connection_struct *conn, struct smb_request *req,
+ struct trans_state *state)
{
char *local_machine_name;
int name_offset = 0;
char *inbuf, *outbuf;
int size, bufsize;
+ int outsize;
DEBUG(3,("trans <%s> data=%u params=%u setup=%u\n",
state->name,(unsigned int)state->total_data,(unsigned int)state->total_param,
(unsigned int)state->setup_count));
if (!reply_prep_legacy(req, &inbuf, &outbuf, &size, &bufsize)) {
- return NT_STATUS_NO_MEMORY;
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
}
/*
@@ -422,7 +422,8 @@ static NTSTATUS handle_trans(connection_struct *conn,
get_local_machine_name());
if (local_machine_name == NULL) {
- return NT_STATUS_NO_MEMORY;
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
}
if (strnequal(state->name, local_machine_name,
@@ -432,7 +433,8 @@ static NTSTATUS handle_trans(connection_struct *conn,
if (!strnequal(&state->name[name_offset], "\\PIPE",
strlen("\\PIPE"))) {
- return NT_STATUS_NOT_SUPPORTED;
+ reply_nterror(req, NT_STATUS_NOT_SUPPORTED);
+ return;
}
name_offset += strlen("\\PIPE");
@@ -444,29 +446,30 @@ static NTSTATUS handle_trans(connection_struct *conn,
name_offset++;
DEBUG(5,("calling named_pipe\n"));
- *outsize = named_pipe(conn,
- state->vuid,
- inbuf,
- outbuf,
- state->name+name_offset,
- state->setup,state->data,
- state->param,
- state->setup_count,state->total_data,
- state->total_param,
- state->max_setup_return,
- state->max_data_return,
- state->max_param_return);
-
- if (*outsize == 0) {
- return NT_STATUS_NOT_SUPPORTED;
+ outsize = named_pipe(conn,
+ state->vuid,
+ inbuf,
+ outbuf,
+ state->name+name_offset,
+ state->setup,state->data,
+ state->param,
+ state->setup_count,state->total_data,
+ state->total_param,
+ state->max_setup_return,
+ state->max_data_return,
+ state->max_param_return);
+
+ if (outsize == 0) {
+ reply_nterror(req, NT_STATUS_NOT_SUPPORTED);
+ return;
}
if (state->close_on_completion)
close_cnum(conn,state->vuid);
- reply_post_legacy(req, *outsize);
+ reply_post_legacy(req, outsize);
- return NT_STATUS_OK;
+ return;
}
/****************************************************************************
@@ -475,7 +478,6 @@ static NTSTATUS handle_trans(connection_struct *conn,
void reply_trans(connection_struct *conn, struct smb_request *req)
{
- int outsize = 0;
unsigned int dsoff;
unsigned int dscnt;
unsigned int psoff;
@@ -631,24 +633,12 @@ void reply_trans(connection_struct *conn, struct smb_request *req)
return;
}
- result = handle_trans(conn, req, state, &outsize);
+ handle_trans(conn, req, state);
SAFE_FREE(state->data);
SAFE_FREE(state->param);
TALLOC_FREE(state);
- if (!NT_STATUS_IS_OK(result)) {
- reply_nterror(req, result);
- END_PROFILE(SMBtrans);
- return;
- }
-
- if (outsize == 0) {
- reply_nterror(req, NT_STATUS_INTERNAL_ERROR);
- END_PROFILE(SMBtrans);
- return;
- }
-
END_PROFILE(SMBtrans);
return;
@@ -669,10 +659,8 @@ void reply_trans(connection_struct *conn, struct smb_request *req)
void reply_transs(connection_struct *conn, struct smb_request *req)
{
- int outsize = 0;
unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp;
struct trans_state *state;
- NTSTATUS result;
int size;
START_PROFILE(SMBtranss);
@@ -772,19 +760,13 @@ void reply_transs(connection_struct *conn, struct smb_request *req)
*/
SCVAL(req->outbuf,smb_com,SMBtrans);
- result = handle_trans(conn, req, state, &outsize);
+ handle_trans(conn, req, state);
DLIST_REMOVE(conn->pending_trans, state);
SAFE_FREE(state->data);
SAFE_FREE(state->param);
TALLOC_FREE(state);
- if ((outsize == 0) || !NT_STATUS_IS_OK(result)) {
- reply_doserror(req, ERRSRV, ERRnosupport);
- END_PROFILE(SMBtranss);
- return;
- }
-
END_PROFILE(SMBtranss);
return;