1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

hostnamed: drop "iteractive" parameter from GetHardwareSerial()

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: 9697662915
This commit is contained in:
Lennart Poettering 2022-02-03 17:41:04 +01:00 committed by Luca Boccassi
parent 79decacff0
commit ff28d259c0
2 changed files with 4 additions and 10 deletions

View File

@ -58,8 +58,7 @@ node /org/freedesktop/hostname1 {
in b interactive); in b interactive);
GetProductUUID(in b interactive, GetProductUUID(in b interactive,
out ay uuid); out ay uuid);
GetHardwareSerial(in b interactive, GetHardwareSerial(out s serial);
out s serial);
Describe(out s json); Describe(out s json);
properties: properties:
readonly s Hostname = '...'; readonly s Hostname = '...';

View 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_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_free_ char *serial = NULL; _cleanup_free_ char *serial = NULL;
Context *c = userdata; Context *c = userdata;
int interactive, r; int r;
assert(m); assert(m);
assert(c); assert(c);
r = sd_bus_message_read(m, "b", &interactive);
if (r < 0)
return r;
r = bus_verify_polkit_async( r = bus_verify_polkit_async(
m, m,
CAP_SYS_ADMIN, CAP_SYS_ADMIN,
"org.freedesktop.hostname1.get-hardware-serial", "org.freedesktop.hostname1.get-hardware-serial",
NULL, NULL,
interactive, false,
UID_INVALID, UID_INVALID,
&c->polkit_registry, &c->polkit_registry,
error); error);
@ -1304,8 +1300,7 @@ static const sd_bus_vtable hostname_vtable[] = {
method_get_product_uuid, method_get_product_uuid,
SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD_WITH_NAMES("GetHardwareSerial", SD_BUS_METHOD_WITH_NAMES("GetHardwareSerial",
"b", NULL,,
SD_BUS_PARAM(interactive),
"s", "s",
SD_BUS_PARAM(serial), SD_BUS_PARAM(serial),
method_get_hardware_serial, method_get_hardware_serial,