diff options
author | Volker Lendecke <vl@samba.org> | 2018-02-28 15:08:44 +0000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-05-07 09:57:25 +0200 |
commit | 8da9fb5a30ea5c11eb9292fd2a4ac7bc698b4c2e (patch) | |
tree | 327b5ee831e7c097fd7f64c73e624110c24b132f /source3 | |
parent | 91fd11d0b62039bcabc6a350f28020c79083d4f8 (diff) | |
download | samba-8da9fb5a30ea5c11eb9292fd2a4ac7bc698b4c2e.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)
Diffstat (limited to 'source3')
-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 |
5 files changed, 64 insertions, 1 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 4c4bfcb4e5b..1fc00134395 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -1267,6 +1267,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, @@ -1445,6 +1458,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 ceb131e9b32..4925fa4b8fb 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1356,6 +1356,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 ee168fc3e4b..dbefe72e718 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -3467,3 +3467,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 512ecd06141..778f7f1b423 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. */ @@ -1658,7 +1675,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 a300a534d03..f9841797166 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -320,6 +320,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, @@ -350,6 +355,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, |