diff options
author | Tom Gundersen <teg@jklm.no> | 2015-11-24 00:46:15 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-11-24 00:46:15 +0100 |
commit | e35a7876b4ab1d53a7539a905613e31dc6ae50fd (patch) | |
tree | 6bd66bd31b067769616ecc394be649d97455237b /src/test | |
parent | 556f107f95a2b3e59162f8282ce2d717bbfd2e2a (diff) | |
parent | ccc3e8a104b8ccabb2cde99cc18ed5ac5a8ad883 (diff) |
Merge pull request #2011 from poettering/resolve-dname
Implement client-side DNAME RR resolving
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-dns-domain.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c index a664e1c79c..b76a31a549 100644 --- a/src/test/test-dns-domain.c +++ b/src/test/test-dns-domain.c @@ -408,6 +408,25 @@ static void test_dns_service_split(void) { test_dns_service_split_one("Wuff\\032Wuff._foo._bar.waldo.com", "Wuff Wuff", "_foo._bar", "waldo.com", 0); } +static void test_dns_name_change_suffix_one(const char *name, const char *old_suffix, const char *new_suffix, int r, const char *result) { + _cleanup_free_ char *s = NULL; + + assert_se(dns_name_change_suffix(name, old_suffix, new_suffix, &s) == r); + assert_se(streq_ptr(s, result)); +} + +static void test_dns_name_change_suffix(void) { + test_dns_name_change_suffix_one("foo.bar", "bar", "waldo", 1, "foo.waldo"); + test_dns_name_change_suffix_one("foo.bar.waldi.quux", "foo.bar.waldi.quux", "piff.paff", 1, "piff.paff"); + test_dns_name_change_suffix_one("foo.bar.waldi.quux", "bar.waldi.quux", "piff.paff", 1, "foo.piff.paff"); + test_dns_name_change_suffix_one("foo.bar.waldi.quux", "waldi.quux", "piff.paff", 1, "foo.bar.piff.paff"); + test_dns_name_change_suffix_one("foo.bar.waldi.quux", "quux", "piff.paff", 1, "foo.bar.waldi.piff.paff"); + test_dns_name_change_suffix_one("foo.bar.waldi.quux", "", "piff.paff", 1, "foo.bar.waldi.quux.piff.paff"); + test_dns_name_change_suffix_one("", "", "piff.paff", 1, "piff.paff"); + test_dns_name_change_suffix_one("", "", "", 1, ""); + test_dns_name_change_suffix_one("a", "b", "c", 0, NULL); +} + int main(int argc, char *argv[]) { test_dns_label_unescape(); @@ -427,6 +446,7 @@ int main(int argc, char *argv[]) { test_dns_srv_type_verify(); test_dns_service_join(); test_dns_service_split(); + test_dns_name_change_suffix(); return 0; } |