diff options
author | Ralph Boehme <slow@samba.org> | 2021-01-20 11:17:22 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2021-02-01 07:50:10 +0000 |
commit | 19f39e67942968c5a2c0e99179c938b99ba2250e (patch) | |
tree | 64877d822a5733295b0711ff463be4b4a9ac73f2 /source3 | |
parent | 7003d050b0c27498b791113a54b6241c174b7641 (diff) | |
download | samba-19f39e67942968c5a2c0e99179c938b99ba2250e.tar.gz |
winbind: move config-reloading code to winbindd_dual.c
In preperation of forwarding MSG_SMB_CONF_UPDATED to all childs.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14602
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 81edc65e79aba121db800ec53aadd766e61a0001)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/winbindd.c | 23 | ||||
-rw-r--r-- | source3/winbindd/winbindd_dual.c | 15 | ||||
-rw-r--r-- | source3/winbindd/winbindd_proto.h | 7 |
3 files changed, 28 insertions, 17 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 1e08237905a..db660cb5147 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -102,7 +102,7 @@ struct imessaging_context *winbind_imessaging_context(void) /* Reload configuration */ -static bool reload_services_file(const char *lfile) +bool winbindd_reload_services_file(const char *lfile) { const struct loadparm_substitution *lp_sub = loadparm_s3_global_substitution(); @@ -156,7 +156,7 @@ static void winbindd_status(void) /* Flush client cache */ -static void flush_caches(void) +void winbindd_flush_caches(void) { /* We need to invalidate cached user list entries on a SIGHUP otherwise cached access denied errors due to restrict anonymous @@ -363,7 +363,7 @@ static void winbindd_sig_hup_handler(struct tevent_context *ev, DEBUG(1,("Reloading services after SIGHUP\n")); flush_caches_noinit(); - reload_services_file(file); + winbindd_reload_services_file(file); } bool winbindd_setup_sig_hup_handler(const char *lfile) @@ -447,18 +447,6 @@ static bool winbindd_setup_sig_usr2_handler(void) return true; } -/* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ -static void msg_reload_services(struct messaging_context *msg, - void *private_data, - uint32_t msg_type, - struct server_id server_id, - DATA_BLOB *data) -{ - /* Flush various caches */ - flush_caches(); - reload_services_file((const char *) private_data); -} - /* React on 'smbcontrol winbindd shutdown' in the same way as on SIGTERM*/ static void msg_shutdown(struct messaging_context *msg, void *private_data, @@ -1420,7 +1408,8 @@ static void winbindd_register_handlers(struct messaging_context *msg_ctx, /* React on 'smbcontrol winbindd reload-config' in the same way as to SIGHUP signal */ messaging_register(msg_ctx, NULL, - MSG_SMB_CONF_UPDATED, msg_reload_services); + MSG_SMB_CONF_UPDATED, + winbindd_msg_reload_services_parent); messaging_register(msg_ctx, NULL, MSG_SHUTDOWN, msg_shutdown); @@ -1811,7 +1800,7 @@ int main(int argc, const char **argv) exit(1); } - if (!reload_services_file(NULL)) { + if (!winbindd_reload_services_file(NULL)) { DEBUG(0, ("error opening config file\n")); exit(1); } diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 47efe988d65..6cc1305a9b8 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -927,6 +927,21 @@ void winbind_disconnect_dc_parent(struct messaging_context *msg_ctx, forall_children(winbind_msg_relay_fn, &state); } +/* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ +void winbindd_msg_reload_services_parent(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) +{ + DBG_DEBUG("Got reload-config message\n"); + + /* Flush various caches */ + winbindd_flush_caches(); + + winbindd_reload_services_file((const char *)private_data); +} + /* Set our domains as offline and forward the offline message to our children. */ struct winbind_msg_on_offline_state { diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 2a829b0171a..6d4ffa726f1 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -31,6 +31,8 @@ bool winbindd_setup_sig_hup_handler(const char *lfile); bool winbindd_use_idmap_cache(void); bool winbindd_use_cache(void); char *get_winbind_priv_pipe_dir(void); +void winbindd_flush_caches(void); +bool winbindd_reload_services_file(const char *lfile); /* The following definitions come from winbindd/winbindd_ads.c */ @@ -341,6 +343,11 @@ void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); +void winbindd_msg_reload_services_parent(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself, const char *logfilename); struct winbindd_domain *wb_child_domain(void); |