ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
4fbe94
From 7b00cae817e54ee3398ad3b42ec69a3b63676562 Mon Sep 17 00:00:00 2001
4fbe94
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4fbe94
Date: Tue, 27 Aug 2019 19:28:19 +0200
4fbe94
Subject: [PATCH] resolved: query polkit only after parsing the data
4fbe94
4fbe94
That's what we do everywhere else because it leads to nicer user experience.
4fbe94
4fbe94
Related: #1746857
4fbe94
---
4fbe94
 src/resolve/resolved-bus.c | 18 +++++++++---------
4fbe94
 1 file changed, 9 insertions(+), 9 deletions(-)
4fbe94
4fbe94
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
4fbe94
index 4d6cc4fd48..3f6a6f9e12 100644
4fbe94
--- a/src/resolve/resolved-bus.c
4fbe94
+++ b/src/resolve/resolved-bus.c
4fbe94
@@ -1632,15 +1632,6 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
4fbe94
         if (m->mdns_support != RESOLVE_SUPPORT_YES)
4fbe94
                 return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Support for MulticastDNS is disabled");
4fbe94
 
4fbe94
-        r = bus_verify_polkit_async(message, CAP_SYS_ADMIN,
4fbe94
-                                    "org.freedesktop.resolve1.register-service",
4fbe94
-                                    NULL, false, UID_INVALID,
4fbe94
-                                    &m->polkit_registry, error);
4fbe94
-        if (r < 0)
4fbe94
-                return r;
4fbe94
-        if (r == 0)
4fbe94
-                return 1; /* Polkit will call us back */
4fbe94
-
4fbe94
         service = new0(DnssdService, 1);
4fbe94
         if (!service)
4fbe94
                 return log_oom();
4fbe94
@@ -1765,6 +1756,15 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
4fbe94
         if (r < 0)
4fbe94
                 return r;
4fbe94
 
4fbe94
+        r = bus_verify_polkit_async(message, CAP_SYS_ADMIN,
4fbe94
+                                    "org.freedesktop.resolve1.register-service",
4fbe94
+                                    NULL, false, UID_INVALID,
4fbe94
+                                    &m->polkit_registry, error);
4fbe94
+        if (r < 0)
4fbe94
+                return r;
4fbe94
+        if (r == 0)
4fbe94
+                return 1; /* Polkit will call us back */
4fbe94
+
4fbe94
         r = hashmap_ensure_allocated(&m->dnssd_services, &string_hash_ops);
4fbe94
         if (r < 0)
4fbe94
                 return r;