resolve: use dns_name_hash_ops_free for dnssec negative trust anchor
This commit is contained in:
@@ -196,10 +196,6 @@ static int dns_trust_anchor_add_builtin_negative(DnsTrustAnchor *d) {
|
||||
if (!set_isempty(d->negative_by_name))
|
||||
return 0;
|
||||
|
||||
r = set_ensure_allocated(&d->negative_by_name, &dns_name_hash_ops);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* We add a couple of domains as default negative trust
|
||||
* anchors, where it's very unlikely they will be installed in
|
||||
* the root zone. If they exist they must be private, and thus
|
||||
@@ -209,7 +205,7 @@ static int dns_trust_anchor_add_builtin_negative(DnsTrustAnchor *d) {
|
||||
if (dns_trust_anchor_knows_domain_positive(d, name))
|
||||
continue;
|
||||
|
||||
r = set_put_strdup(&d->negative_by_name, name);
|
||||
r = set_put_strdup_full(&d->negative_by_name, &dns_name_hash_ops_free, name);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
@@ -547,7 +543,7 @@ void dns_trust_anchor_flush(DnsTrustAnchor *d) {
|
||||
|
||||
d->positive_by_key = hashmap_free_with_destructor(d->positive_by_key, dns_answer_unref);
|
||||
d->revoked_by_rr = set_free_with_destructor(d->revoked_by_rr, dns_resource_record_unref);
|
||||
d->negative_by_name = set_free_free(d->negative_by_name);
|
||||
d->negative_by_name = set_free(d->negative_by_name);
|
||||
}
|
||||
|
||||
int dns_trust_anchor_lookup_positive(DnsTrustAnchor *d, const DnsResourceKey *key, DnsAnswer **ret) {
|
||||
|
||||
@@ -658,7 +658,7 @@ int bus_link_method_set_dnssec(sd_bus_message *message, void *userdata, sd_bus_e
|
||||
}
|
||||
|
||||
int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
_cleanup_set_free_free_ Set *ns = NULL;
|
||||
_cleanup_set_free_ Set *ns = NULL;
|
||||
_cleanup_strv_free_ char **ntas = NULL;
|
||||
_cleanup_free_ char *j = NULL;
|
||||
Link *l = ASSERT_PTR(userdata);
|
||||
@@ -670,7 +670,7 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
ns = set_new(&dns_name_hash_ops);
|
||||
ns = set_new(&dns_name_hash_ops_free);
|
||||
if (!ns)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -708,8 +708,7 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v
|
||||
bus_client_log(message, "DNSSEC NTA change");
|
||||
|
||||
if (!set_equal(ns, l->dnssec_negative_trust_anchors)) {
|
||||
set_free_free(l->dnssec_negative_trust_anchors);
|
||||
l->dnssec_negative_trust_anchors = TAKE_PTR(ns);
|
||||
set_free_and_replace(l->dnssec_negative_trust_anchors, ns);
|
||||
|
||||
(void) link_save_user(l);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void link_flush_settings(Link *l) {
|
||||
dns_server_unlink_all(l->dns_servers);
|
||||
dns_search_domain_unlink_all(l->search_domains);
|
||||
|
||||
l->dnssec_negative_trust_anchors = set_free_free(l->dnssec_negative_trust_anchors);
|
||||
l->dnssec_negative_trust_anchors = set_free(l->dnssec_negative_trust_anchors);
|
||||
}
|
||||
|
||||
Link *link_free(Link *l) {
|
||||
@@ -459,12 +459,12 @@ static int link_update_dnssec_mode(Link *l) {
|
||||
|
||||
static int link_update_dnssec_negative_trust_anchors(Link *l) {
|
||||
_cleanup_strv_free_ char **ntas = NULL;
|
||||
_cleanup_set_free_free_ Set *ns = NULL;
|
||||
_cleanup_set_free_ Set *ns = NULL;
|
||||
int r;
|
||||
|
||||
assert(l);
|
||||
|
||||
l->dnssec_negative_trust_anchors = set_free_free(l->dnssec_negative_trust_anchors);
|
||||
l->dnssec_negative_trust_anchors = set_free(l->dnssec_negative_trust_anchors);
|
||||
|
||||
r = sd_network_link_get_dnssec_negative_trust_anchors(l->ifindex, &ntas);
|
||||
if (r == -ENODATA)
|
||||
@@ -472,7 +472,7 @@ static int link_update_dnssec_negative_trust_anchors(Link *l) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
ns = set_new(&dns_name_hash_ops);
|
||||
ns = set_new(&dns_name_hash_ops_free);
|
||||
if (!ns)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1425,9 +1425,9 @@ int link_load_user(Link *l) {
|
||||
}
|
||||
|
||||
if (ntas) {
|
||||
_cleanup_set_free_free_ Set *ns = NULL;
|
||||
_cleanup_set_free_ Set *ns = NULL;
|
||||
|
||||
ns = set_new(&dns_name_hash_ops);
|
||||
ns = set_new(&dns_name_hash_ops_free);
|
||||
if (!ns) {
|
||||
r = -ENOMEM;
|
||||
goto fail;
|
||||
|
||||
Reference in New Issue
Block a user