]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostnamed: drop "iteractive" parameter from GetHardwareSerial()
authorLennart Poettering <lennart@poettering.net>
Thu, 3 Feb 2022 16:41:04 +0000 (17:41 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 3 Feb 2022 19:52:18 +0000 (19:52 +0000)
Since a long time the D-Bus spec knows a special bit in its message
header for indicating that "interactive" authentication is OK. The
original hostnamed API is before that was added hence most functions
expose that boolean as explicit argument.

For new added functions let's get rid of it, the message flag is good
enough and replaces it with complete functionality.

No new APIs should carry the "interactive" boolean flag explicitly as
argument anymore.

Follow-up for: 9697662915e47a4797b05003cb1970fe2b01e530

man/org.freedesktop.hostname1.xml
src/hostname/hostnamed.c

index 5e3bb7807dc9278e09da3655b221a3693a861505..94004002ecf2693ff03170655e95eadca8471207 100644 (file)
@@ -58,8 +58,7 @@ node /org/freedesktop/hostname1 {
                   in  b interactive);
       GetProductUUID(in  b interactive,
                      out ay uuid);
-      GetHardwareSerial(in  b interactive,
-                        out s serial);
+      GetHardwareSerial(out s serial);
       Describe(out s json);
     properties:
       readonly s Hostname = '...';
index 4637ac8817838293f602f6f539d4292e51569414..a60e0f8295895d08c8a25008e1043fcfdec8dce2 100644 (file)
@@ -1082,21 +1082,17 @@ static int method_get_hardware_serial(sd_bus_message *m, void *userdata, sd_bus_
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
         _cleanup_free_ char *serial = NULL;
         Context *c = userdata;
-        int interactive, r;
+        int r;
 
         assert(m);
         assert(c);
 
-        r = sd_bus_message_read(m, "b", &interactive);
-        if (r < 0)
-                return r;
-
         r = bus_verify_polkit_async(
                         m,
                         CAP_SYS_ADMIN,
                         "org.freedesktop.hostname1.get-hardware-serial",
                         NULL,
-                        interactive,
+                        false,
                         UID_INVALID,
                         &c->polkit_registry,
                         error);
@@ -1304,8 +1300,7 @@ static const sd_bus_vtable hostname_vtable[] = {
                                  method_get_product_uuid,
                                  SD_BUS_VTABLE_UNPRIVILEGED),
         SD_BUS_METHOD_WITH_NAMES("GetHardwareSerial",
-                                 "b",
-                                 SD_BUS_PARAM(interactive),
+                                 NULL,,
                                  "s",
                                  SD_BUS_PARAM(serial),
                                  method_get_hardware_serial,