From: Libor Peltan Date: Mon, 17 Dec 2018 19:23:16 +0000 (+0100) Subject: offline_ksk: human readable timestamps in ksr and skr X-Git-Tag: v2.8.0~138^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b2428a79c8dc2191ab63ee0029960f267acb3fd;p=thirdparty%2Fknot-dns.git offline_ksk: human readable timestamps in ksr and skr --- diff --git a/src/utils/keymgr/offline_ksk.c b/src/utils/keymgr/offline_ksk.c index 2bc55c0783..959776592b 100644 --- a/src/utils/keymgr/offline_ksk.c +++ b/src/utils/keymgr/offline_ksk.c @@ -180,6 +180,14 @@ static void print_generated_message(void) printf("generated at %s by Knot DNS %s\n", buf, VERSION); } +static void print_header(const char *of_what, knot_time_t timestamp, const char *contents) +{ + char date[64] = { 0 }; + (void)knot_time_print(TIME_PRINT_ISO8601, timestamp, date, sizeof(date)); + printf(";; %s %s %"PRIu64" (%s) =========\n%s", of_what, KSR_SKR_VER, + timestamp, date, contents); +} + static int ksr_once(kdnssec_ctx_t *ctx, char **buf, size_t *buf_size, knot_time_t *next_ksr) { knot_rrset_t *dnskey = NULL; @@ -190,8 +198,7 @@ static int ksr_once(kdnssec_ctx_t *ctx, char **buf, size_t *buf_size, knot_time_ } ret = dump_rrset_to_buf(dnskey, buf, buf_size); if (ret >= 0) { - printf(";; KeySigningRequest %s %"PRIu64" ===========\n%s", - KSR_SKR_VER, ctx->now, *buf); + print_header("KeySigningRequest", ctx->now, *buf); ret = KNOT_EOK; } @@ -278,8 +285,7 @@ static int ksr_sign_dnskey(kdnssec_ctx_t *ctx, knot_rrset_t *zsk, knot_time_t no } ret = key_records_dump(&buf, &buf_size, &r, true); if (ret == KNOT_EOK) { - printf(";; SignedKeyResponse %s %"PRIu64" ===========\n%s", - KSR_SKR_VER, ctx->now, buf); + print_header("SignedKeyResponse", ctx->now, buf); *next_sign = knot_get_next_zone_key_event(&keyset); }