}
/* 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();
}
/* 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;
}
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;
}
/* 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);
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;
}
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;
}
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;
}
/* 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;
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);
/* 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;
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,
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);
}
/* 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;
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;
}
}
/* 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;
}
/* 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;
}
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;
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) {
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);
}
/* 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;