From 306465a5a4571cabe5c1c61224873471910b94b6 Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Fri, 10 Sep 2010 21:36:20 +0200 Subject: s3/winbind: use mono time for startup timeout check --- source3/winbindd/winbindd.h | 2 +- source3/winbindd/winbindd_cm.c | 4 ++-- source3/winbindd/winbindd_dual.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index d7a53e2d66..1ba24b5d0a 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -157,7 +157,7 @@ struct winbindd_domain { bool primary; /* is this our primary domain ? */ bool internal; /* BUILTIN and member SAM */ bool online; /* is this domain available ? */ - time_t startup_time; /* When we set "startup" true. */ + time_t startup_time; /* When we set "startup" true. monotonic clock */ bool startup; /* are we in the first 30 seconds after startup_time ? */ bool can_do_samlogon_ex; /* Due to the lack of finer control what type diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 8f94b29640..4ab2d94aa6 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -291,7 +291,7 @@ static void check_domain_online_handler(struct event_context *ctx, /* Are we still in "startup" mode ? */ - if (domain->startup && (now.tv_sec > domain->startup_time + 30)) { + if (domain->startup && (time_mono(NULL) > domain->startup_time + 30)) { /* No longer in "startup" mode. */ DEBUG(10,("check_domain_online_handler: domain %s no longer in 'startup' mode.\n", domain->name )); @@ -508,7 +508,7 @@ void set_domain_online_request(struct winbindd_domain *domain) GetTimeOfDay(&tev); /* Go into "startup" mode again. */ - domain->startup_time = tev.tv_sec; + domain->startup_time = time_mono(NULL); domain->startup = True; tev.tv_sec += 5; diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index f78ae2d711..4cec7c2a1a 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -1306,7 +1306,7 @@ static bool fork_domain_child(struct winbindd_child *child) * try to bring domain online after fork. */ if ( child->domain ) { child->domain->startup = True; - child->domain->startup_time = time(NULL); + child->domain->startup_time = time_mono(NULL); /* we can be in primary domain or in trusted domain * If we are in trusted domain, set the primary domain * in start-up mode */ @@ -1314,7 +1314,7 @@ static bool fork_domain_child(struct winbindd_child *child) set_domain_online_request(child->domain); if (!(child->domain->primary)) { primary_domain->startup = True; - primary_domain->startup_time = time(NULL); + primary_domain->startup_time = time_mono(NULL); set_domain_online_request(primary_domain); } } @@ -1389,7 +1389,7 @@ static bool fork_domain_child(struct winbindd_child *child) GetTimeOfDay(&now); if (child->domain && child->domain->startup && - (now.tv_sec > child->domain->startup_time + 30)) { + (time_mono(NULL) > child->domain->startup_time + 30)) { /* No longer in "startup" mode. */ DEBUG(10,("fork_domain_child: domain %s no longer in 'startup' mode.\n", child->domain->name )); -- cgit