~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to ntpd/ntp_timer.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-01-05 21:10:03 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090105211003-mh6zc3um4k1uhsj7
Tags: 1:4.2.4p4+dfsg-8
It did not properly check the return value of EVP_VerifyFinal
which results in an malformed DSA signature being treated as
a good signature rather than as an error.  (CVE-2009-0021)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 * procedure to do cleanup and print a message.
35
35
 */
36
36
 
 
37
volatile int interface_interval = 300;     /* update interface every 5 minutes as default */
 
38
          
37
39
/*
38
40
 * Alarm flag.  The mainline code imports this.
39
41
 */
44
46
 */
45
47
static  u_long adjust_timer;            /* second timer */
46
48
static  u_long keys_timer;              /* minute timer */
47
 
static  u_long hourly_timer;            /* hour timer */
 
49
static  u_long stats_timer;             /* stats timer */
48
50
static  u_long huffpuff_timer;          /* huff-n'-puff timer */
 
51
static  u_long interface_timer;         /* interface update timer */
49
52
#ifdef OPENSSL
50
53
static  u_long revoke_timer;            /* keys revoke timer */
51
54
u_char  sys_revoke = KEY_REVOKE;        /* keys revoke timeout (log2 s) */
138
141
init_timer(void)
139
142
{
140
143
# if defined SYS_WINNT & !defined(SYS_CYGWIN32)
141
 
        HANDLE hToken;
 
144
        HANDLE hToken = INVALID_HANDLE_VALUE;
142
145
        TOKEN_PRIVILEGES tkp;
143
146
# endif /* SYS_WINNT */
144
147
 
148
151
        alarm_flag = 0;
149
152
        alarm_overflow = 0;
150
153
        adjust_timer = 1;
151
 
        hourly_timer = HOUR;
 
154
        stats_timer = 0;
152
155
        huffpuff_timer = 0;
 
156
        interface_timer = 0;
153
157
        current_time = 0;
154
158
        timer_overflows = 0;
155
159
        timer_xmtcalls = 0;
269
273
                adjust_timer += 1;
270
274
                adj_host_clock();
271
275
                kod_proto();
 
276
#ifdef REFCLOCK
 
277
                for (n = 0; n < NTP_HASH_SIZE; n++) {
 
278
                        for (peer = peer_hash[n]; peer != 0; peer = next_peer) {
 
279
                                next_peer = peer->next;
 
280
                                if (peer->flags & FLAG_REFCLOCK)
 
281
                                        refclock_timer(peer);
 
282
                        }
 
283
                }
 
284
#endif /* REFCLOCK */
272
285
        }
273
286
 
274
287
        /*
327
340
#endif /* OPENSSL */
328
341
 
329
342
        /*
330
 
         * Finally, call the hourly routine.
331
 
         */
332
 
        if (hourly_timer <= current_time) {
333
 
                hourly_timer += HOUR;
334
 
                hourly_stats();
 
343
         * interface update timer
 
344
         */
 
345
        if (interface_interval && interface_timer <= current_time) {
 
346
                timer_interfacetimeout(current_time + interface_interval);
 
347
#ifdef DEBUG
 
348
          if (debug)
 
349
            printf("timer: interface update\n");
 
350
#endif
 
351
          interface_update(NULL, NULL);
 
352
        }
 
353
        
 
354
        /*
 
355
         * Finally, periodically write stats.
 
356
         */
 
357
        if (stats_timer <= current_time) {
 
358
             if (stats_timer != 0)
 
359
                  write_stats();
 
360
             stats_timer += stats_write_period;
335
361
        }
336
362
}
337
363
 
363
389
}
364
390
#endif /* SYS_WINNT */
365
391
 
 
392
void
 
393
timer_interfacetimeout(u_long timeout)
 
394
{
 
395
        interface_timer = timeout;
 
396
}
 
397
 
366
398
 
367
399
/*
368
400
 * timer_clr_stats - clear timer module stat counters