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;

	DEBUG(10,("winbind_msg_offline: got offline message.\n"));

	if (!lp_winbind_offline_logon()) {
		DEBUG(10,("winbind_msg_offline: rejecting offline message.\n"));
		return;
	}

	/* Set our global state as offline. */
	if (!set_global_winbindd_state_offline()) {
		DEBUG(10,("winbind_msg_offline: offline request failed.\n"));
		return;
	}

	/* Set all our domains as offline. */
	for (domain = domain_list(); domain; domain = domain->next) {
		if (domain->internal) {
			continue;
		}
		DEBUG(5,("winbind_msg_offline: marking %s offline.\n", domain->name));
		set_domain_offline(domain);

		/* Send an offline message to the idmap child when our
		   primary domain goes offline */

		if ( domain->primary ) {
			struct winbindd_child *idmap = idmap_child();

			if ( idmap->pid != 0 ) {
				message_send_pid(pid_to_procid(idmap->pid), 
						 MSG_WINBIND_OFFLINE, 
						 domain->name, 
						 strlen(domain->name)+1, 
						 False);
			}			
		}
	}

	for (child = children; child != NULL; child = child->next) {
		/* Don't send message to idmap child.  We've already
		   done so above. */
		if (!child->domain || (child == idmap_child())) {
			continue;
		}

		/* Or internal domains (this should not be possible....) */
		if (child->domain->internal) {
			continue;
		}

		/* Each winbindd child should only process requests for one domain - make sure
		   we only set it online / offline for that domain. */

		DEBUG(10,("winbind_msg_offline: sending message to pid %u for domain %s.\n",
			(unsigned int)child->pid, domain->name ));

		message_send_pid(pid_to_procid(child->pid), MSG_WINBIND_OFFLINE, child->domain->name,
			strlen(child->domain->name)+1, False);
	}
}
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;

	DEBUG(10,("winbind_msg_offline: got offline message.\n"));

	if (!lp_winbind_offline_logon()) {
		DEBUG(10,("winbind_msg_offline: rejecting offline message.\n"));
		return;
	}

	 
	if (!set_global_winbindd_state_offline()) {
		DEBUG(10,("winbind_msg_offline: offline request failed.\n"));
		return;
	}

	 
	for (domain = domain_list(); domain; domain = domain->next) {
		if (domain->internal) {
			continue;
		}
		DEBUG(5,("winbind_msg_offline: marking %s offline.\n", domain->name));
		set_domain_offline(domain);

		 

		if ( domain->primary ) {
			struct winbindd_child *idmap = idmap_child();

			if ( idmap->pid != 0 ) {
				message_send_pid(pid_to_procid(idmap->pid), 
						 MSG_WINBIND_OFFLINE, 
						 domain->name, 
						 strlen(domain->name)+1, 
						 False);
			}			
		}
	}

	for (child = children; child != NULL; child = child->next) {
		 
		if (!child->domain || (child == idmap_child())) {
			continue;
		}

		 
		if (child->domain->internal) {
			continue;
		}

		 

		DEBUG(10,("winbind_msg_offline: sending message to pid %u for domain %s.\n",
			(unsigned int)child->pid, domain->name ));

		message_send_pid(pid_to_procid(child->pid), MSG_WINBIND_OFFLINE, child->domain->name,
			strlen(child->domain->name)+1, False);
	}
}