summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-15 10:27:49 +0100
committerGünther Deschner <gd@samba.org>2014-02-11 16:02:14 +0100
commit6836ffc9fc088ea6c4444b9e4abfe2766a54f6a8 (patch)
treee3766019ad03878d81efe4f13d7f1cb429bf44e9 /source3
parentb5f30205931a4b9d0b3b257d5855869e606f8b63 (diff)
downloadsamba-6836ffc9fc088ea6c4444b9e4abfe2766a54f6a8.tar.gz
samba-6836ffc9fc088ea6c4444b9e4abfe2766a54f6a8.tar.xz
samba-6836ffc9fc088ea6c4444b9e4abfe2766a54f6a8.zip
s3:rpc_server: only become the user if we have a valid context_id
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de> Signed-off-by: Gregor Beck <gbeck@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_pipe.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index e5bd3a7ade..29e5b8af8e 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -1213,46 +1213,45 @@ static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt,
static bool api_pipe_request(struct pipes_struct *p,
struct ncacn_packet *pkt)
{
+ TALLOC_CTX *frame = talloc_stackframe();
bool ret = False;
struct pipe_rpc_fns *pipe_fns;
if (!p->pipe_bound) {
DEBUG(1, ("Pipe not bound!\n"));
data_blob_free(&p->out_data.rdata);
- return false;
- }
-
- if (!become_authenticated_pipe_user(p->session_info)) {
- DEBUG(1, ("Failed to become pipe user!\n"));
- data_blob_free(&p->out_data.rdata);
+ TALLOC_FREE(frame);
return false;
}
/* get the set of RPC functions for this context */
-
pipe_fns = find_pipe_fns_by_context(p->contexts,
pkt->u.request.context_id);
-
- if ( pipe_fns ) {
- TALLOC_CTX *frame = talloc_stackframe();
-
- DEBUG(5, ("Requested %s rpc service\n",
- ndr_interface_name(&pipe_fns->syntax.uuid,
- pipe_fns->syntax.if_version)));
-
- ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds,
- &pipe_fns->syntax);
-
- TALLOC_FREE(frame);
- }
- else {
+ if (pipe_fns == NULL) {
DEBUG(0, ("No rpc function table associated with context "
"[%d]\n",
pkt->u.request.context_id));
+ data_blob_free(&p->out_data.rdata);
+ TALLOC_FREE(frame);
+ return false;
+ }
+
+ if (!become_authenticated_pipe_user(p->session_info)) {
+ DEBUG(1, ("Failed to become pipe user!\n"));
+ data_blob_free(&p->out_data.rdata);
+ TALLOC_FREE(frame);
+ return false;
}
+ DEBUG(5, ("Requested %s rpc service\n",
+ ndr_interface_name(&pipe_fns->syntax.uuid,
+ pipe_fns->syntax.if_version)));
+
+ ret = api_rpcTNP(p, pkt, pipe_fns->cmds, pipe_fns->n_cmds,
+ &pipe_fns->syntax);
unbecome_authenticated_pipe_user();
+ TALLOC_FREE(frame);
return ret;
}