]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbcontrol: Add rpc-dump-status
authorVolker Lendecke <vl@samba.org>
Sun, 28 Feb 2021 21:03:01 +0000 (22:03 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 10 Dec 2021 14:02:30 +0000 (14:02 +0000)
Get status information out of samba-dcerpcd and its RPC helpers.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/utils/smbcontrol.c

index 070e16b97f67f5a6cef2877f96010f3e5cde925a..ab57bd4804248ae3f857244aa6b43c4105a99662 100644 (file)
@@ -903,6 +903,39 @@ static bool do_poolusage(struct tevent_context *ev_ctx,
        return true;
 }
 
+static bool do_rpc_dump_status(
+       struct tevent_context *ev_ctx,
+       struct messaging_context *msg_ctx,
+       const struct server_id dst,
+       const int argc,
+       const char **argv)
+{
+       pid_t pid = procid_to_pid(&dst);
+       int stdout_fd = 1;
+
+       if (argc != 1) {
+               fprintf(stderr,
+                       "Usage: smbcontrol <dest> rpc-dump-status\n");
+               return False;
+       }
+
+       if (pid == 0) {
+               fprintf(stderr, "Can only send to a specific PID\n");
+               return false;
+       }
+
+       messaging_send_iov(
+               msg_ctx,
+               dst,
+               MSG_RPC_DUMP_STATUS,
+               NULL,
+               0,
+               &stdout_fd,
+               1);
+
+       return true;
+}
+
 /* Fetch and print the ringbuf log */
 
 static void print_ringbuf_log_cb(struct messaging_context *msg,
@@ -1479,6 +1512,11 @@ static const struct {
                .fn   = do_poolusage,
                .help = "Display talloc memory usage",
        },
+       {
+               .name = "rpc-dump-status",
+               .fn   = do_rpc_dump_status,
+               .help = "Display rpc status",
+       },
        {
                .name = "ringbuf-log",
                .fn   = do_ringbuflog,