From caf8c6a76be051559ffcfe97084edca43e0a3cee Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 30 Jan 2007 22:22:06 +0000 Subject: r21064: The core of this patch is void message_register(int msg_type, void (*fn)(int msg_type, struct process_id pid, - void *buf, size_t len)) + void *buf, size_t len, + void *private_data), + void *private_data) { struct dispatch_fns *dfn; So this adds a (so far unused) private pointer that is passed from message_register to the message handler. A prerequisite to implement a tiny samba4-API compatible wrapper around our messaging system. That itself is necessary for the Samba4 notify system. Yes, I know, I could import the whole Samba4 messaging system, but I want to do it step by step and I think getting notify in is more important in this step. Volker (This used to be commit c8ae60ed65dcce9660ee39c75488f2838cf9a28b) --- source3/nsswitch/winbindd.c | 19 +++++++++++-------- source3/nsswitch/winbindd_cm.c | 12 ++++++++---- source3/nsswitch/winbindd_dual.c | 25 ++++++++++++++++--------- 3 files changed, 35 insertions(+), 21 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index c44750ec6f..9a4d7e3aed 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -174,7 +174,8 @@ static void sigchld_handler(int signum) } /* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/ -static void msg_reload_services(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_reload_services(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { /* Flush various caches */ flush_caches(); @@ -182,7 +183,8 @@ static void msg_reload_services(int msg_type, struct process_id src, void *buf, } /* React on 'smbcontrol winbindd shutdown' in the same way as on SIGTERM*/ -static void msg_shutdown(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_shutdown(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { do_sigterm = True; } @@ -877,7 +879,7 @@ static void process_loop(void) DEBUG(3, ("got SIGHUP\n")); - msg_reload_services(MSG_SMB_CONF_UPDATED, pid_to_procid(0), NULL, 0); + msg_reload_services(MSG_SMB_CONF_UPDATED, pid_to_procid(0), NULL, 0, NULL); do_sighup = False; } @@ -1075,13 +1077,14 @@ int main(int argc, char **argv, char **envp) /* React on 'smbcontrol winbindd reload-config' in the same way as to SIGHUP signal */ - message_register(MSG_SMB_CONF_UPDATED, msg_reload_services); - message_register(MSG_SHUTDOWN, msg_shutdown); + message_register(MSG_SMB_CONF_UPDATED, msg_reload_services, NULL); + message_register(MSG_SHUTDOWN, msg_shutdown, NULL); /* Handle online/offline messages. */ - message_register(MSG_WINBIND_OFFLINE,winbind_msg_offline); - message_register(MSG_WINBIND_ONLINE,winbind_msg_online); - message_register(MSG_WINBIND_ONLINESTATUS,winbind_msg_onlinestatus); + message_register(MSG_WINBIND_OFFLINE, winbind_msg_offline, NULL); + message_register(MSG_WINBIND_ONLINE, winbind_msg_online, NULL); + message_register(MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus, + NULL); poptFreeContext(pc); diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index 2875e725e4..35017d39a4 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -82,7 +82,8 @@ static BOOL get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain, Child failed to find DC's. Reschedule check. ****************************************************************/ -static void msg_failed_to_go_online(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_failed_to_go_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -117,7 +118,8 @@ static void msg_failed_to_go_online(int msg_type, struct process_id src, void *b Actually cause a reconnect from a message. ****************************************************************/ -static void msg_try_to_go_online(int msg_type, struct process_id src, void *buf, size_t len) +static void msg_try_to_go_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -182,8 +184,10 @@ static BOOL fork_child_dc_connect(struct winbindd_domain *domain) if (child_pid != 0) { /* Parent */ - message_register(MSG_WINBIND_TRY_TO_GO_ONLINE,msg_try_to_go_online); - message_register(MSG_WINBIND_FAILED_TO_GO_ONLINE,msg_failed_to_go_online); + message_register(MSG_WINBIND_TRY_TO_GO_ONLINE, + msg_try_to_go_online, NULL); + message_register(MSG_WINBIND_FAILED_TO_GO_ONLINE, + msg_failed_to_go_online, NULL); message_unblock(); return True; } diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c index 22786df601..0dacf4c385 100644 --- a/source3/nsswitch/winbindd_dual.c +++ b/source3/nsswitch/winbindd_dual.c @@ -476,7 +476,8 @@ void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain) /* Set our domains as offline and forward the offline message to our children. */ -void winbind_msg_offline(int msg_type, struct process_id src, void *buf, size_t len) +void winbind_msg_offline(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_child *child; struct winbindd_domain *domain; @@ -527,7 +528,8 @@ void winbind_msg_offline(int msg_type, struct process_id src, void *buf, size_t /* Set our domains as online and forward the online message to our children. */ -void winbind_msg_online(int msg_type, struct process_id src, void *buf, size_t len) +void winbind_msg_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_child *child; struct winbindd_domain *domain; @@ -579,7 +581,8 @@ void winbind_msg_online(int msg_type, struct process_id src, void *buf, size_t l } /* Forward the online/offline messages to our children. */ -void winbind_msg_onlinestatus(int msg_type, struct process_id src, void *buf, size_t len) +void winbind_msg_onlinestatus(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_child *child; @@ -641,7 +644,8 @@ static void account_lockout_policy_handler(struct event_context *ctx, /* Deal with a request to go offline. */ -static void child_msg_offline(int msg_type, struct process_id src, void *buf, size_t len) +static void child_msg_offline(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -678,7 +682,8 @@ static void child_msg_offline(int msg_type, struct process_id src, void *buf, si /* Deal with a request to go online. */ -static void child_msg_online(int msg_type, struct process_id src, void *buf, size_t len) +static void child_msg_online(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { struct winbindd_domain *domain; const char *domainname = (const char *)buf; @@ -739,7 +744,8 @@ static const char *collect_onlinestatus(TALLOC_CTX *mem_ctx) return buf; } -static void child_msg_onlinestatus(int msg_type, struct process_id src, void *buf, size_t len) +static void child_msg_onlinestatus(int msg_type, struct process_id src, + void *buf, size_t len, void *private_data) { TALLOC_CTX *mem_ctx; const char *message; @@ -843,9 +849,10 @@ static BOOL fork_domain_child(struct winbindd_child *child) message_unblock(); /* Handle online/offline messages. */ - message_register(MSG_WINBIND_OFFLINE,child_msg_offline); - message_register(MSG_WINBIND_ONLINE,child_msg_online); - message_register(MSG_WINBIND_ONLINESTATUS,child_msg_onlinestatus); + message_register(MSG_WINBIND_OFFLINE, child_msg_offline, NULL); + message_register(MSG_WINBIND_ONLINE, child_msg_online, NULL); + message_register(MSG_WINBIND_ONLINESTATUS, child_msg_onlinestatus, + NULL); if ( child->domain ) { child->domain->startup = True; -- cgit