2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

[master] truncate logged rdata if too long

3490.	[bug]		When logging RDATA during update, truncate if it's
                        too long. [RT #32365]

cherry picked from:
        commit 16ddb566e5a5b57bf925adef2b5543dddc1de49b
        commit cd97e0c23b09f38aac49aabab66ee13c68b7a3f3
        commit d087fa982649c081d58c5bb16e63da3428e2b89d
        commit d0795bdffef57612dd7654ffd09c9f4216eee2c8
This commit is contained in:
Evan Hunt 2013-02-20 13:54:52 -08:00
parent 9d8985bea9
commit 2425d8bb7c
6 changed files with 37 additions and 11 deletions

View File

@ -1,3 +1,6 @@
3490. [bug] When logging RDATA during update, truncate if it's
too long. [RT #32365]
3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT.
dns_dlzcreate() failed to properly initialize
dlzdb.link. When cloning a rdataset do not copy
@ -79,7 +82,7 @@
3464. [maint] Updates to PKCS#11 openssl patches, supporting
versions 0.9.8x, 1.0.0j, 1.0.1c [RT #29749]
3463. [doc] Clarify managed-keys syntax in ARM. [RT 32232]
3463. [doc] Clarify managed-keys syntax in ARM. [RT #32232]
3462. [doc] Clarify server selection behavior of dig when using
-4 or -6 options. [RT #32181]

View File

@ -2808,7 +2808,7 @@ void
ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
isc_logmodule_t *module, int level, const char *fmt, va_list ap)
{
char msgbuf[2048];
char msgbuf[4096];
char peerbuf[ISC_SOCKADDR_FORMATSIZE];
char signerbuf[DNS_NAME_FORMATSIZE], qnamebuf[DNS_NAME_FORMATSIZE];
const char *viewname = "";

View File

@ -2859,22 +2859,30 @@ update_action(isc_task_t *task, isc_event_t *event) {
if (isc_log_wouldlog(ns_g_lctx, LOGLEVEL_PROTOCOL)) {
char namestr[DNS_NAME_FORMATSIZE];
char typestr[DNS_RDATATYPE_FORMATSIZE];
char rdstr[4096];
char rdstr[2048];
isc_buffer_t buf;
isc_region_t r;
int len = 0;
const char *truncated = "";
dns_name_format(name, namestr, sizeof(namestr));
dns_rdatatype_format(rdata.type, typestr,
sizeof(typestr));
isc_buffer_init(&buf, rdstr, sizeof(rdstr));
result = dns_rdata_totext(&rdata, NULL, &buf);
isc_buffer_usedregion(&buf, &r);
if (result == ISC_R_SUCCESS)
len = r.length;
if (result == ISC_R_NOSPACE) {
len = (int)isc_buffer_usedlength(&buf);
truncated = " [TRUNCATED]";
} else if (result != ISC_R_SUCCESS) {
snprintf(rdstr, sizeof(rdstr), "[dns_"
"rdata_totext failed: %s]",
dns_result_totext(result));
len = strlen(rdstr);
} else
len = (int)isc_buffer_usedlength(&buf);
update_log(client, zone, LOGLEVEL_PROTOCOL,
"adding an RR at '%s' %s %.*s",
namestr, typestr, len,
(char *) r.base);
"adding an RR at '%s' %s %.*s%s",
namestr, typestr, len, rdstr,
truncated);
}
/* Prepare the affected RRset for the addition. */

View File

@ -104,7 +104,7 @@ extern int h_errno;
#endif
#endif
#define MAXCMD (4 * 1024)
#define MAXCMD (128 * 1024)
#define MAXWIRE (64 * 1024)
#define PACKETSIZE ((64 * 1024) - 1)
#define INITTEXT (2 * 1024)

View File

@ -552,5 +552,17 @@ if [ $ret -ne 0 ]; then
status=1
fi
n=`expr $n + 1`
ret=0
echo "I:add a record which is truncated when logged. ($n)"
$NSUPDATE verylarge || ret=1
$DIG +tcp @10.53.0.1 -p 5300 txt txt.update.nil > dig.out.ns1.test$n
grep "ANSWER: 1," dig.out.ns1.test$n > /dev/null || ret=1
grep "adding an RR at 'txt.update.nil' TXT .* \[TRUNCATED\]" ns1/named.run > /dev/null || ret=1
if [ $ret -ne 0 ]; then
echo "I:failed"
status=1
fi
echo "I:exit status: $status"
exit $status

File diff suppressed because one or more lines are too long