t_names.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1998-2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: t_names.c,v 1.52 2011/03/12 04:59:46 tbox Exp $ */
#include <config.h>
#include <ctype.h>
#include <stdlib.h>
#include <dns/compress.h>
#include <dns/fixedname.h>
#define MAXTOKS 16
#define BUFLEN 256
#define BIGBUFLEN 4096
#ifdef NEED_PBUF
/*%
* get a hex formatted dns message from a data
* file into an isc_buffer_t
* caller supplies data storage and the isc_buffer
* we read the file, convert, setup the buffer
* and return the data length
*/
static char *
ctoh(unsigned char c) {
int val;
static char buf[3];
val = c & 0x0f;
return (buf);
}
static void
unsigned char *p;
len = 0;
++p;
++len;
if ((len % 40) == 0)
printf("\n");
}
}
#endif /* NEED_PBUF */
/*%
* Compare data at buf with data in hex representation at exp_data,
* of length exp_data_len, for equality.
* Return 0 if equal, else non-zero.
*/
static int
{
int result;
unsigned char *p;
unsigned char *v;
char *q;
unsigned char *data;
if (buflen == exp_data_len) {
sizeof(unsigned char));
t_info("malloc failed unexpectedly\n");
return (-1);
}
/*
* First convert exp_data from hex format.
*/
p = data;
q = exp_data;
cnt = 0;
while (cnt < exp_data_len) {
if (('0' <= *q) && (*q <= '9'))
*p = *q - '0';
else if (('a' <= *q) && (*q <= 'f'))
*p = *q - 'a' + 10;
else if (('A' <= *q) && (*q <= 'F'))
*p = *q - 'A' + 10;
else {
t_info("malformed comparison data\n");
return (-1);
}
++q;
*p <<= 4;
if (('0' <= *q) && (*q <= '9'))
*p |= ((*q - '0') & 0x0f);
else if (('a' <= *q) && (*q <= 'f'))
*p |= ((*q - 'a' + 10) & 0x0f);
else if (('A' <= *q) && (*q <= 'F'))
*p |= ((*q - 'A' + 10) & 0x0f);
else {
t_info("malformed comparison data\n");
return (-1);
}
++p;
++q;
++cnt;
}
/*
* Now compare data.
*/
p = buf;
v = data;
if (*p != *v)
break;
++p;
++v;
}
if (cnt == exp_data_len)
result = 0;
else {
t_info("bad data at position %lu, "
"got 0x%.2x, expected 0x%.2x\n",
(unsigned long)cnt, *p, *v);
}
} else {
t_info("data length error, expected %lu, got %lu\n",
(unsigned long)exp_data_len, (unsigned long)buflen);
}
return (result);
}
/*%
* Get a hex formatted dns message from a data file into an isc_buffer_t.
* Caller supplies data storage and the isc_buffer. We read the file, convert,
* setup the buffer and return the data length.
*/
static int
{
int c;
unsigned int len;
unsigned int cnt;
unsigned char *p;
unsigned int buflen;
return (0);
}
p = isc_buffer_used(pbuf);
cnt = 0;
len = 0;
unsigned int val;
if ( (c == ' ') || (c == '\t') ||
(c == '\r') || (c == '\n'))
continue;
if (c == '#') {
;
continue;
}
if (('0' <= c) && (c <= '9'))
val = c - '0';
else if (('a' <= c) && (c <= 'f'))
else if (('A' <= c) && (c <= 'F'))
else {
t_info("Bad format in datafile\n");
return (0);
}
if ((len % 2) == 0) {
*p = (val << 4);
} else {
*p += val;
++p;
++cnt;
/*
* Buffer too small.
*/
t_info("Buffer overflow error\n");
return (0);
}
}
++len;
}
if (len % 2) {
return (0);
}
*p = '\0';
return (cnt);
}
static int
int cnt;
char *p;
cnt = 0;
*toks++ = p;
++cnt;
}
}
return (cnt);
}
#ifdef NEED_HNAME_TO_TNAME
/*%
* convert a name from hex representation to text form
* format of hex notation is:
* %xXXXXXXXX
*/
static int
int i;
int c;
unsigned int val;
char *p;
char *q;
p = src;
/*
* No conversion needed.
*/
return (1);
return (0);
}
i = 0;
p += 2;
q = target;
while (*p) {
c = *p;
if (('0' < c) && (c <= '9'))
val = c - '0';
else if (('a' <= c) && (c <= 'z'))
else if (('A' <= c) && (c <= 'Z'))
else {
return (1);
}
if (i % 2) {
*q |= val;
++q;
} else
*q = (val << 4);
++i;
++p;
}
if (i % 2) {
return (1);
} else {
*q = '\0';
return (0);
}
}
#endif /* NEED_HNAME_TO_TNAME */
static const char *a3 = "dns_name_init initializes 'name' to the empty name";
static void
t_dns_name_init(void) {
int rval;
int result;
unsigned char offsets[1];
rval = 0;
/* magic is hidden in name.c ...
if (name.magic != NAME_MAGIC) {
t_info("name.magic is not set to NAME_MAGIC\n");
++rval;
}
*/
t_info("name.ndata is not NULL\n");
++rval;
}
t_info("name.length is not 0\n");
++rval;
}
t_info("name.labels is not 0\n");
++rval;
}
if (name.attributes != 0) {
t_info("name.attributes is not 0\n");
++rval;
}
t_info("name.offsets is incorrect\n");
++rval;
}
t_info("name.buffer is not NULL\n");
++rval;
}
if (rval == 0)
else
}
static const char *a4 = "dns_name_invalidate invalidates 'name'";
static void
t_dns_name_invalidate(void) {
int rval;
int result;
unsigned char offsets[1];
rval = 0;
/* magic is hidden in name.c ...
if (name.magic != 0) {
t_info("name.magic is not set to NAME_MAGIC\n");
++rval;
}
*/
t_info("name.ndata is not NULL\n");
++rval;
}
t_info("name.length is not 0\n");
++rval;
}
t_info("name.labels is not 0\n");
++rval;
}
if (name.attributes != 0) {
t_info("name.attributes is not 0\n");
++rval;
}
t_info("name.offsets is not NULL\n");
++rval;
}
t_info("name.buffer is not NULL\n");
++rval;
}
if (rval == 0)
else
}
static const char *a5 = "dns_name_setbuffer dedicates a buffer for use "
"with 'name'";
static void
t_dns_name_setbuffer(void) {
int result;
else
}
static const char *a6 = "dns_name_hasbuffer returns ISC_TRUE if 'name' has a "
"dedicated buffer, otherwise it returns ISC_FALSE";
static void
t_dns_name_hasbuffer(void) {
int result;
int rval;
rval = 0;
++rval;
++rval;
if (rval == 0)
else
}
static const char *a7 = "dns_name_isabsolute returns ISC_TRUE if 'name' ends "
"in the root label";
static int
int len;
int rval;
rval = T_UNRESOLVED;
if (result == ISC_R_SUCCESS) {
else
} else {
t_info("dns_name_fromtext %s failed, result = %s\n",
}
return (rval);
}
static void
t_dns_name_isabsolute(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 2) {
/*
* label, bitpos, expected value.
*/
== 0 ?
ISC_TRUE);
} else {
t_info("bad datafile format at line %d\n",
line);
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_isabsolute_data\n");
}
}
static const char *a8 = "dns_name_hash(name, case_sensitive) returns "
"a hash of 'name' which is case_sensitive if case_sensitive "
"is true";
/*%
* a9 merged with a8.
*/
static int
int rval;
int failures;
unsigned int hash1;
unsigned int hash2;
rval = T_UNRESOLVED;
failures = 0;
if (result == ISC_R_SUCCESS) {
0, NULL);
if (result == ISC_R_SUCCESS) {
++failures;
t_info("hash mismatch when ISC_TRUE\n");
}
if (match != cish_match) {
++failures;
t_info("hash mismatch when ISC_FALSE\n");
}
if (failures == 0)
else
} else {
t_info("dns_name_fromstring2 %s failed, result = %s\n",
}
} else {
t_info("dns_name_fromstring2 %s failed, result = %s\n",
}
return (rval);
}
static void
t_dns_name_hash(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 4) {
/*
* name1, name2, exp match value if
* case_sensitive true,
* exp match value of case_sensitive false
*/
Tokens[0],
Tokens[1],
} else {
t_info("bad datafile format at line %d\n",
line);
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_hash_data\n");
}
}
static const char *a10 =
"dns_name_fullcompare(name1, name2, orderp, nlabelsp) "
"returns the DNSSEC ordering relationship between name1 and "
"name2, sets orderp to -1 if name1 < name2, to 0 if "
"name1 == name2, or to 1 if name1 > name2, sets nlabelsp "
"to the number of labels name1 and name2 have in common, "
"and sets nbitsp to the number of bits name1 and name2 "
"have in common";
/*%
* a11 thru a22 merged into a10.
*/
static const char *
const char *p;
if (reln == dns_namereln_contains)
p = "contains";
else if (reln == dns_namereln_subdomain)
p = "subdomain";
else if (reln == dns_namereln_equal)
p = "equal";
else if (reln == dns_namereln_none)
p = "none";
else if (reln == dns_namereln_commonancestor)
p = "commonancestor";
else
p = "unknown";
return (p);
}
static int
int exp_order, int exp_nlabels)
{
int result;
int nfails;
int order;
unsigned int nlabels;
nfails = 0;
if (dns_result == ISC_R_SUCCESS) {
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
if (dns_reln != exp_dns_reln) {
++nfails;
t_info("expected relationship of %s, got %s\n",
}
/*
* Normalize order.
*/
if (order < 0)
order = -1;
else if (order > 0)
order = 1;
++nfails;
t_info("expected ordering %d, got %d\n",
}
if ((exp_nlabels >= 0) &&
(nlabels != (unsigned int)exp_nlabels)) {
++nfails;
t_info("expecting %d labels, got %d\n",
}
if (nfails == 0)
else
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
return (result);
}
static void
t_dns_name_fullcompare(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 6) {
/*
* name1, name2, exp_reln, exp_order,
* exp_nlabels
*/
else {
(void)free(p);
continue;
}
Tokens[0],
Tokens[1],
reln,
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_fullcompare_data\n");
}
}
static const char *a23 =
"dns_name_compare(name1, name2) returns information about "
"the relative ordering under the DNSSEC ordering relationship "
"of name1 and name2";
/*%
* a24 thru a29 merged into a23.
*/
static int
int result;
int order;
name2);
if (dns_result == ISC_R_SUCCESS) {
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
/*
* Normalize order.
*/
if (order < 0)
order = -1;
else if (order > 0)
order = 1;
t_info("expected order of %d, got %d\n",
} else
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
return (result);
}
static void
t_dns_name_compare(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 3) {
/*
* name1, name2, order.
*/
Tokens[0],
Tokens[1],
} else {
t_info("bad datafile format at line %d\n",
line);
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_compare_data\n");
}
}
static const char *a30 =
"dns_name_rdatacompare(name1, name2) returns information "
"about the relative ordering of name1 and name2 as if they "
"are part of rdata in DNSSEC canonical form";
/*%
* a31, a32 merged into a30.
*/
static int
int result;
int order;
if (dns_result == ISC_R_SUCCESS) {
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
/*
* Normalize order.
*/
if (order < 0)
order = -1;
else if (order > 0)
order = 1;
t_info("expected order of %d, got %d\n",
} else
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
return (result);
}
static void
t_dns_name_rdatacompare(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 3) {
/*
* name1, name2, order.
*/
Tokens[0],
Tokens[1],
} else {
t_info("bad datafile format at line %d\n",
line);
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_rdatacompare_data\n");
}
}
static const char *a33 =
"when name1 is a subdomain of name2, "
"dns_name_issubdomain(name1, name2) returns true, "
"otherwise it returns false.";
/*%
* a34 merged into a33.
*/
static int
int result;
if (dns_result == ISC_R_SUCCESS) {
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
t_info("expected return value of %s, got %s\n",
} else
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
return (result);
}
static void
t_dns_name_issubdomain(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 3) {
/*
* name1, name2, issubdomain_p.
*/
Tokens[0],
Tokens[1],
} else {
t_info("bad datafile format at line %d\n",
line);
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_issubdomain_data\n");
}
}
static const char *a35 =
"dns_name_countlabels(name) returns the number "
"of labels in name";
static int
int result;
unsigned int nlabels;
if (dns_result == ISC_R_SUCCESS) {
if (nlabels != exp_nlabels) {
} else
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
return (result);
}
static void
t_dns_name_countlabels(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 2) {
/*
* name, nlabels.
*/
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_countlabels_data\n");
}
}
static const char *a36 =
"when n is less than the number of labels in name, "
"dns_name_getlabel(name, n, labelp) initializes labelp "
"to point to the nth label in name";
/*%
* The strategy here is two take two dns names with a shared label in
* different positions, get the two labels and compare them for equality.
* If they don't match, dns_name_getlabel failed.
*/
static int
int label2_pos)
{
int result;
int nfails;
unsigned int cnt;
unsigned char *p;
unsigned char *q;
nfails = 0;
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
t_info("label lengths differ\n");
++nfails;
}
p = dns_label1.base;
q = dns_label2.base;
if (*p++ != *q++) {
t_info("labels differ at position %d",
cnt);
++nfails;
}
}
if (nfails == 0)
else
} else {
t_info("dns_name_fromstring2 failed, result == %s",
}
} else {
t_info("dns_name_fromstring2 failed, result == %s",
}
return (result);
}
static void
t_dns_name_getlabel(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 4) {
/*
* name1, name2, nlabels.
*/
Tokens[2],
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_getlabel_data\n");
}
}
static const char *a37 =
"when source contains at least first + n labels, "
"dns_name_getlabelsequence(source, first, n, target) "
"initializes target to point to the n label sequence of "
"labels in source starting with first";
/*%
* We adopt a similiar strategy to that used by the dns_name_getlabel test.
*/
static int
{
int result;
int nfails;
unsigned int cnt;
unsigned char *p;
unsigned char *q;
nfails = 0;
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
range, &dns_targetname1);
range, &dns_targetname2);
/*
* Now convert both targets to text for comparison.
*/
if (*p != *q) {
++nfails;
t_info("names differ at %d\n",
cnt);
break;
}
++p; ++q;
}
} else {
++nfails;
t_info("lengths differ\n");
}
if (nfails == 0)
else
} else {
t_info("dns_name_fromstring2 failed, result == %s",
}
} else {
t_info("dns_name_fromstring2 failed, result == %s",
}
return (result);
}
static void
t_dns_name_getlabelsequence(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 5) {
/*
* name1, name2, nlabels.
*/
Tokens[0],
Tokens[2],
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_getlabelsequence_data\n");
}
}
static const char *a38 =
"dns_name_fromregion(name, region) converts a DNS name "
"from a region representation to a name representation";
static int
test_dns_name_fromregion(char *test_name) {
int result;
int order;
unsigned int nlabels;
if (dns_result == ISC_R_SUCCESS) {
if (dns_namereln == dns_namereln_equal)
else
} else {
t_info("dns_name_fromstring2 failed, result == %s\n",
}
return (result);
}
static void
t_dns_name_fromregion(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 1) {
/*
* test_name.
*/
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_fromregion_data\n");
}
}
static const char *a39 =
"dns_name_toregion(name, region) converts a DNS name "
"from a region representation to a name representation";
static void
t_dns_name_toregion(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 1) {
/*
* test_name.
*/
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_toregion_data\n");
}
}
static const char *a40 =
"dns_name_fromtext(name, source, origin, downcase, target) "
"converts the textual representation of a DNS name at source "
"into uncompressed wire form at target, appending origin to "
"the converted name if origin is non-NULL and converting "
"upper case to lower case during conversion "
"if downcase is true.";
static int
unsigned int downcase)
{
int result;
int order;
unsigned int nlabels;
&binbuf3);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext(dns_name3) failed, result == %s\n",
return (T_FAIL);
}
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext(dns_name1) failed, result == %s\n",
return (T_FAIL);
}
&binbuf2);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext(dns_name2) failed, result == %s\n",
return (T_FAIL);
}
&nlabels);
if (dns_namereln == dns_namereln_equal)
else {
t_info("dns_name_fullcompare returned %s\n",
}
return (result);
}
static void
t_dns_name_fromtext(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 4) {
/*
* test_name1, test_name2, test_origin,
* downcase.
*/
Tokens[1],
Tokens[2],
== 0 ?
0 :
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_fromtext\n");
}
}
static const char *a41 =
"dns_name_totext(name, omit_final_dot, target) converts "
"the DNS name 'name' in wire format to textual format "
"at target, and adds a final '.' to the name if "
"omit_final_dot is false";
static int
int result;
int len;
int order;
unsigned int nlabels;
/*
* Out of the data file to dns_name1.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed, result == %s\n",
return (T_UNRESOLVED);
}
/*
* From dns_name1 into a text buffer.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_totext failed, result == %s\n",
return (T_FAIL);
}
/*
* From the text buffer into dns_name2.
*/
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed, result == %s\n",
return (T_UNRESOLVED);
}
if (dns_namereln == dns_namereln_equal)
else {
t_info("dns_name_fullcompare returned %s\n",
}
return (result);
}
static void
t_dns_name_totext(void) {
int line;
int cnt;
int result;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 2) {
/*
* test_name, omit_final.
*/
ISC_TRUE);
} else {
}
(void)free(p);
}
} else {
t_info("Missing datafile dns_name_totext\n");
}
}
static const char *a42 =
"dns_name_fromwire(name, source, dctx, downcase, target) "
"converts the possibly compressed DNS name 'name' in wire "
"format to canonicalized form at target, performing upper to "
"lower case conversion if downcase is true, and returns "
"ISC_R_SUCCESS";
#if 0
/*
* XXXRTH these tests appear to be broken, so I have
* disabled them.
*/
static const char *a43 =
"when a label length is invalid, dns_name_fromwire() "
"returns DNS_R_FORMERR";
static const char *a44 =
"when a label type is invalid, dns_name_fromwire() "
"returns DNS_R_BADLABELTYPE";
#endif
static const char *a45 =
"when a name length is invalid, dns_name_fromwire() "
"returns DNS_R_FORMERR";
static const char *a46 =
"when a compression type is invalid, dns_name_fromwire() "
"returns DNS_R_DISALLOWED";
static const char *a47 =
"when a bad compression pointer is encountered, "
"dns_name_fromwire() returns DNS_R_BADPOINTER";
static const char *a48 =
"when input ends unexpected, dns_name_fromwire() "
"returns ISC_R_UNEXPECTEDEND";
static const char *a49 =
"when there is not enough space in target, "
"dns_name_fromwire(name, source, dcts, downcase, target) "
"returns ISC_R_NOSPACE";
static int
{
int result;
int order;
unsigned int nlabels;
int len;
if (len == 0)
return (T_FAIL);
&iscbuf2);
0, NULL);
if (dns_result == ISC_R_SUCCESS) {
if (dns_namereln != dns_namereln_equal) {
t_info("dns_name_fullcompare returned %s\n",
} else {
}
} else {
t_info("dns_name_fromtext %s failed, result = %s\n",
}
} else if (dns_result == exp_result) {
} else {
t_info("dns_name_fromwire returned %s\n",
}
return (result);
}
static void
int line;
int cnt;
int result;
unsigned int dc_method;
char *p;
char *tok;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 6) {
/*
* datafile_name, testname_offset,
* downcase, dc_method,
* exp_name, exp_result.
*/
Tokens[4],
buflen);
} else {
}
(void)free(p);
}
} else {
}
}
static void
t_dns_name_fromwire(void) {
#if 0
/*
* XXXRTH these tests appear to be broken, so I have
* disabled them.
*/
#endif
}
static const char *a51 =
"dns_name_towire(name, cctx, target) converts the DNS name "
"'name' into wire format, compresses it as specified "
"by the compression context cctx, stores the result in "
"target and returns DNS_SUCCESS";
static const char *a52 =
"when not enough space exists in target, "
"dns_name_towire(name, cctx, target) returns ISC_R_NOSPACE";
static int
{
int result;
int val;
int len;
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed\n");
return (result);
}
if (dns_result == ISC_R_SUCCESS) {
if (dns_result == exp_result) {
if (exp_result == ISC_R_SUCCESS) {
/*
* Compare results with expected data.
*/
if (val == 0)
else
} else
} else {
t_info("dns_name_towire unexpectedly returned %s\n",
}
} else {
t_info("dns_name_fromtext %s failed, result = %s\n",
}
return (result);
}
static void
int line;
int cnt;
int result;
unsigned int dc_method;
char *p;
line = 0;
++line;
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
if (cnt == 5) {
/*
* testname, dc_method,
* exp_data, exp_data_len,
* exp_result.
*/
Tokens[2],
buflen);
} else {
}
(void)free(p);
}
} else {
}
}
static void
t_dns_name_towire_1(void) {
}
static void
t_dns_name_towire_2(void) {
}
static void
t_dns_name_towire(void) {
}
#if 0 /* This is silly. A test should either exist, or not, but not
* one that just returns "UNTESTED."
*/
static const char *a53 =
"dns_name_concatenate(prefix, suffix, name, target) "
"concatenates prefix and suffix, stores the result "
"in target, canonicalizes any bitstring labels "
"and returns ISC_R_SUCCESS";
static void
t_dns_name_concatenate(void) {
}
#endif
testspec_t T_testlist[] = {
#if 0
#endif
};
#ifdef WIN32
int
}
#endif