]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: minor dnssec fixups
authorRonan Pigott <ronan@rjp.ie>
Tue, 26 Mar 2024 18:00:44 +0000 (11:00 -0700)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Mar 2024 01:16:38 +0000 (10:16 +0900)
Fixes: ce5b9d5b3c24 ("resolved: request DS with DNSKEY")
src/resolve/resolved-dns-transaction.c

index 2e3af0c445e10808786a6e008b77142b2a912f25..78f370c7c1d7c794df736827e61d55d0fd549697 100644 (file)
@@ -2318,13 +2318,18 @@ static int dns_transaction_request_dnssec_rr_full(DnsTransaction *t, DnsResource
                 if (r < 0)
                         return r;
 
+                if (ret)
+                        *ret = NULL;
                 return 0;
         }
 
         /* This didn't work, ask for it via the network/cache then. */
         r = dns_transaction_add_dnssec_transaction(t, key, &aux);
-        if (r == -ELOOP) /* This would result in a cyclic dependency */
+        if (r == -ELOOP) { /* This would result in a cyclic dependency */
+                if (ret)
+                        *ret = NULL;
                 return 0;
+        }
         if (r < 0)
                 return r;
 
@@ -2490,7 +2495,7 @@ int dns_transaction_request_dnssec_keys(DnsTransaction *t) {
                 case DNS_TYPE_RRSIG: {
                         /* For each RRSIG we request the matching DNSKEY */
                         _cleanup_(dns_resource_key_unrefp) DnsResourceKey *dnskey = NULL;
-                        DnsTransaction *aux = NULL;
+                        DnsTransaction *aux;
 
                         /* If this RRSIG is about a DNSKEY RR and the
                          * signer is the same as the owner, then we
@@ -2537,6 +2542,8 @@ int dns_transaction_request_dnssec_keys(DnsTransaction *t) {
                         if (aux) {
                                 _cleanup_(dns_resource_key_unrefp) DnsResourceKey *ds =
                                         dns_resource_key_new(rr->key->class, DNS_TYPE_DS, dns_resource_key_name(dnskey));
+                                if (!ds)
+                                        return -ENOMEM;
                                 r = dns_transaction_request_dnssec_rr(t, ds);
                                 if (r < 0)
                                         return r;