2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

[24702] Include key filename in logged message

Squashed commit of the following:

commit 593e6bc7e29938ff5c2f7508bde303fb069a97a9
Author: Mukund Sivaraman <muks@isc.org>
Date:   Tue Jun 10 19:17:40 2014 +0530

    Increase size of filename buffers

commit b8685678e026ba98b8833e26664193b6345eb00e
Author: Evan Hunt <each@isc.org>
Date:   Wed Jun 4 18:57:44 2014 -0700

    [rt24702] some tweaks during review

commit adfbc8f808716c63e9e097d92beef104527e5c6f
Author: Mukund Sivaraman <muks@isc.org>
Date:   Wed Jun 4 18:18:35 2014 +0530

    [24702] Include key filename in logged message

commit f1eff77e7e3704b145c3d65101a735467dd81dc3
Author: Mukund Sivaraman <muks@isc.org>
Date:   Wed Jun 4 18:12:43 2014 +0530

    Add dst_key_getfilename()
This commit is contained in:
Mukund Sivaraman
2014-06-10 19:18:34 +05:30
parent 20dec973da
commit aa232396ee
4 changed files with 126 additions and 41 deletions

View File

@@ -15,10 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* $Id$
*/
/*! \file */
#include <config.h>
@@ -739,18 +735,36 @@ dns_dnssec_findzonekeys2(dns_db_t *db, dns_dbversion_t *ver,
}
if (result != ISC_R_SUCCESS) {
char keybuf[DNS_NAME_FORMATSIZE];
char algbuf[DNS_SECALG_FORMATSIZE];
dns_name_format(dst_key_name(pubkey), keybuf,
sizeof(keybuf));
dns_secalg_format(dst_key_alg(pubkey), algbuf,
sizeof(algbuf));
char filename[ISC_DIR_NAMEMAX];
isc_result_t result2;
isc_buffer_t buf;
isc_buffer_init(&buf, filename, ISC_DIR_NAMEMAX);
result2 = dst_key_getfilename(dst_key_name(pubkey),
dst_key_id(pubkey),
dst_key_alg(pubkey),
(DST_TYPE_PUBLIC |
DST_TYPE_PRIVATE),
directory, mctx,
&buf);
if (result2 != ISC_R_SUCCESS) {
char namebuf[DNS_NAME_FORMATSIZE];
char algbuf[DNS_SECALG_FORMATSIZE];
dns_name_format(dst_key_name(pubkey),
namebuf, sizeof(namebuf));
dns_secalg_format(dst_key_alg(pubkey),
algbuf, sizeof(algbuf));
snprintf(filename, sizeof(filename) - 1,
"key file for %s/%s/%d",
namebuf, algbuf, dst_key_id(pubkey));
}
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_DNSSEC, ISC_LOG_WARNING,
"dns_dnssec_findzonekeys2: error "
"reading private key file %s/%s/%d: %s",
keybuf, algbuf, dst_key_id(pubkey),
isc_result_totext(result));
"reading %s: %s",
filename, isc_result_totext(result));
}
if (result == ISC_R_FILENOTFOUND || result == ISC_R_NOPERM) {
@@ -1597,18 +1611,36 @@ dns_dnssec_keylistfromrdataset(dns_name_t *origin,
}
if (result != ISC_R_SUCCESS) {
char keybuf[DNS_NAME_FORMATSIZE];
char algbuf[DNS_SECALG_FORMATSIZE];
dns_name_format(dst_key_name(pubkey), keybuf,
sizeof(keybuf));
dns_secalg_format(dst_key_alg(pubkey), algbuf,
sizeof(algbuf));
char filename[ISC_DIR_NAMEMAX];
isc_result_t result2;
isc_buffer_t buf;
isc_buffer_init(&buf, filename, ISC_DIR_NAMEMAX);
result2 = dst_key_getfilename(dst_key_name(pubkey),
dst_key_id(pubkey),
dst_key_alg(pubkey),
(DST_TYPE_PUBLIC |
DST_TYPE_PRIVATE),
directory, mctx,
&buf);
if (result2 != ISC_R_SUCCESS) {
char namebuf[DNS_NAME_FORMATSIZE];
char algbuf[DNS_SECALG_FORMATSIZE];
dns_name_format(dst_key_name(pubkey),
namebuf, sizeof(namebuf));
dns_secalg_format(dst_key_alg(pubkey),
algbuf, sizeof(algbuf));
snprintf(filename, sizeof(filename) - 1,
"key file for %s/%s/%d",
namebuf, algbuf, dst_key_id(pubkey));
}
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_DNSSEC, ISC_LOG_WARNING,
"dns_dnssec_keylistfromrdataset: error "
"reading private key file %s/%s/%d: %s",
keybuf, algbuf, dst_key_id(pubkey),
isc_result_totext(result));
"reading %s: %s",
filename, isc_result_totext(result));
}
if (result == ISC_R_FILENOTFOUND || result == ISC_R_NOPERM) {