struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
struct timeval *to_ret);
int event_loop_once(struct event_context *ev);
+void event_context_reinit(struct event_context *ev);
struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
int set_event_dispatch_time(struct event_context *event_ctx,
const char *event_name, struct timeval when);
void smb_msleep(unsigned int t);
void become_daemon(bool Fork, bool no_process_group);
bool reinit_after_fork(struct messaging_context *msg_ctx,
+ struct event_context *ev_ctx,
bool parent_longlived);
bool yesno(const char *p);
void *malloc_(size_t size);
return 0;
}
+void event_context_reinit(struct event_context *ev)
+{
+ event_context_destructor(ev);
+ return;
+}
+
struct event_context *event_context_init(TALLOC_CTX *mem_ctx)
{
struct event_context *result;
}
bool reinit_after_fork(struct messaging_context *msg_ctx,
+ struct event_context *ev_ctx,
bool parent_longlived)
{
NTSTATUS status;
return false;
}
+ event_context_reinit(ev_ctx);
+
return true;
}
CatchSignal(SIGHUP, SIG_IGN);
CatchSignal(SIGTERM, SIGNAL_CAST sig_term );
- if (!reinit_after_fork(nmbd_messaging_context(), true)) {
+ if (!reinit_after_fork(nmbd_messaging_context(),
+ nmbd_event_context(), true)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
pidfile_create("nmbd");
- if (!reinit_after_fork(nmbd_messaging_context(), false)) {
+ if (!reinit_after_fork(nmbd_messaging_context(),
+ nmbd_event_context(), false)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
}
/* Child. */
- if (!reinit_after_fork(smbd_messaging_context(), true)) {
+ if (!reinit_after_fork(smbd_messaging_context(),
+ smbd_event_context(), true)) {
DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
}
close(pause_pipe[0]);
pause_pipe[0] = -1;
- if (!reinit_after_fork(smbd_messaging_context(), true)) {
+ if (!reinit_after_fork(smbd_messaging_context(),
+ smbd_event_context(), true)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
false);
if (!reinit_after_fork(
- smbd_messaging_context(), true)) {
+ smbd_messaging_context(),
+ smbd_event_context(),
+ true)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
}
if (is_daemon)
pidfile_create("smbd");
- if (!reinit_after_fork(smbd_messaging_context(), false)) {
+ if (!reinit_after_fork(smbd_messaging_context(),
+ smbd_event_context(), false)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
TimeInit();
- if (!reinit_after_fork(winbind_messaging_context(), false)) {
+ if (!reinit_after_fork(winbind_messaging_context(),
+ winbind_event_context(), false)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
/* Leave messages blocked - we will never process one. */
- if (!reinit_after_fork(winbind_messaging_context(), true)) {
+ if (!reinit_after_fork(winbind_messaging_context(),
+ winbind_event_context(), true)) {
DEBUG(0,("reinit_after_fork() failed\n"));
messaging_send_buf(winbind_messaging_context(),
pid_to_procid(parent_pid),
state.sock = fdpair[0];
close(fdpair[1]);
- if (!reinit_after_fork(winbind_messaging_context(), true)) {
+ if (!reinit_after_fork(winbind_messaging_context(),
+ winbind_event_context(), true)) {
DEBUG(0,("reinit_after_fork() failed\n"));
_exit(0);
}
messaging_register(winbind_messaging_context(), NULL,
MSG_DEBUG, debug_message);
+ primary_domain = find_our_domain();
+
+ if (primary_domain == NULL) {
+ smb_panic("no primary domain found");
+ }
+ /* we have destroy all time event in reinit_after_fork()
+ * set check_online_event to NULL */
+ for (domain = domain_list(); domain; domain = domain->next) {
+ domain->check_online_event = NULL;
+ }
+ /* It doesn't matter if we allow cache login,
+ * try to bring domain online after fork. */
if ( child->domain ) {
child->domain->startup = True;
child->domain->startup_time = time(NULL);
- }
-
- /* Ensure we have no pending check_online events other
- than one for this domain or the primary domain. */
-
- for (domain = domain_list(); domain; domain = domain->next) {
- if (domain->primary) {
- primary_domain = domain;
- }
- if ((domain != child->domain) && !domain->primary) {
- TALLOC_FREE(domain->check_online_event);
+ /* we can be in primary domain or in trusted domain
+ * If we are in trusted domain, set the primary domain
+ * in start-up mode */
+ if (!(child->domain->internal)) {
+ set_domain_online_request(child->domain);
+ if (!(child->domain->primary)) {
+ primary_domain->startup = True;
+ primary_domain->startup_time = time(NULL);
+ set_domain_online_request(primary_domain);
+ }
}
}
- if (primary_domain == NULL) {
- smb_panic("no primary domain found");
- }
-
/* Ensure we're not handling an event inherited from
our parent. */