ryantimwilson / rpms / systemd

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