mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Merge branch '3998-check-countlabels' into 'main'
Check dns_name_countlabels() wrt DNS_NAME_MAXLABELS Closes #3998 See merge request isc-projects/bind9!7822
This commit is contained in:
@@ -705,8 +705,19 @@ ISC_RUN_TEST_IMPL(countlabels) {
|
|||||||
const char *namestr;
|
const char *namestr;
|
||||||
unsigned int expect;
|
unsigned int expect;
|
||||||
} testcases[] = {
|
} testcases[] = {
|
||||||
{ "c.d", 2 }, { "c.d.", 3 }, { "a.b.c.d.", 5 },
|
{ "c.d", 2 },
|
||||||
{ "a.b.c.d", 4 }, { "a.b.c", 3 }, { ".", 1 },
|
{ "c.d.", 3 },
|
||||||
|
{ "a.b.c.d.", 5 },
|
||||||
|
{ "a.b.c.d", 4 },
|
||||||
|
{ "a.b.c", 3 },
|
||||||
|
{ ".", 1 },
|
||||||
|
{ "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y."
|
||||||
|
"a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y."
|
||||||
|
"a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y."
|
||||||
|
"a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y."
|
||||||
|
"a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y."
|
||||||
|
"a.b.",
|
||||||
|
128 },
|
||||||
};
|
};
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -845,6 +856,7 @@ ISC_RUN_TEST_IMPL(maxlabels) {
|
|||||||
result = dns_name_fromstring(name, one_too_many + 2, 0, NULL);
|
result = dns_name_fromstring(name, one_too_many + 2, 0, NULL);
|
||||||
assert_int_equal(result, ISC_R_SUCCESS);
|
assert_int_equal(result, ISC_R_SUCCESS);
|
||||||
assert_true(dns_name_isvalid(name));
|
assert_true(dns_name_isvalid(name));
|
||||||
|
assert_int_equal(dns_name_countlabels(name), DNS_NAME_MAXLABELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DNS_BENCHMARK_TESTS
|
#ifdef DNS_BENCHMARK_TESTS
|
||||||
|
Reference in New Issue
Block a user