diff options
author | Volker Lendecke <vl@samba.org> | 2018-02-28 15:08:44 +0000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-04-20 11:56:21 +0200 |
commit | ad0b42ae90e8409133227666bb6cb0972cf96d44 (patch) | |
tree | 7c9c95a52f2d166f73fa3046d53bcb79fa317195 | |
parent | ade0d54563fd11f1ca4cbae7d9550504b24473c7 (diff) | |
download | samba-ad0b42ae90e8409133227666bb6cb0972cf96d44.tar.gz |
winbind: Add smbcontrol disconnect-dc
Make a winbind child drop all DC connections
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(backported from commit 0af88b98e7e1bba14827305257e77b63dc82d902)
-rw-r--r-- | librpc/idl/messaging.idl | 1 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 14 | ||||
-rw-r--r-- | source3/winbindd/winbindd.c | 4 | ||||
-rw-r--r-- | source3/winbindd/winbindd_cm.c | 16 | ||||
-rw-r--r-- | source3/winbindd/winbindd_dual.c | 21 | ||||
-rw-r--r-- | source3/winbindd/winbindd_proto.h | 10 |
6 files changed, 65 insertions, 1 deletions
diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl index b35f1e1e9ae..4bce8202757 100644 --- a/librpc/idl/messaging.idl +++ b/librpc/idl/messaging.idl @@ -124,6 +124,7 @@ interface messaging MSG_WINBIND_DOMAIN_ONLINE = 0x040B, MSG_WINBIND_DOMAIN_OFFLINE = 0x040C, MSG_WINBIND_RELOAD_TRUSTED_DOMAINS = 0x040D, + MSG_WINBIND_DISCONNECT_DC = 0x040E, /* event messages */ MSG_DUMP_EVENT_LIST = 0x0500, diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 0f6dacce20d..b024f3afbd9 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -1258,6 +1258,19 @@ static bool do_winbind_dump_domain_list(struct tevent_context *ev_ctx, return num_replies; } +static bool do_msg_disconnect_dc(struct tevent_context *ev_ctx, + struct messaging_context *msg_ctx, + const struct server_id pid, + const int argc, const char **argv) +{ + if (argc != 1) { + fprintf(stderr, "Usage: smbcontrol <dest> disconnect-dc\n"); + return False; + } + + return send_message(msg_ctx, pid, MSG_WINBIND_DISCONNECT_DC, NULL, 0); +} + static void winbind_validate_cache_cb(struct messaging_context *msg, void *private_data, uint32_t msg_type, @@ -1436,6 +1449,7 @@ static const struct { { "validate-cache" , do_winbind_validate_cache, "Validate winbind's credential cache" }, { "dump-domain-list", do_winbind_dump_domain_list, "Dump winbind domain list"}, + { "disconnect-dc", do_msg_disconnect_dc }, { "notify-cleanup", do_notify_cleanup }, { "num-children", do_num_children, "Print number of smbd child processes" }, diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 0a8d146dfdc..c59669efdc9 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1346,6 +1346,10 @@ static void winbindd_register_handlers(struct messaging_context *msg_ctx, MSG_DEBUG, winbind_msg_debug); + messaging_register(msg_ctx, NULL, + MSG_WINBIND_DISCONNECT_DC, + winbind_disconnect_dc_parent); + netsamlogon_cache_init(); /* Non-critical */ /* clear the cached list of trusted domains */ diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index e6cd3efcea9..2d3f79d0155 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -3506,3 +3506,19 @@ void winbind_msg_ip_dropped(struct messaging_context *msg_ctx, } TALLOC_FREE(freeit); } + +void winbind_msg_disconnect_dc(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) +{ + struct winbindd_domain *domain; + + for (domain = domain_list(); domain; domain = domain->next) { + if (domain->internal) { + continue; + } + invalidate_cm_connection(domain); + } +} diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 2ae21b09c43..de4389090c0 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -785,6 +785,23 @@ void winbind_msg_debug(struct messaging_context *msg_ctx, strlen((char *) data->data) + 1); } } +void winbind_disconnect_dc_parent(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) +{ + struct winbindd_child *child = NULL; + + DBG_DEBUG("Got disconnect_dc message\n"); + + for (child = winbindd_children; child != NULL; child = child->next) { + messaging_send_buf(msg_ctx, + pid_to_procid(child->pid), + MSG_WINBIND_DISCONNECT_DC, + NULL, 0); + } +} /* Set our domains as offline and forward the offline message to our children. */ @@ -1667,7 +1684,9 @@ static bool fork_domain_child(struct winbindd_child *child) messaging_register(server_messaging_context(), NULL, MSG_WINBIND_IP_DROPPED, winbind_msg_ip_dropped); - + messaging_register(server_messaging_context(), NULL, + MSG_WINBIND_DISCONNECT_DC, + winbind_msg_disconnect_dc); primary_domain = find_our_domain(); diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 704a8dd2924..eb0bf8dad4b 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -297,6 +297,11 @@ void winbind_msg_debug(struct messaging_context *msg_ctx, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); +void winbind_disconnect_dc_parent(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); void winbind_msg_offline(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, @@ -327,6 +332,11 @@ void winbind_msg_ip_dropped(struct messaging_context *msg_ctx, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); +void winbind_msg_disconnect_dc(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, |