]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
sntp: tweak key file logging.
authorHarlan Stenn <stenn@ntp.org>
Wed, 13 Dec 2017 10:14:15 +0000 (02:14 -0800)
committerHarlan Stenn <stenn@ntp.org>
Wed, 13 Dec 2017 10:14:15 +0000 (02:14 -0800)
bk: 5a30fd77pdd9QUUbyD7vy1wtZ1e2ew

ChangeLog
sntp/crypto.c
sntp/main.c

index 5a4f576e0113bf5de852a8f3b5e1d40baabb76c1..16e294c5383632f2694ac3e97595f17a0cc27cc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,7 @@
 * Build ntpq and libntpq.a with NTP_HARD_*FLAGS.  perlinger@ntp.org
 * Fix bug in the override portion of the compiler hardening macro. HStenn.
 * record_raw_stats(): Log entire packet.  Log writes.  HStenn.
+* sntp: tweak key file logging.  HStenn.
 
 ---
 (4.2.8p10) 2017/03/21 Released by Harlan Stenn <stenn@ntp.org>
index 3cfaf5e268ee93cb59232984ac12fe2cd2fd95ce..fd2c251670caa5c6a59202bcd36b875650280d48 100644 (file)
@@ -108,7 +108,7 @@ auth_init(
 {
        FILE *keyf = fopen(keyfile, "r"); 
        struct key *prev = NULL;
-       int scan_cnt, line_cnt = 0;
+       int scan_cnt, line_cnt = 1;
        char kbuf[200];
        char keystring[129];
 
@@ -164,8 +164,12 @@ auth_init(
                                }
                        }
                        act->typei = keytype_from_text(act->typen, NULL);
-                       if (0 == act->typei)
+                       if (0 == act->typei) {
+                               printf("%s: line %d: key %d, %s not supported - ignoring\n",
+                                       keyfile, line_cnt,
+                                       act->key_id, act->typen);
                                goodline = 0; /* it's bad */
+                       }
                }
                if (goodline) {
                        act->next = NULL;
@@ -176,8 +180,10 @@ auth_init(
                        prev = act;
                        key_cnt++;
                } else {
-                       msyslog(LOG_DEBUG, "auth_init: scanf %d items, skipping line %d.",
-                               scan_cnt, line_cnt);
+                       if (debug) {
+                               printf("auth_init: scanf %d items, skipping line %d.",
+                                       scan_cnt, line_cnt);
+                       }
                        free(act);
                }
                line_cnt++;
index 7aed69f7c73e71b2be2e5646f3f0849d6ba3eb19..098a696945c280bdce07fe07461a5aa27b5b4088 100644 (file)
@@ -378,7 +378,6 @@ handle_lookup(
 {
        struct addrinfo hints;  /* Local copy is OK */
        struct dns_ctx *ctx;
-       long            l;
        char *          name_copy;
        size_t          name_sz;
        size_t          octets;
@@ -411,7 +410,7 @@ handle_lookup(
                ctx->key_id = OPT_VALUE_AUTHENTICATION;
                get_key(ctx->key_id, &ctx->key);
                if (NULL == ctx->key) {
-                       fprintf(stderr, "%s: Authentication with keyID %d requested, but no matching keyID found in <%s>!",
+                       fprintf(stderr, "%s: Authentication with keyID %d requested, but no matching keyID found in <%s>!\n",
                                progname, ctx->key_id, OPT_ARG(KEYFILE));
                        exit(1);
                }