diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-01-16 13:27:32 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-01-16 13:59:49 +0100 |
commit | e96202fa5da8292b6ff5b3845ed53672d69b1055 (patch) | |
tree | 87430c4f0b0f4f9cb2c72c191ddfa52a0a608bff /src | |
parent | bus-polkit: explicitly cast away return value we ignore (diff) | |
download | systemd-e96202fa5da8292b6ff5b3845ed53672d69b1055.tar.xz systemd-e96202fa5da8292b6ff5b3845ed53672d69b1055.zip |
bus-polkit: don't return positive in varlink_verify_polkit_async() just because we already sent an error reply
A positive return value means "access granted", hence if we already
reply to the method call don't accidentally return positive.
Follow-up for: d04c1a1c8e7c95daa483d8d52d5fc4c25fbc67f2
Diffstat (limited to '')
-rw-r--r-- | src/shared/bus-polkit.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/shared/bus-polkit.c b/src/shared/bus-polkit.c index 1043d33b5e..d05c474e7f 100644 --- a/src/shared/bus-polkit.c +++ b/src/shared/bus-polkit.c @@ -747,10 +747,9 @@ int varlink_verify_polkit_async( if (r < 0) { /* Reply with a nice error */ if (sd_bus_error_has_name(&error, SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED)) - return varlink_error(link, VARLINK_ERROR_INTERACTIVE_AUTHENTICATION_REQUIRED, NULL); - - if (ERRNO_IS_NEG_PRIVILEGE(r)) - return varlink_error(link, VARLINK_ERROR_PERMISSION_DENIED, NULL); + (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; } |