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: d04c1a1c8e
This commit is contained in:
Lennart Poettering
2024-01-16 13:59:49 +01:00
parent 0ca9a44799
commit e96202fa5d
+3 -4
View File
@@ -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;
}