summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-16 14:45:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:10 -0500
commit0570ce21ffd6c2a52bf701cd72fbb66ed7b3eb3e (patch)
tree2db422bf692d886547587308842e2ceebc6475bb
parent81acb2d8051544f3ca9cfdfb964a7560dfad6105 (diff)
downloadsamba-0570ce21ffd6c2a52bf701cd72fbb66ed7b3eb3e.tar.gz
samba-0570ce21ffd6c2a52bf701cd72fbb66ed7b3eb3e.tar.bz2
samba-0570ce21ffd6c2a52bf701cd72fbb66ed7b3eb3e.zip
r22943: More message_register -> messaging_register
(This used to be commit caece8975b0c2bad56d6a6a576bf8ce54626183f)
-rw-r--r--source3/nsswitch/winbindd.c34
-rw-r--r--source3/nsswitch/winbindd_cm.c32
-rw-r--r--source3/nsswitch/winbindd_dual.c96
3 files changed, 102 insertions, 60 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index f4405981d2..e73fe79b1e 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -182,8 +182,11 @@ 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 server_id src,
- void *buf, size_t len, void *private_data)
+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();
@@ -191,8 +194,11 @@ static void msg_reload_services(int msg_type, struct server_id src,
}
/* React on 'smbcontrol winbindd shutdown' in the same way as on SIGTERM*/
-static void msg_shutdown(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+static void msg_shutdown(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
do_sigterm = True;
}
@@ -883,7 +889,9 @@ static int process_loop(int listen_sock, int listen_priv_sock)
DEBUG(3, ("got SIGHUP\n"));
- msg_reload_services(MSG_SMB_CONF_UPDATED, pid_to_procid(0), NULL, 0, NULL);
+ flush_caches();
+ reload_services_file();
+
do_sighup = False;
}
@@ -1137,14 +1145,18 @@ 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, NULL);
- message_register(MSG_SHUTDOWN, msg_shutdown, NULL);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_SMB_CONF_UPDATED, msg_reload_services);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_SHUTDOWN, msg_shutdown);
/* Handle online/offline messages. */
- 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);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_OFFLINE, winbind_msg_offline);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_ONLINE, winbind_msg_online);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus);
poptFreeContext(pc);
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index e547d6d54d..ec1531ac3d 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -82,13 +82,16 @@ 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 server_id src,
- void *buf, size_t len, void *private_data)
+static void msg_failed_to_go_online(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_domain *domain;
- const char *domainname = (const char *)buf;
+ const char *domainname = (const char *)data->data;
- if (buf == NULL || len == 0) {
+ if (data->data == NULL || data->length == 0) {
return;
}
@@ -118,13 +121,16 @@ static void msg_failed_to_go_online(int msg_type, struct server_id src,
Actually cause a reconnect from a message.
****************************************************************/
-static void msg_try_to_go_online(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+static void msg_try_to_go_online(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_domain *domain;
- const char *domainname = (const char *)buf;
+ const char *domainname = (const char *)data->data;
- if (buf == NULL || len == 0) {
+ if (data->data == NULL || data->length == 0) {
return;
}
@@ -184,10 +190,12 @@ 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, NULL);
- message_register(MSG_WINBIND_FAILED_TO_GO_ONLINE,
- msg_failed_to_go_online, NULL);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_TRY_TO_GO_ONLINE,
+ msg_try_to_go_online);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_FAILED_TO_GO_ONLINE,
+ msg_failed_to_go_online);
message_unblock();
return True;
}
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
index ec6a32c445..e89ae771c1 100644
--- a/source3/nsswitch/winbindd_dual.c
+++ b/source3/nsswitch/winbindd_dual.c
@@ -478,8 +478,11 @@ 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 server_id src,
- void *buf, size_t len, void *private_data)
+void winbind_msg_offline(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_child *child;
struct winbindd_domain *domain;
@@ -524,8 +527,7 @@ void winbind_msg_offline(int msg_type, struct server_id src,
DEBUG(10,("winbind_msg_offline: sending message to pid %u for domain %s.\n",
(unsigned int)child->pid, domain->name ));
- messaging_send_buf(winbind_messaging_context(),
- pid_to_procid(child->pid),
+ messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
MSG_WINBIND_OFFLINE,
(uint8 *)child->domain->name,
strlen(child->domain->name)+1);
@@ -534,8 +536,11 @@ void winbind_msg_offline(int msg_type, struct server_id src,
/* Set our domains as online and forward the online message to our children. */
-void winbind_msg_online(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+void winbind_msg_online(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_child *child;
struct winbindd_domain *domain;
@@ -570,7 +575,7 @@ void winbind_msg_online(int msg_type, struct server_id src,
struct winbindd_child *idmap = idmap_child();
if ( idmap->pid != 0 ) {
- messaging_send_buf(winbind_messaging_context(),
+ messaging_send_buf(msg_ctx,
pid_to_procid(idmap->pid),
MSG_WINBIND_ONLINE,
(uint8 *)domain->name,
@@ -597,8 +602,7 @@ void winbind_msg_online(int msg_type, struct server_id src,
DEBUG(10,("winbind_msg_online: sending message to pid %u for domain %s.\n",
(unsigned int)child->pid, child->domain->name ));
- messaging_send_buf(winbind_messaging_context(),
- pid_to_procid(child->pid),
+ messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
MSG_WINBIND_ONLINE,
(uint8 *)child->domain->name,
strlen(child->domain->name)+1);
@@ -606,8 +610,11 @@ void winbind_msg_online(int msg_type, struct server_id src,
}
/* Forward the online/offline messages to our children. */
-void winbind_msg_onlinestatus(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+void winbind_msg_onlinestatus(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_child *child;
@@ -618,10 +625,10 @@ void winbind_msg_onlinestatus(int msg_type, struct server_id src,
DEBUG(10,("winbind_msg_onlinestatus: "
"sending message to pid %u of primary domain.\n",
(unsigned int)child->pid));
- messaging_send_buf(winbind_messaging_context(),
- pid_to_procid(child->pid),
+ messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
MSG_WINBIND_ONLINESTATUS,
- (uint8 *)buf, len);
+ (uint8 *)data->data,
+ data->length);
break;
}
}
@@ -679,13 +686,16 @@ 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 server_id src,
- void *buf, size_t len, void *private_data)
+static void child_msg_offline(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_domain *domain;
- const char *domainname = (const char *)buf;
+ const char *domainname = (const char *)data->data;
- if (buf == NULL || len == 0) {
+ if (data->data == NULL || data->length == 0) {
return;
}
@@ -711,13 +721,16 @@ static void child_msg_offline(int msg_type, struct server_id src,
/* Deal with a request to go online. */
-static void child_msg_online(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+static void child_msg_online(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
struct winbindd_domain *domain;
- const char *domainname = (const char *)buf;
+ const char *domainname = (const char *)data->data;
- if (buf == NULL || len == 0) {
+ if (data->data == NULL || data->length == 0) {
return;
}
@@ -773,8 +786,11 @@ static const char *collect_onlinestatus(TALLOC_CTX *mem_ctx)
return buf;
}
-static void child_msg_onlinestatus(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+static void child_msg_onlinestatus(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
TALLOC_CTX *mem_ctx;
const char *message;
@@ -782,11 +798,11 @@ static void child_msg_onlinestatus(int msg_type, struct server_id src,
DEBUG(5,("winbind_msg_onlinestatus received.\n"));
- if (!buf) {
+ if (!data->data) {
return;
}
- sender = (struct server_id *)buf;
+ sender = (struct server_id *)data->data;
mem_ctx = talloc_init("winbind_msg_onlinestatus");
if (mem_ctx == NULL) {
@@ -799,8 +815,7 @@ static void child_msg_onlinestatus(int msg_type, struct server_id src,
return;
}
- messaging_send_buf(winbind_messaging_context(),
- *sender, MSG_WINBIND_ONLINESTATUS,
+ messaging_send_buf(msg_ctx, *sender, MSG_WINBIND_ONLINESTATUS,
(uint8 *)message, strlen(message) + 1);
talloc_destroy(mem_ctx);
@@ -869,20 +884,27 @@ static BOOL fork_domain_child(struct winbindd_child *child)
}
/* Don't handle the same messages as our parent. */
- message_deregister(MSG_SMB_CONF_UPDATED);
- message_deregister(MSG_SHUTDOWN);
- message_deregister(MSG_WINBIND_OFFLINE);
- message_deregister(MSG_WINBIND_ONLINE);
- message_deregister(MSG_WINBIND_ONLINESTATUS);
+ messaging_deregister(winbind_messaging_context(),
+ MSG_SMB_CONF_UPDATED, NULL);
+ messaging_deregister(winbind_messaging_context(),
+ MSG_SHUTDOWN, NULL);
+ messaging_deregister(winbind_messaging_context(),
+ MSG_WINBIND_OFFLINE, NULL);
+ messaging_deregister(winbind_messaging_context(),
+ MSG_WINBIND_ONLINE, NULL);
+ messaging_deregister(winbind_messaging_context(),
+ MSG_WINBIND_ONLINESTATUS, NULL);
/* The child is ok with online/offline messages now. */
message_unblock();
/* Handle online/offline messages. */
- 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);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_OFFLINE, child_msg_offline);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_ONLINE, child_msg_online);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_ONLINESTATUS, child_msg_onlinestatus);
if ( child->domain ) {
child->domain->startup = True;