diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-07-01 06:05:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:01 -0500 |
commit | 8ab3f59a10d00357cb129a2051fd0f694b5c8081 (patch) | |
tree | b1bfb55da681c76d7404216613ad8d5b56795d7d /source4/rpc_server | |
parent | 324de0b36d3c128d9fb40c27cd5667aa8bbc62ba (diff) | |
download | samba-8ab3f59a10d00357cb129a2051fd0f694b5c8081.tar.gz samba-8ab3f59a10d00357cb129a2051fd0f694b5c8081.tar.bz2 samba-8ab3f59a10d00357cb129a2051fd0f694b5c8081.zip |
r8036: revert rev 8023/8024 as they have a bugs.
metze
(This used to be commit 66d6b1d5783cba98f2f8e1c8eed1bdc26a5bad4f)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 79 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.h | 2 |
2 files changed, 41 insertions, 40 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 3976173824..15da8c6964 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -399,15 +399,16 @@ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code pkt.u.fault.status = fault_code; rep = talloc(call, struct dcesrv_call_reply); - NT_STATUS_HAVE_NO_MEMORY(rep); - - rep->data = talloc(call, DATA_BLOB); - NT_STATUS_HAVE_NO_MEMORY(rep->data); + if (!rep) { + return NT_STATUS_NO_MEMORY; + } - status = ncacn_push_auth(rep->data, call, &pkt, NULL); - NT_STATUS_NOT_OK_RETURN(status); + status = ncacn_push_auth(&rep->data, call, &pkt, NULL); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - dcerpc_set_frag_length(rep->data, rep->data->length); + dcerpc_set_frag_length(&rep->data, rep->data.length); DLIST_ADD_END(call->replies, rep, struct dcesrv_call_reply *); DLIST_ADD_END(call->conn->call_list, call, struct dcesrv_call_state *); @@ -435,15 +436,16 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason) pkt.u.bind_nak.num_versions = 0; rep = talloc(call, struct dcesrv_call_reply); - NT_STATUS_HAVE_NO_MEMORY(rep); - - rep->data = talloc(call, DATA_BLOB); - NT_STATUS_HAVE_NO_MEMORY(rep->data); + if (!rep) { + return NT_STATUS_NO_MEMORY; + } - status = ncacn_push_auth(rep->data, call, &pkt, NULL); - NT_STATUS_NOT_OK_RETURN(status); + status = ncacn_push_auth(&rep->data, call, &pkt, NULL); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - dcerpc_set_frag_length(rep->data, rep->data->length); + dcerpc_set_frag_length(&rep->data, rep->data.length); DLIST_ADD_END(call->replies, rep, struct dcesrv_call_reply *); DLIST_ADD_END(call->conn->call_list, call, struct dcesrv_call_state *); @@ -569,16 +571,17 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) } rep = talloc(call, struct dcesrv_call_reply); - NT_STATUS_HAVE_NO_MEMORY(rep); - - rep->data = talloc(call, DATA_BLOB); - NT_STATUS_HAVE_NO_MEMORY(rep->data); + if (!rep) { + return NT_STATUS_NO_MEMORY; + } - status = ncacn_push_auth(rep->data, call, &pkt, - call->conn->auth_state.auth_info); - NT_STATUS_NOT_OK_RETURN(status); + status = ncacn_push_auth(&rep->data, call, &pkt, + call->conn->auth_state.auth_info); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - dcerpc_set_frag_length(rep->data, rep->data->length); + dcerpc_set_frag_length(&rep->data, rep->data.length); DLIST_ADD_END(call->replies, rep, struct dcesrv_call_reply *); DLIST_ADD_END(call->conn->call_list, call, struct dcesrv_call_state *); @@ -710,16 +713,17 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call) } rep = talloc(call, struct dcesrv_call_reply); - NT_STATUS_HAVE_NO_MEMORY(rep); - - rep->data = talloc(call, DATA_BLOB); - NT_STATUS_HAVE_NO_MEMORY(rep->data); + if (!rep) { + return NT_STATUS_NO_MEMORY; + } - status = ncacn_push_auth(rep->data, call, &pkt, - call->conn->auth_state.auth_info); - NT_STATUS_IS_OK_RETURN(status); + status = ncacn_push_auth(&rep->data, call, &pkt, + call->conn->auth_state.auth_info); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - dcerpc_set_frag_length(rep->data, rep->data->length); + dcerpc_set_frag_length(&rep->data, rep->data.length); DLIST_ADD_END(call->replies, rep, struct dcesrv_call_reply *); DLIST_ADD_END(call->conn->call_list, call, struct dcesrv_call_state *); @@ -840,9 +844,6 @@ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call) rep = talloc(call, struct dcesrv_call_reply); NT_STATUS_HAVE_NO_MEMORY(rep); - rep->data = talloc(call, DATA_BLOB); - NT_STATUS_HAVE_NO_MEMORY(rep->data); - length = stub.length; if (length + DCERPC_RESPONSE_LENGTH > call->conn->cli_max_recv_frag) { /* the 32 is to cope with signing data */ @@ -868,11 +869,11 @@ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call) pkt.u.response.stub_and_verifier.data = stub.data; pkt.u.response.stub_and_verifier.length = length; - if (!dcesrv_auth_response(call, rep->data, &pkt)) { + if (!dcesrv_auth_response(call, &rep->data, &pkt)) { return dcesrv_fault(call, DCERPC_FAULT_OTHER); } - dcerpc_set_frag_length(rep->data, rep->data->length); + dcerpc_set_frag_length(&rep->data, rep->data.length); DLIST_ADD_END(call->replies, rep, struct dcesrv_call_reply *); @@ -1126,13 +1127,13 @@ NTSTATUS dcesrv_output(struct dcesrv_connection *dce_conn, } rep = call->replies; - status = write_fn(private_data, rep->data, &nwritten); + status = write_fn(private_data, &rep->data, &nwritten); NT_STATUS_IS_ERR_RETURN(status); - rep->data->length -= nwritten; - rep->data->data += nwritten; + rep->data.length -= nwritten; + rep->data.data += nwritten; - if (rep->data->length == 0) { + if (rep->data.length == 0) { /* we're done with this section of the call */ DLIST_REMOVE(call->replies, rep); } diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index ac1b7892ce..3c4888784d 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -104,7 +104,7 @@ struct dcesrv_call_state { struct dcesrv_call_reply { struct dcesrv_call_reply *next, *prev; - DATA_BLOB *data; + DATA_BLOB data; } *replies; /* this is used by the boilerplate code to generate DCERPC faults */ |