summaryrefslogtreecommitdiff
path: root/pidl/tests
diff options
context:
space:
mode:
Diffstat (limited to 'pidl/tests')
-rwxr-xr-xpidl/tests/samba3-cli.pl102
1 files changed, 21 insertions, 81 deletions
diff --git a/pidl/tests/samba3-cli.pl b/pidl/tests/samba3-cli.pl
index fcf1fb171b..367922a36b 100755
--- a/pidl/tests/samba3-cli.pl
+++ b/pidl/tests/samba3-cli.pl
@@ -31,10 +31,7 @@ $fn = { NAME => "bar", ELEMENTS => [ ] };
$x->ParseFunction("foo", $fn);
is($x->{res},
"struct rpccli_bar_state {
- struct bar orig;
- struct bar tmp;
TALLOC_CTX *out_mem_ctx;
- NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
};
static void rpccli_bar_done(struct tevent_req *subreq);
@@ -53,19 +50,10 @@ struct tevent_req *rpccli_bar_send(TALLOC_CTX *mem_ctx,
return NULL;
}
state->out_mem_ctx = NULL;
- state->dispatch_recv = cli->dispatch_recv;
- /* In parameters */
-
- /* Out parameters */
-
- /* make a temporary copy, that we pass to the dispatch function */
- state->tmp = state->orig;
-
- subreq = cli->dispatch_send(state, ev, cli,
- &ndr_table_foo,
- NDR_BAR,
- &state->tmp);
+ subreq = dcerpc_bar_send(state,
+ ev,
+ cli->binding_handle);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
@@ -88,18 +76,14 @@ static void rpccli_bar_done(struct tevent_req *subreq)
mem_ctx = state;
}
- status = state->dispatch_recv(subreq, mem_ctx);
+ status = dcerpc_bar_recv(subreq,
+ mem_ctx);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
}
- /* Copy out parameters */
-
- /* Reset temporary structure */
- ZERO_STRUCT(state->tmp);
-
tevent_req_done(req);
}
@@ -125,27 +109,14 @@ NTSTATUS rpccli_bar_recv(struct tevent_req *req,
NTSTATUS rpccli_bar(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx)
{
- struct bar r;
NTSTATUS status;
- /* In parameters */
-
- status = cli->dispatch(cli,
- mem_ctx,
- &ndr_table_foo,
- NDR_BAR,
- &r);
-
+ status = dcerpc_bar(cli->binding_handle,
+ mem_ctx);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
-
- /* Return variables */
-
/* Return result */
return NT_STATUS_OK;
}
@@ -158,10 +129,8 @@ $fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" };
$x->ParseFunction("foo", $fn);
is($x->{res},
"struct rpccli_bar_state {
- struct bar orig;
- struct bar tmp;
TALLOC_CTX *out_mem_ctx;
- NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+ WERROR result;
};
static void rpccli_bar_done(struct tevent_req *subreq);
@@ -180,22 +149,10 @@ struct tevent_req *rpccli_bar_send(TALLOC_CTX *mem_ctx,
return NULL;
}
state->out_mem_ctx = NULL;
- state->dispatch_recv = cli->dispatch_recv;
-
- /* In parameters */
- /* Out parameters */
-
- /* Result */
- ZERO_STRUCT(state->orig.out.result);
-
- /* make a temporary copy, that we pass to the dispatch function */
- state->tmp = state->orig;
-
- subreq = cli->dispatch_send(state, ev, cli,
- &ndr_table_foo,
- NDR_BAR,
- &state->tmp);
+ subreq = dcerpc_bar_send(state,
+ ev,
+ cli->binding_handle);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
@@ -218,21 +175,15 @@ static void rpccli_bar_done(struct tevent_req *subreq)
mem_ctx = state;
}
- status = state->dispatch_recv(subreq, mem_ctx);
+ status = dcerpc_bar_recv(subreq,
+ mem_ctx,
+ &state->result);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
}
- /* Copy out parameters */
-
- /* Copy result */
- state->orig.out.result = state->tmp.out.result;
-
- /* Reset temporary structure */
- ZERO_STRUCT(state->tmp);
-
tevent_req_done(req);
}
@@ -253,7 +204,7 @@ NTSTATUS rpccli_bar_recv(struct tevent_req *req,
talloc_steal(mem_ctx, state->out_mem_ctx);
/* Return result */
- *result = state->orig.out.result;
+ *result = state->result;
tevent_req_received(req);
return NT_STATUS_OK;
@@ -263,33 +214,22 @@ NTSTATUS rpccli_bar(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
WERROR *werror)
{
- struct bar r;
+ WERROR result;
NTSTATUS status;
- /* In parameters */
-
- status = cli->dispatch(cli,
- mem_ctx,
- &ndr_table_foo,
- NDR_BAR,
- &r);
-
+ status = dcerpc_bar(cli->binding_handle,
+ mem_ctx,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
-
- /* Return variables */
-
/* Return result */
if (werror) {
- *werror = r.out.result;
+ *werror = result;
}
- return werror_to_ntstatus(r.out.result);
+ return werror_to_ntstatus(result);
}
");