From: Volker Lendecke Date: Sun, 28 Feb 2021 21:03:01 +0000 (+0100) Subject: smbcontrol: Add rpc-dump-status X-Git-Tag: tdb-1.4.6~358 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3aee4c171c2fdb555c91f74d861d7977e4b91f06;p=thirdparty%2Fsamba.git smbcontrol: Add rpc-dump-status Get status information out of samba-dcerpcd and its RPC helpers. Signed-off-by: Volker Lendecke Reviewed-by: Samuel Cabrero Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 070e16b97f6..ab57bd48042 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -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 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,