Commit 9a859983 authored by Evan Hunt's avatar Evan Hunt
Browse files

3062. [func] Made several changes to enhance human readability

			of DNSSEC data in dig output and in generated
			zone files:
			 - DNSKEY record comments are more verbose, no
			   longer used in multiline mode only
			 - multiline RRSIG records reformatted
			 - multiline output mode for NSEC3PARAM records
			 - "dig +norrcomments" suppresses DNSKEY comments
			 - "dig +split=X" breaks hex/base64 records into
			   fields of width X; "dig +nosplit" disables this.
			[RT #22820]
parent 59563d2a
3062. [func] Made several changes to enhance human readability
of DNSSEC data in dig output and in generated
zone files:
- DNSKEY record comments are more verbose, no
longer used in multiline mode only
- multiline RRSIG records reformatted
- multiline output mode for NSEC3PARAM records
- "dig +norrcomments" suppresses DNSKEY comments
- "dig +split=X" breaks hex/base64 records into
fields of width X; "dig +nosplit" disables this.
[RT #22820]
3061. [func] New option "dnssec-signzone -D", only write out
generated DNSSEC records. [RT #22896]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.239 2011/03/01 23:48:05 tbox Exp $ */
/* $Id: dig.c,v 1.240 2011/03/05 19:39:06 each Exp $ */
/*! \file */
......@@ -67,7 +67,8 @@ static char domainopt[DNS_NAME_MAXTEXT];
static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE,
multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE,
onesoa = ISC_FALSE;
onesoa = ISC_FALSE, rrcomments = ISC_FALSE;
static isc_uint32_t splitwidth = 0xffffffff;
/*% opcode text */
static const char * const opcodetext[] = {
......@@ -201,6 +202,8 @@ help(void) {
" +[no]cl (Control display of class in records)\n"
" +[no]cmd (Control display of command line)\n"
" +[no]comments (Control display of comment lines)\n"
" +[no]rrcomments (Control display of per-record "
"comments)\n"
" +[no]question (Control display of question)\n"
" +[no]answer (Control display of answer)\n"
" +[no]authority (Control display of authority)\n"
......@@ -223,6 +226,7 @@ help(void) {
" +[no]topdown (Do DNSSEC validation top down mode)\n"
#endif
#endif
" +[no]split=## (Split hex/base64 fields into chunks)\n"
" +[no]multiline (Print records in an expanded format)\n"
" +[no]onesoa (AXFR prints only one soa record)\n"
" global d-opts and servers (before host name) affect all queries.\n"
......@@ -391,6 +395,8 @@ printrdataset(dns_name_t *owner_name, dns_rdataset_t *rdataset,
styleflags |= DNS_STYLEFLAG_NO_TTL;
if (noclass)
styleflags |= DNS_STYLEFLAG_NO_CLASS;
if (rrcomments)
styleflags |= DNS_STYLEFLAG_RRCOMMENT;
if (multiline) {
styleflags |= DNS_STYLEFLAG_OMIT_OWNER;
styleflags |= DNS_STYLEFLAG_OMIT_CLASS;
......@@ -399,16 +405,21 @@ printrdataset(dns_name_t *owner_name, dns_rdataset_t *rdataset,
styleflags |= DNS_STYLEFLAG_TTL;
styleflags |= DNS_STYLEFLAG_MULTILINE;
styleflags |= DNS_STYLEFLAG_COMMENT;
styleflags |= DNS_STYLEFLAG_RRCOMMENT;
}
if (multiline || (nottl && noclass))
result = dns_master_stylecreate(&style, styleflags,
24, 24, 24, 32, 80, 8, mctx);
result = dns_master_stylecreate2(&style, styleflags,
24, 24, 24, 32, 80, 8,
splitwidth, mctx);
else if (nottl || noclass)
result = dns_master_stylecreate(&style, styleflags,
24, 24, 32, 40, 80, 8, mctx);
result = dns_master_stylecreate2(&style, styleflags,
24, 24, 32, 40, 80, 8,
splitwidth, mctx);
else
result = dns_master_stylecreate(&style, styleflags,
24, 32, 40, 48, 80, 8, mctx);
result = dns_master_stylecreate2(&style, styleflags,
24, 32, 40, 48, 80, 8,
splitwidth, mctx);
check_result(result, "dns_master_stylecreate");
result = dns_master_rdatasettotext(owner_name, rdataset, style, target);
......@@ -433,6 +444,10 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
unsigned int styleflags = 0;
styleflags |= DNS_STYLEFLAG_REL_OWNER;
if (query->lookup->comments)
styleflags |= DNS_STYLEFLAG_COMMENT;
if (rrcomments)
styleflags |= DNS_STYLEFLAG_RRCOMMENT;
if (nottl)
styleflags |= DNS_STYLEFLAG_NO_TTL;
if (noclass)
......@@ -444,17 +459,20 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
styleflags |= DNS_STYLEFLAG_OMIT_TTL;
styleflags |= DNS_STYLEFLAG_TTL;
styleflags |= DNS_STYLEFLAG_MULTILINE;
styleflags |= DNS_STYLEFLAG_COMMENT;
styleflags |= DNS_STYLEFLAG_RRCOMMENT;
}
if (multiline || (nottl && noclass))
result = dns_master_stylecreate(&style, styleflags,
24, 24, 24, 32, 80, 8, mctx);
result = dns_master_stylecreate2(&style, styleflags,
24, 24, 24, 32, 80, 8,
splitwidth, mctx);
else if (nottl || noclass)
result = dns_master_stylecreate(&style, styleflags,
24, 24, 32, 40, 80, 8, mctx);
result = dns_master_stylecreate2(&style, styleflags,
24, 24, 32, 40, 80, 8,
splitwidth, mctx);
else
result = dns_master_stylecreate(&style, styleflags,
24, 32, 40, 48, 80, 8, mctx);
result = dns_master_stylecreate2(&style, styleflags,
24, 32, 40, 48, 80, 8,
splitwidth, mctx);
check_result(result, "dns_master_stylecreate");
if (query->lookup->cmdline[0] != 0) {
......@@ -756,6 +774,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->section_answer = state;
lookup->section_additional = state;
lookup->comments = state;
rrcomments = state;
lookup->stats = state;
printcmd = state;
break;
......@@ -914,6 +933,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->identify = ISC_TRUE;
lookup->stats = ISC_FALSE;
lookup->comments = ISC_FALSE;
rrcomments = ISC_FALSE;
lookup->section_additional = ISC_FALSE;
lookup->section_authority = ISC_FALSE;
lookup->section_question = ISC_FALSE;
......@@ -973,6 +993,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
default:
goto invalid_option;
}
break;
case 'r': /* rrcomments */
FULLCHECK("rrcomments");
rrcomments = state;
break;
default:
goto invalid_option;
......@@ -1000,6 +1024,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->section_authority = ISC_FALSE;
lookup->section_question = ISC_FALSE;
lookup->comments = ISC_FALSE;
rrcomments = ISC_FALSE;
lookup->stats = ISC_FALSE;
}
break;
......@@ -1022,6 +1047,36 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->dnssec = ISC_TRUE;
break;
#endif
case 'p': /* split */
FULLCHECK("split");
if (value != NULL && !state)
goto invalid_option;
if (!state) {
splitwidth = 0;
break;
} else if (value == NULL)
break;
result = parse_uint(&splitwidth, value,
1023, "split");
if (splitwidth % 4 != 0) {
splitwidth = ((splitwidth + 3) / 4) * 4;
fprintf(stderr, ";; Warning, split must be "
"a multiple of 4; adjusting "
"to %d\n", splitwidth);
}
/*
* There is an adjustment done in the
* totext_<rrtype>() functions which causes
* splitwidth to shrink. This is okay when we're
* using the default width but incorrect in this
* case, so we correct for it
*/
if (splitwidth)
splitwidth += 3;
if (result != ISC_R_SUCCESS)
fatal("Couldn't parse retries");
break;
case 't': /* stats */
FULLCHECK("stats");
lookup->stats = state;
......@@ -1066,6 +1121,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
lookup->recurse = ISC_FALSE;
lookup->identify = ISC_TRUE;
lookup->comments = ISC_FALSE;
rrcomments = ISC_FALSE;
lookup->stats = ISC_FALSE;
lookup->section_additional = ISC_FALSE;
lookup->section_authority = ISC_TRUE;
......
......@@ -18,7 +18,7 @@
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: dig.docbook,v 1.47 2010/03/04 23:50:34 tbox Exp $ -->
<!-- $Id: dig.docbook,v 1.48 2011/03/05 19:39:06 each Exp $ -->
<refentry id="man.dig">
<refentryinfo>
......@@ -587,8 +587,35 @@
<listitem>
<para>
Toggle the display of comment lines in the output. The default
is to
print comments.
is to print comments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]rrcomments</option></term>
<listitem>
<para>
Toggle the display of per-record comments in the output (for
example, human-readable key information about DNSKEY records).
The default is not to print record comments unless multiline
mode is active.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+split=W</option></term>
<listitem>
<para>
Split long hex- or base64-formatted fields in resource
records into chunks of <parameter>W</parameter> characters
(where <parameter>W</parameter> is rounded up to the nearest
multiple of 4).
<parameter>+nosplit</parameter> or
<parameter>+split=0</parameter> causes fields not to be
split at all. The default is 56 characters, or 44 characters
when multiline mode is active.
</para>
</listitem>
</varlistentry>
......
......@@ -15,7 +15,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: clean.sh,v 1.39 2011/03/05 06:35:40 marka Exp $
# $Id: clean.sh,v 1.40 2011/03/05 19:39:06 each Exp $
exit
......@@ -54,6 +54,7 @@ rm -f ns3/auto-nsec.example.db ns3/auto-nsec3.example.db
rm -f ns3/secure.below-cname.example.db
rm -f signer/example.db.after signer/example.db.before
rm -f signer/example.db.changed
rm -f signer/nsec3param.out
rm -f ns3/ttlpatch.example.db ns3/ttlpatch.example.db.signed
rm -f ns3/ttlpatch.example.db.patched
rm -f ns3/split-smart.example.db
......@@ -15,7 +15,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.81 2011/03/05 06:35:40 marka Exp $
# $Id: tests.sh,v 1.82 2011/03/05 19:39:06 each Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
......@@ -953,7 +953,15 @@ key1=`$KEYGEN -q -r $RANDFILE -a NSEC3RSASHA1 -b 1024 -n zone $zone`
key2=`$KEYGEN -q -r $RANDFILE -f KSK -a NSEC3RSASHA1 -b 1024 -n zone $zone`
cat example.db.in $key1.key $key2.key > example.db
$SIGNER -3 - -H 10 -o example -f example.db example.db > /dev/null 2>&1
grep "IQF9LQTLKKNFK0KVIFELRAK4IC4QLTMG.example. 0 IN NSEC3 1 0 10 - IQF9LQTLKKNFK0KVIFELRAK4IC4QLTMG A NS SOA RRSIG DNSKEY NSEC3PARAM" example.db > /dev/null
awk '/^IQF9LQTLK/ {
printf("%s ", $0);
getline;
printf ("%s ", $0);
getline;
print;
}' example.db | sed 's/[ ][ ]*/ /g' > nsec3param.out
grep "IQF9LQTLKKNFK0KVIFELRAK4IC4QLTMG.example. 0 IN NSEC3 1 0 10 - ( IQF9LQTLKKNFK0KVIFELRAK4IC4QLTMG A NS SOA RRSIG DNSKEY NSEC3PARAM )" nsec3param.out > /dev/null
) || ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
......
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: named.conf,v 1.2 2011/03/04 14:43:57 smann Exp $ */
/* $Id: named.conf,v 1.5 2011/03/11 17:19:05 each Exp $ */
options {
query-source address 10.53.0.1;
......
......@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.5 2009/12/02 17:54:45 each Exp $
# $Id: tests.sh,v 1.6 2011/03/05 19:39:06 each Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
......@@ -46,8 +46,8 @@ $SIGNER -Sg -o $pzone $pfile > /dev/null 2>&1
awk '$2 ~ /RRSIG/ {
type = $3;
getline;
id = $2;
if ($3 ~ /'${czone}'/) {
id = $3;
if ($4 ~ /'${czone}'/) {
print type, id
}
}' < ${cfile}.signed > sigs
......@@ -56,7 +56,7 @@ awk '$2 ~ /DNSKEY/ {
flags = $3;
while ($0 !~ /key id =/)
getline;
id = $6;
id = $NF;
print flags, id;
}' < ${cfile}.signed > keys
......
......@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.7 2011/03/04 22:20:21 each Exp $
# $Id: tests.sh,v 1.8 2011/03/05 19:39:06 each Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
......@@ -134,7 +134,7 @@ status=`expr $status + $ret`
echo "I:checking child zone signatures"
ret=0
# check DNSKEY signatures first
awk '$2 == "RRSIG" && $3 == "DNSKEY" { getline; print $2 }' $cfile.signed > dnskey.sigs
awk '$2 == "RRSIG" && $3 == "DNSKEY" { getline; print $3 }' $cfile.signed > dnskey.sigs
grep "$ckactive" dnskey.sigs > /dev/null || ret=1
grep "$ckrevoked" dnskey.sigs > /dev/null || ret=1
grep "$czactive" dnskey.sigs > /dev/null || ret=1
......@@ -145,7 +145,7 @@ grep "$czpublished" dnskey.sigs > /dev/null && ret=1
grep "$czinactive" dnskey.sigs > /dev/null && ret=1
grep "$czgenerated" dnskey.sigs > /dev/null && ret=1
# now check other signatures first
awk '$2 == "RRSIG" && $3 != "DNSKEY" { getline; print $2 }' $cfile.signed | sort -un > other.sigs
awk '$2 == "RRSIG" && $3 != "DNSKEY" { getline; print $3 }' $cfile.signed | sort -un > other.sigs
# should not be there:
grep "$ckactive" other.sigs > /dev/null && ret=1
grep "$ckpublished" other.sigs > /dev/null && ret=1
......@@ -181,7 +181,7 @@ status=`expr $status + $ret`
echo "I:checking child zone signatures again"
ret=0
awk '$2 == "RRSIG" && $3 == "DNSKEY" { getline; print $2 }' $cfile.signed > dnskey.sigs
awk '$2 == "RRSIG" && $3 == "DNSKEY" { getline; print $3 }' $cfile.signed > dnskey.sigs
grep "$ckpublished" dnskey.sigs > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: masterdump.h,v 1.42 2008/09/24 02:46:23 marka Exp $ */
/* $Id: masterdump.h,v 1.43 2011/03/05 19:39:06 each Exp $ */
#ifndef DNS_MASTERDUMP_H
#define DNS_MASTERDUMP_H 1
......@@ -329,6 +329,12 @@ dns_master_stylecreate(dns_master_style_t **style, unsigned int flags,
unsigned int line_length, unsigned int tab_width,
isc_mem_t *mctx);
isc_result_t
dns_master_stylecreate2(dns_master_style_t **style, unsigned int flags,
unsigned int ttl_column, unsigned int class_column,
unsigned int type_column, unsigned int rdata_column,
unsigned int line_length, unsigned int tab_width,
unsigned int split_width, isc_mem_t *mctx);
void
dns_master_styledestroy(dns_master_style_t **style, isc_mem_t *mctx);
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.h,v 1.77 2009/12/04 21:09:33 marka Exp $ */
/* $Id: rdata.h,v 1.78 2011/03/05 19:39:06 each Exp $ */
#ifndef DNS_RDATA_H
#define DNS_RDATA_H 1
......@@ -158,6 +158,7 @@ struct dns_rdata {
/*% Output explanatory comments. */
#define DNS_STYLEFLAG_COMMENT 0x00000002U
#define DNS_STYLEFLAG_RRCOMMENT 0x00000004U
#define DNS_RDATA_DOWNCASE DNS_NAME_DOWNCASE
#define DNS_RDATA_CHECKNAMES DNS_NAME_CHECKNAMES
......@@ -423,8 +424,8 @@ dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target);
isc_result_t
dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin, unsigned int flags,
unsigned int width, const char *linebreak,
isc_buffer_t *target);
unsigned int width, unsigned int split_width,
const char *linebreak, isc_buffer_t *target);
/*%<
* Like dns_rdata_totext, but do formatted output suitable for
* database dumps. This is intended for use by dns_db_dump();
......@@ -446,6 +447,11 @@ dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin, unsigned int flags,
* comments next to things like the SOA timer fields. Some
* comments (e.g., the SOA ones) are only printed when multiline
* output is selected.
*
* base64 rdata text (e.g., DNSKEY records) will be split into chunks
* of 'split_width' characters. If split_width == 0, the text will
* not be split at all. If split_width == 0xffffffff, then it is undefined
* and falls back to the default value of 'width'
*/
isc_result_t
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: masterdump.c,v 1.99 2009/11/17 23:55:18 marka Exp $ */
/* $Id: masterdump.c,v 1.100 2011/03/05 19:39:06 each Exp $ */
/*! \file */
......@@ -74,6 +74,7 @@ struct dns_master_style {
unsigned int rdata_column;
unsigned int line_length;
unsigned int tab_width;
unsigned int split_width;
};
/*%
......@@ -108,15 +109,16 @@ dns_master_style_default = {
DNS_STYLEFLAG_OMIT_TTL |
DNS_STYLEFLAG_TTL |
DNS_STYLEFLAG_COMMENT |
DNS_STYLEFLAG_RRCOMMENT |
DNS_STYLEFLAG_MULTILINE,
24, 24, 24, 32, 80, 8
24, 24, 24, 32, 80, 8, -1
};
LIBDNS_EXTERNAL_DATA const dns_master_style_t
dns_master_style_full = {
DNS_STYLEFLAG_COMMENT |
DNS_STYLEFLAG_RESIGN,
46, 46, 46, 64, 120, 8
46, 46, 46, 64, 120, 8, -1
};
LIBDNS_EXTERNAL_DATA const dns_master_style_t
......@@ -126,8 +128,9 @@ dns_master_style_explicitttl = {
DNS_STYLEFLAG_REL_OWNER |
DNS_STYLEFLAG_REL_DATA |
DNS_STYLEFLAG_COMMENT |
DNS_STYLEFLAG_RRCOMMENT |
DNS_STYLEFLAG_MULTILINE,
24, 32, 32, 40, 80, 8
24, 32, 32, 40, 80, 8, -1
};
LIBDNS_EXTERNAL_DATA const dns_master_style_t
......@@ -137,13 +140,13 @@ dns_master_style_cache = {
DNS_STYLEFLAG_MULTILINE |
DNS_STYLEFLAG_TRUST |
DNS_STYLEFLAG_NCACHE,
24, 32, 32, 40, 80, 8
24, 32, 32, 40, 80, 8, -1
};
LIBDNS_EXTERNAL_DATA const dns_master_style_t
dns_master_style_simple = {
0,
24, 32, 32, 40, 80, 8
24, 32, 32, 40, 80, 8, -1
};
/*%
......@@ -152,7 +155,7 @@ dns_master_style_simple = {
LIBDNS_EXTERNAL_DATA const dns_master_style_t
dns_master_style_debug = {
DNS_STYLEFLAG_REL_OWNER,
24, 32, 40, 48, 80, 8
24, 32, 40, 48, 80, 8, -1
};
......@@ -373,7 +376,7 @@ ncache_summary(dns_rdataset_t *rdataset, isc_boolean_t omit_final_dot,
dns_rdataset_current(&rds, &rdata);
CHECK(str_totext(" ", target));
CHECK(dns_rdata_tofmttext(&rdata, dns_rootname,
0, 0, " ", target));
0, 0, 0, " ", target));
CHECK(str_totext("\n", target));
}
}
......@@ -536,6 +539,7 @@ rdataset_totext(dns_rdataset_t *rdataset,
ctx->style.flags,
ctx->style.line_length -
ctx->style.rdata_column,
ctx->style.split_width,
ctx->linebreak,
target));
......@@ -1787,6 +1791,19 @@ dns_master_stylecreate(dns_master_style_t **stylep, unsigned int flags,
unsigned int type_column, unsigned int rdata_column,
unsigned int line_length, unsigned int tab_width,
isc_mem_t *mctx)
{
return (dns_master_stylecreate2(stylep, flags, ttl_column,
class_column, type_column,
rdata_column, line_length,
tab_width, 0xffffffff, mctx));
}
isc_result_t
dns_master_stylecreate2(dns_master_style_t **stylep, unsigned int flags,
unsigned int ttl_column, unsigned int class_column,
unsigned int type_column, unsigned int rdata_column,
unsigned int line_length, unsigned int tab_width,
unsigned int split_width, isc_mem_t *mctx)
{
dns_master_style_t *style;
......@@ -1802,6 +1819,7 @@ dns_master_stylecreate(dns_master_style_t **stylep, unsigned int flags,
style->rdata_column = rdata_column;
style->line_length = line_length;
style->tab_width = tab_width;
style->split_width = split_width;
*stylep = style;
return (ISC_R_SUCCESS);
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.c,v 1.211 2011/03/03 14:10:27 fdupont Exp $ */
/* $Id: rdata.c,v 1.212 2011/03/05 19:39:06 each Exp $ */
/*! \file */
......@@ -726,7 +726,13 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
result = str_totext(" ( ", target);
else
result = str_totext(" ", target);
if (result == ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS)
return (result);
if (tctx->width == 0) /* No splitting */
result = isc_hex_totext(&sr, 0, "", target);
else
result = isc_hex_totext(&sr, tctx->width - 2,
tctx->linebreak,
target);
......@@ -759,7 +765,8 @@ dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target)
isc_result_t
dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin,
unsigned int flags, unsigned int width,
const char *linebreak, isc_buffer_t *target)
unsigned int split_width, const char *linebreak,
isc_buffer_t *target)
{
dns_rdata_textctx_t tctx;
......@@ -770,11 +777,16 @@ dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin,
*/
tctx.origin = origin;
tctx.flags = flags;
if ((flags & DNS_STYLEFLAG_MULTILINE) != 0) {
if (split_width == 0xffffffff)
tctx.width = width;
else
tctx.width = split_width;
if ((flags & DNS_STYLEFLAG_MULTILINE) != 0)
tctx.linebreak = linebreak;
} else {
tctx.width = 60; /* Used for hex word length only. */
else {
if (split_width == 0xffffffff)
tctx.width = 60; /* Used for hex word length only. */
tctx.linebreak = " ";
}
return (rdata_totext(rdata, &tctx, target));
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tsig_250.c,v 1.65 2009/12/04 22:06:37 tbox Exp $ */
/* $Id: tsig_250.c,v 1.66 2011/03/05 19:39:06 each Exp $ */
/* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */
......@@ -202,8 +202,11 @@ totext_any_tsig(ARGS_TOTEXT) {
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
RETERR(str_totext(" (", target));
RETERR(str_totext(tctx->linebreak, target));
RETERR(isc_base64_totext(&sigr, tctx->width - 2,
tctx->linebreak, target));
if (tctx->width == 0) /* No splitting */
RETERR(isc_base64_totext(&sigr, 60, "", target));
else
RETERR(isc_base64_totext(&sigr, tctx->width - 2,
tctx->linebreak, target));
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
RETERR(str_totext(" ) ", target));
else
......@@ -241,7 +244,10 @@ totext_any_tsig(ARGS_TOTEXT) {
/*
* Other.
*/
return (isc_base64_totext(&sr, 60, " ", target));
if (tctx->width == 0) /* No splitting */
return (isc_base64_totext(&sr, 60, "", target));
else
return (isc_base64_totext(&sr, 60, " ", target));
<