1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

resolve: remove always-true superflous check and rename label

Fixes https://github.com/systemd/systemd/security/code-scanning/2900
This commit is contained in:
Luca Boccassi 2024-11-01 13:51:57 +00:00
parent 74a17f875f
commit ffd81a1202

View File

@ -912,7 +912,7 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
if (r == -ELOOP) if (r == -ELOOP)
return (void) sd_varlink_error(q->varlink_request, "io.systemd.Resolve.CNAMELoop", NULL); return (void) sd_varlink_error(q->varlink_request, "io.systemd.Resolve.CNAMELoop", NULL);
if (r < 0) if (r < 0)
goto finish; goto fail;
if (r == DNS_QUERY_CNAME) { if (r == DNS_QUERY_CNAME) {
/* This was a cname, and the query was restarted. */ /* This was a cname, and the query was restarted. */
TAKE_PTR(q); TAKE_PTR(q);
@ -924,7 +924,7 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) { DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) {
r = dns_question_matches_rr(question, rr, NULL); r = dns_question_matches_rr(question, rr, NULL);
if (r < 0) if (r < 0)
goto finish; goto fail;
if (r == 0) if (r == 0)
continue; continue;
@ -942,7 +942,7 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
q->block_all_complete--; q->block_all_complete--;
if (r < 0) if (r < 0)
goto finish; goto fail;
} }
found++; found++;
@ -961,11 +961,9 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
resolve_service_all_complete(TAKE_PTR(q)); resolve_service_all_complete(TAKE_PTR(q));
return; return;
finish: fail:
if (r < 0) { log_error_errno(r, "Failed to send address reply: %m");
log_error_errno(r, "Failed to send address reply: %m"); (void) sd_varlink_error_errno(q->varlink_request, r);
(void) sd_varlink_error_errno(q->varlink_request, r);
}
} }
static int vl_method_resolve_service(sd_varlink* link, sd_json_variant* parameters, sd_varlink_method_flags_t flags, void* userdata) { static int vl_method_resolve_service(sd_varlink* link, sd_json_variant* parameters, sd_varlink_method_flags_t flags, void* userdata) {