]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: refuse invalid service without type field 33939/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 Aug 2024 01:46:41 +0000 (10:46 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 Aug 2024 01:47:11 +0000 (10:47 +0900)
Fixes Fixes #33935.

src/resolve/resolved-bus.c
src/resolve/resolved-varlink.c

index d6d2273dc9dc56f82ca387e2c4ed3d3e48653e2f..847bb6bc6ec43cafe12d8ebb121058ab95d38077 100644 (file)
@@ -1148,6 +1148,11 @@ static void resolve_service_all_complete(DnsQuery *query) {
         if (r < 0)
                 goto finish;
 
+        if (isempty(type)) {
+                r = reply_method_errorf(q, BUS_ERROR_NO_SUCH_SERVICE, "'%s' does not provide valid service", dns_query_string(q));
+                goto finish;
+        }
+
         r = sd_bus_message_append(
                         reply,
                         "ssst",
index 6708159323d9696c0cfefd35d9874c9dde16826c..f2fbf7a5232da53958a9fb5338e1bf55be4fb1ca 100644 (file)
@@ -828,6 +828,11 @@ static void resolve_service_all_complete(DnsQuery *query) {
         if (r < 0)
                 goto finish;
 
+        if (isempty(type)) {
+                r = sd_varlink_error(q->varlink_request, "io.systemd.Resolve.ServiceNotProvided", NULL);
+                goto finish;
+        }
+
         r = sd_varlink_replybo(
                         query->varlink_request,
                         SD_JSON_BUILD_PAIR("services", SD_JSON_BUILD_VARIANT(srv)),