From: Harlan Stenn Date: Wed, 13 Dec 2017 10:14:15 +0000 (-0800) Subject: sntp: tweak key file logging. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9de2494147623409491080e6e5c3e1c475a60ff;p=thirdparty%2Fntp.git sntp: tweak key file logging. bk: 5a30fd77pdd9QUUbyD7vy1wtZ1e2ew --- diff --git a/ChangeLog b/ChangeLog index 5a4f576e0..16e294c53 100644 --- 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 diff --git a/sntp/crypto.c b/sntp/crypto.c index 3cfaf5e26..fd2c25167 100644 --- a/sntp/crypto.c +++ b/sntp/crypto.c @@ -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++; diff --git a/sntp/main.c b/sntp/main.c index 7aed69f7c..098a69694 100644 --- a/sntp/main.c +++ b/sntp/main.c @@ -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); }