resolved: fix cname handling

This commit is contained in:
Lennart Poettering 2014-07-30 14:46:40 +02:00
parent 0ec7c46eed
commit 34b9656f0b
1 changed files with 4 additions and 2 deletions

View File

@ -115,7 +115,7 @@ int dns_question_matches_cname(DnsQuestion *q, DnsResourceRecord *rr) {
return r; return r;
} }
return 1; return 0;
} }
int dns_question_is_valid(DnsQuestion *q) { int dns_question_is_valid(DnsQuestion *q) {
@ -137,6 +137,8 @@ int dns_question_is_valid(DnsQuestion *q) {
/* Check that all keys in this question bear the same name */ /* Check that all keys in this question bear the same name */
for (i = 1; i < q->n_keys; i++) { for (i = 1; i < q->n_keys; i++) {
assert(q->keys[i]);
r = dns_name_equal(DNS_RESOURCE_KEY_NAME(q->keys[i]), name); r = dns_name_equal(DNS_RESOURCE_KEY_NAME(q->keys[i]), name);
if (r <= 0) if (r <= 0)
return r; return r;
@ -218,7 +220,7 @@ int dns_question_cname_redirect(DnsQuestion *q, const char *name, DnsQuestion **
return -ENOMEM; return -ENOMEM;
/* Create a new question, and patch in the new name */ /* Create a new question, and patch in the new name */
for (n->n_keys = 0; n->n_keys < q->n_keys; n->n_keys++) { for (i = 0; i < q->n_keys; i++) {
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *k = NULL; _cleanup_(dns_resource_key_unrefp) DnsResourceKey *k = NULL;
k = dns_resource_key_new(q->keys[i]->class, q->keys[i]->type, name); k = dns_resource_key_new(q->keys[i]->class, q->keys[i]->type, name);