summaryrefslogtreecommitdiff
path: root/source3/utils/smbcontrol.c
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2013-03-15 15:09:18 +0100
committerChristof Schmitt <cs@samba.org>2013-12-12 10:50:59 -0700
commitac2ed5dfbfc9f3ea2978e7007052fedecd1f4013 (patch)
tree2aa9de97dff9c6c64b91154b1cb19b86925f0962 /source3/utils/smbcontrol.c
parenta26003ddb69f5bb2c50d8482841669204848df00 (diff)
downloadsamba-ac2ed5dfbfc9f3ea2978e7007052fedecd1f4013.tar.gz
s3:utils/smbcontrol implement kill-client-ip in smbcontrol
allows the admin to forcefully shutdown the connection of a specified client by IP address Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/utils/smbcontrol.c')
-rw-r--r--source3/utils/smbcontrol.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 00b23f7ce93..ea1f60951f8 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -790,6 +790,27 @@ static bool do_closeshare(struct tevent_context *ev_ctx,
strlen(argv[1]) + 1);
}
+/* Kill a client by IP address */
+static bool do_kill_client_by_ip(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const struct server_id pid,
+ const int argc, const char **argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "Usage: smbcontrol <dest> kill-client-ip "
+ "<IP address>\n");
+ return false;
+ }
+
+ if (!is_ipaddress_v4(argv[1]) && !is_ipaddress_v6(argv[1])) {
+ fprintf(stderr, "%s is not a valid IP address!\n", argv[1]);
+ return false;
+ }
+
+ return send_message(msg_ctx, pid, MSG_SMB_KILL_CLIENT_IP,
+ argv[1], strlen(argv[1]) + 1);
+}
+
/* Tell winbindd an IP got dropped */
static bool do_ip_dropped(struct tevent_context *ev_ctx,
@@ -1287,6 +1308,8 @@ static const struct {
{ "debuglevel", do_debuglevel, "Display current debuglevels" },
{ "printnotify", do_printnotify, "Send a print notify message" },
{ "close-share", do_closeshare, "Forcibly disconnect a share" },
+ { "kill-client-ip", do_kill_client_by_ip,
+ "Forcibly disconnect a client with a specific IP address" },
{ "ip-dropped", do_ip_dropped, "Tell winbind that an IP got dropped" },
{ "lockretry", do_lockretry, "Force a blocking lock retry" },
{ "brl-revalidate", do_brl_revalidate, "Revalidate all brl entries" },