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

« back to all changes in this revision

Viewing changes to ntpd/ntp_filegen.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:
13
13
 */
14
14
 
15
15
#ifdef HAVE_CONFIG_H
16
 
#include <config.h>
 
16
# include <config.h>
17
17
#endif
18
18
 
19
19
#include <stdio.h>
55
55
static  FILEGEN *filegen_unregister P((char *));
56
56
#endif  /* UNUSED */
57
57
 
 
58
static void     filegen_init    P((char *, const char *, FILEGEN *));
 
59
 
 
60
/*
 
61
 * filegen_init
 
62
 */
 
63
 
 
64
static void
 
65
filegen_init(char *prefix, const char *basename, FILEGEN *fp)
 
66
{
 
67
        fp->fp       = NULL;
 
68
        fp->prefix   = prefix;          /* Yes, this is TOTALLY lame! */
 
69
        fp->basename = (char*)emalloc(strlen(basename) + 1);
 
70
        strcpy(fp->basename, basename);
 
71
        fp->id       = 0;
 
72
        fp->type     = FILEGEN_DAY;
 
73
        fp->flag     = FGEN_FLAG_LINK; /* not yet enabled !!*/
 
74
}
 
75
 
 
76
 
58
77
/*
59
78
 * open a file generation according to the current settings of gen
60
79
 * will also provide a link to basename if requested to do so
169
188
                                        free(savename);
170
189
                                } else {
171
190
                                        /*
172
 
                                         * there is at least a second link tpo this file
 
191
                                         * there is at least a second link to
 
192
                                         * this file.
173
193
                                         * just remove the conflicting one
174
194
                                         */
175
195
                                        if (
335
355
         * reopen new file generation file on change of generation id
336
356
         */
337
357
        if (gen->fp == NULL || gen->id != new_gen) {
 
358
#if DEBUG
 
359
        if (debug)
 
360
                printf("filegen  %0x %lu %lu %lu\n", gen->type, now,
 
361
                    gen->id, new_gen); 
 
362
#endif
338
363
                filegen_open(gen, new_gen);
339
364
        }
340
365
}
477
502
 
478
503
void
479
504
filegen_register(
 
505
        char *prefix,
480
506
        const char *name,
481
507
        FILEGEN *filegen
482
508
        )
487
513
        if (debug > 3)
488
514
            printf("filegen_register(\"%s\",%x)\n", name, (u_int)filegen);
489
515
#endif
 
516
 
 
517
        filegen_init(prefix, name, filegen);
 
518
 
490
519
        while (*f) {
491
520
                if ((*f)->name == name || strcmp(name, (*f)->name) == 0) {
492
521
#ifdef XXX       /* this gives the Alpha compiler fits */