summaryrefslogtreecommitdiff
path: root/src/test/test-dns-domain.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-21 21:06:29 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-26 19:09:10 +0100
commitdb5b0e92b3c23e6f360bd0f44a655b35921a6c98 (patch)
treefd0e65c2ffbb98361882c76bbbabd6408ec91a2d /src/test/test-dns-domain.c
parent13b78323bad1e41e0474b833da2a0b72aab56f09 (diff)
resolved: tighten search for NSEC3 RRs a bit
Be stricter when searching suitable NSEC3 RRs for proof: generalize the check we use to find suitable NSEC3 RRs, in nsec3_is_good(), and add additional checks, such as checking whether all NSEC3 RRs use the same parameters, have the same suffix and so on.
Diffstat (limited to 'src/test/test-dns-domain.c')
-rw-r--r--src/test/test-dns-domain.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c
index 3a15ea5c06..78c5631ff1 100644
--- a/src/test/test-dns-domain.c
+++ b/src/test/test-dns-domain.c
@@ -515,6 +515,37 @@ static void test_dns_name_count_labels(void) {
test_dns_name_count_labels_one("..", -EINVAL);
}
+static void test_dns_name_equal_skip_one(const char *a, unsigned n_labels, const char *b, int ret) {
+ assert_se(dns_name_equal_skip(a, n_labels, b) == ret);
+}
+
+static void test_dns_name_equal_skip(void) {
+ test_dns_name_equal_skip_one("foo", 0, "bar", 0);
+ test_dns_name_equal_skip_one("foo", 0, "foo", 1);
+ test_dns_name_equal_skip_one("foo", 1, "foo", 0);
+ test_dns_name_equal_skip_one("foo", 2, "foo", 0);
+
+ test_dns_name_equal_skip_one("foo.bar", 0, "foo.bar", 1);
+ test_dns_name_equal_skip_one("foo.bar", 1, "foo.bar", 0);
+ test_dns_name_equal_skip_one("foo.bar", 2, "foo.bar", 0);
+ test_dns_name_equal_skip_one("foo.bar", 3, "foo.bar", 0);
+
+ test_dns_name_equal_skip_one("foo.bar", 0, "bar", 0);
+ test_dns_name_equal_skip_one("foo.bar", 1, "bar", 1);
+ test_dns_name_equal_skip_one("foo.bar", 2, "bar", 0);
+ test_dns_name_equal_skip_one("foo.bar", 3, "bar", 0);
+
+ test_dns_name_equal_skip_one("foo.bar", 0, "", 0);
+ test_dns_name_equal_skip_one("foo.bar", 1, "", 0);
+ test_dns_name_equal_skip_one("foo.bar", 2, "", 1);
+ test_dns_name_equal_skip_one("foo.bar", 3, "", 0);
+
+ test_dns_name_equal_skip_one("", 0, "", 1);
+ test_dns_name_equal_skip_one("", 1, "", 0);
+ test_dns_name_equal_skip_one("", 1, "foo", 0);
+ test_dns_name_equal_skip_one("", 2, "foo", 0);
+}
+
int main(int argc, char *argv[]) {
test_dns_label_unescape();
@@ -537,6 +568,7 @@ int main(int argc, char *argv[]) {
test_dns_name_change_suffix();
test_dns_name_suffix();
test_dns_name_count_labels();
+ test_dns_name_equal_skip();
return 0;
}