From: Volker Lendecke Date: Sat, 6 Feb 2021 20:33:41 +0000 (+0100) Subject: rpcclient: Add RPC_RTYPE_BINDING X-Git-Tag: tevent-0.11.0~1529 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e85640279b4a78555b4bfd612d326df2c73ced29;p=thirdparty%2Fsamba.git rpcclient: Add RPC_RTYPE_BINDING Purely transport-related commands don't need the cli_state. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index b0a36aac757..e890ef59502 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -870,6 +870,11 @@ static NTSTATUS do_cmd(struct cli_state *cli, if (!NT_STATUS_IS_OK(ntresult)) { printf("result was %s\n", nt_errstr(ntresult)); } + } else if (cmd_entry->returntype == RPC_RTYPE_BINDING) { + ntresult = cmd_entry->bfn(binding, mem_ctx, argc, argv); + if (!NT_STATUS_IS_OK(ntresult)) { + printf("result was %s\n", nt_errstr(ntresult)); + } } else { wresult = cmd_entry->wfn(cmd_entry->rpc_pipe, mem_ctx, argc, argv); /* print out the DOS error */ @@ -922,7 +927,9 @@ static NTSTATUS process_cmd(struct user_auth_info *auth_info, if (((set->returntype == RPC_RTYPE_NTSTATUS) && (set->ntfn == NULL)) || ((set->returntype == RPC_RTYPE_WERROR) && - (set->wfn == NULL))) { + (set->wfn == NULL)) || + ((set->returntype == RPC_RTYPE_BINDING) && + (set->bfn == NULL))) { fprintf (stderr, "Invalid command\n"); goto out_free; } diff --git a/source3/rpcclient/rpcclient.h b/source3/rpcclient/rpcclient.h index 22ebef0831f..75ac5758755 100644 --- a/source3/rpcclient/rpcclient.h +++ b/source3/rpcclient/rpcclient.h @@ -26,6 +26,7 @@ typedef enum { RPC_RTYPE_NTSTATUS = 0, RPC_RTYPE_WERROR, + RPC_RTYPE_BINDING, MAX_RPC_RETURN_TYPE } RPC_RETURN_TYPE; @@ -35,6 +36,10 @@ struct cmd_set { NTSTATUS (*ntfn)(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv); WERROR (*wfn)(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv); + NTSTATUS (*bfn)(struct dcerpc_binding *binding, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv); const struct ndr_interface_table *table; struct rpc_pipe_client *rpc_pipe; const char *description;