diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-06-27 10:09:45 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-06-27 10:43:21 +0200 |
commit | b6464e80d65fd5bfd9e6206ee305f0da9c88c096 (patch) | |
tree | f895d6f30701569e2acea4c6eeef3a3c1528e5bc /src/shared/bus-polkit.c | |
parent | Merge pull request #33493 from poettering/stub-refactor (diff) | |
download | systemd-b6464e80d65fd5bfd9e6206ee305f0da9c88c096.tar.xz systemd-b6464e80d65fd5bfd9e6206ee305f0da9c88c096.zip |
hostnamed: if polkit authentication fails for Varlink Describe() call, don't reply to client with an error
The logic of the Describe() call was supposed to be: if we can acquire
the PK priv to get the product UUID then let's return the product UUID,
and if we cannot then return the data without it.
This didn't work however, since the polkit varlink glue would
immediately propagate the error it acquired from polkit its own client.
Let's turn this off, optionally, so that hostnamed can handle this
nicely.
Diffstat (limited to 'src/shared/bus-polkit.c')
-rw-r--r-- | src/shared/bus-polkit.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shared/bus-polkit.c b/src/shared/bus-polkit.c index aefc84a00c..00c55463c8 100644 --- a/src/shared/bus-polkit.c +++ b/src/shared/bus-polkit.c @@ -786,11 +786,13 @@ int varlink_verify_polkit_async_full( if (r != 0) log_debug("Found matching previous polkit authentication for '%s'.", action); if (r < 0) { - /* Reply with a nice error */ - if (sd_bus_error_has_name(&error, SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED)) - (void) varlink_error(link, VARLINK_ERROR_INTERACTIVE_AUTHENTICATION_REQUIRED, NULL); - else if (ERRNO_IS_NEG_PRIVILEGE(r)) - (void) varlink_error(link, VARLINK_ERROR_PERMISSION_DENIED, NULL); + if (!FLAGS_SET(flags, POLKIT_DONT_REPLY)) { + /* Reply with a nice error */ + if (sd_bus_error_has_name(&error, SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED)) + (void) varlink_error(link, VARLINK_ERROR_INTERACTIVE_AUTHENTICATION_REQUIRED, NULL); + else if (ERRNO_IS_NEG_PRIVILEGE(r)) + (void) varlink_error(link, VARLINK_ERROR_PERMISSION_DENIED, NULL); + } return r; } |