]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpcclient: Add RPC_RTYPE_BINDING
authorVolker Lendecke <vl@samba.org>
Sat, 6 Feb 2021 20:33:41 +0000 (21:33 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 16 Mar 2021 17:09:32 +0000 (17:09 +0000)
Purely transport-related commands don't need the cli_state.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpcclient/rpcclient.c
source3/rpcclient/rpcclient.h

index b0a36aac757a5c965c3b91594cc75465ab19d740..e890ef59502441a2aefa0d94bdfaf1d22e7cf637 100644 (file)
@@ -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;
                        }
index 22ebef0831fb4236f954704d13b64744f3394db4..75ac5758755c0d7c90ab4a3280f8508491fffc86 100644 (file)
@@ -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;