s3/winbind: use mono time for startup timeout check
authorBjörn Jacke <bj@sernet.de>
Fri, 10 Sep 2010 19:36:20 +0000 (21:36 +0200)
committerBjörn Jacke <bj@sernet.de>
Fri, 10 Sep 2010 21:10:26 +0000 (23:10 +0200)
source3/winbindd/winbindd.h
source3/winbindd/winbindd_cm.c
source3/winbindd/winbindd_dual.c

index d7a53e2d6649ff409b30d0420858d080ba9986ed..1ba24b5d0a6ed6ce0b113920486e3e677ba70277 100644 (file)
@@ -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
index 8f94b29640da4b4372883c502d28ef2f8bf708ef..4ab2d94aa65a9c5ba8355a1a2e7cf026fd32f650 100644 (file)
@@ -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;
index f78ae2d711729a35807c5f7d96c6530e65e69672..4cec7c2a1a8f29db1b4755e3f612bd26a302afd6 100644 (file)
@@ -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 ));