~ubuntu-branches/ubuntu/lucid/ntp/lucid

« back to all changes in this revision

Viewing changes to ntpd/ntp_config.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-04-29 06:08:19 UTC
  • mfrom: (4.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090429060819-ejgcea6z6hy6xv1f
Tags: 1:4.2.4p6+dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/ntp.conf, debian/ntpdate.default: Change default server to
    ntp.ubuntu.com.
  - debian/ntpdate.ifup: Stop ntp before running ntpdate when an interface 
    comes up, then start again afterwards
  - debian/ntp.init, debian/rules: Only stop when entering single user mode.
  - debian/man/ntpdate.8 - fix debian shipped manpage; patch by
    Josh Holland <jrh@joshh.co.uk>
* Dropped changes, merged in Debian:
  - Build against libcap2 instead of libcap1, fixing a kernel warning
    about using an old interface.
* Dropped changes, superseded upstream/in Debian:
  - debian/patches/CVE-2009-0021.patch: update ntpd/ntp_crypto.c to properly
    check the return code of EVP_VerifyFinal()
  - debian/patches/ipv6-gnu-source.patch: Define _GNU_SOURCE to make IPv6
    work.
* Fixes LP: #217699

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
#ifdef SYS_WINNT
38
38
# include <io.h>
39
 
HANDLE ResolverThreadHandle = NULL;
 
39
static HANDLE ResolverThreadHandle = NULL;
 
40
HANDLE ResolverEventHandle;
 
41
#else
 
42
int resolver_pipe_fd[2];  /* used to let the resolver process alert the parent process */
40
43
#endif /* SYS_WINNT */
41
44
 
42
45
/*
810
813
                                    peerflags |= FLAG_IBURST;
811
814
                                    break;
812
815
 
813
 
                                case CONF_MOD_DYNAMIC:
814
 
                                    peerflags |= FLAG_DYNAMIC;
 
816
                                case CONF_MOD_DYNAMIC:
 
817
                                    msyslog(LOG_WARNING, 
 
818
                                        "Warning: the \"dynamic\" keyword has been obsoleted"
 
819
                                        " and will be removed in the next release\n");
815
820
                                    break;
816
821
 
817
822
#ifdef OPENSSL
2432
2437
        (void) signal_no_reset(SIGCHLD, catchchild);
2433
2438
 
2434
2439
#ifndef SYS_VXWORKS
 
2440
        /* the parent process will write to the pipe
 
2441
         * in order to wake up to child process
 
2442
         * which may be waiting in a select() call
 
2443
         * on the read fd */
 
2444
        if (pipe(resolver_pipe_fd) < 0) {
 
2445
                msyslog(LOG_ERR,
 
2446
                        "unable to open resolver pipe");
 
2447
                exit(1);
 
2448
        }
 
2449
 
2435
2450
        i = fork();
 
2451
        /* Shouldn't the code below be re-ordered?
 
2452
         * I.e. first check if the fork() returned an error, then
 
2453
         * check whether we're parent or child.
 
2454
         *     Martin Burnicki
 
2455
         */
2436
2456
        if (i == 0) {
2437
2457
                /*
2438
2458
                 * this used to close everything
2467
2487
                 * THUS:
2468
2488
                 */
2469
2489
 
 
2490
                /* This is the child process who will read the pipe,
 
2491
                 * so we close the write fd */
 
2492
                close(resolver_pipe_fd[1]);
2470
2493
                closelog();
2471
2494
                kill_asyncio(0);
2472
2495
 
2515
2538
                (void) signal_no_reset(SIGCHLD, SIG_DFL);
2516
2539
                abort_resolve();
2517
2540
        }
 
2541
        else {
 
2542
                /* This is the parent process who will write to the pipe,
 
2543
                 * so we close the read fd */
 
2544
                close(resolver_pipe_fd[0]);
 
2545
        }
2518
2546
#else /* SYS_WINNT */
2519
2547
        {
2520
2548
                /* NT's equivalent of fork() is _spawn(), but the start point
2523
2551
                 */
2524
2552
                DWORD dwThreadId;
2525
2553
                fflush(stdout);
 
2554
                ResolverEventHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
 
2555
                if (ResolverEventHandle == NULL) {
 
2556
                        msyslog(LOG_ERR, "Unable to create resolver event object, can't start ntp_intres");
 
2557
                        abort_resolve();
 
2558
                }
2526
2559
                ResolverThreadHandle = CreateThread(
2527
2560
                        NULL,                            /* no security attributes      */
2528
2561
                        0,                               /* use default stack size      */
2532
2565
                        &dwThreadId);                    /* returns the thread identifier */
2533
2566
                if (ResolverThreadHandle == NULL) {
2534
2567
                        msyslog(LOG_ERR, "CreateThread() failed, can't start ntp_intres");
 
2568
                        CloseHandle(ResolverEventHandle);
 
2569
                        ResolverEventHandle = NULL;
2535
2570
                        abort_resolve();
2536
2571
                }
2537
2572
        }