diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-08 09:53:08 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-08 13:12:13 +0100 |
commit | daa964013bc5d036f4da571ce22c0052ef40943a (patch) | |
tree | fa94d2690f3b5f334f823ec266bb6aa1023b324d /source3/rpc_client | |
parent | 70c698fd547c4bc19cf77693608bbb34acac40b5 (diff) | |
download | samba-daa964013bc5d036f4da571ce22c0052ef40943a.tar.gz samba-daa964013bc5d036f4da571ce22c0052ef40943a.tar.bz2 samba-daa964013bc5d036f4da571ce22c0052ef40943a.zip |
s3: Do not reference ndr_table_<pipe> in the cli_ routines directly
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/ndr.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c index 6433a7d196..1db6ff7290 100644 --- a/source3/rpc_client/ndr.c +++ b/source3/rpc_client/ndr.c @@ -33,12 +33,15 @@ static void cli_do_rpc_ndr_done(struct tevent_req *subreq); struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct rpc_pipe_client *cli, - const struct ndr_interface_table *table, + const char *interface, + uint32_t interface_version, uint32_t opnum, void *r) { struct tevent_req *req, *subreq; struct cli_do_rpc_ndr_state *state; + struct ndr_syntax_id syntax; + const struct ndr_interface_table *table; struct ndr_push *push; DATA_BLOB blob; enum ndr_err_code ndr_err; @@ -50,6 +53,17 @@ struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx, return NULL; } + if (!ndr_syntax_from_string(interface, interface_version, &syntax)) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return tevent_req_post(req, ev); + } + + table = get_iface_from_syntax(&syntax); + if (table == NULL) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return tevent_req_post(req, ev); + } + if (!ndr_syntax_id_equal(&table->syntax_id, &cli->abstract_syntax) || (opnum >= table->num_calls)) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); @@ -156,7 +170,7 @@ NTSTATUS cli_do_rpc_ndr_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx) NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const struct ndr_interface_table *table, + const char *interface, uint32_t interface_version, uint32_t opnum, void *r) { TALLOC_CTX *frame = talloc_stackframe(); @@ -170,7 +184,8 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, goto fail; } - req = cli_do_rpc_ndr_send(frame, ev, cli, table, opnum, r); + req = cli_do_rpc_ndr_send(frame, ev, cli, interface, interface_version, + opnum, r); if (req == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; |