module-access: Relax access check errors

Assume -EACCES is a normal thing when checking /proc/<pid>/root and
continue with just an info message. Log a warning and assume
flatpak for all other errors.

Fixes #432
This commit is contained in:
Wim Taymans 2021-01-20 12:12:56 +01:00
parent 675a12ef33
commit 4084db8641

View file

@ -110,7 +110,7 @@ static int check_flatpak(struct pw_impl_client *client, int pid)
/* Not able to open the root dir shouldn't happen. Probably the app died and
* we're failing due to /proc/$pid not existing. In that case fail instead
* of treating this as privileged. */
pw_log_error("failed to open \"%s\": %s", root_path, spa_strerror(res));
pw_log_info("failed to open \"%s\": %s", root_path, spa_strerror(res));
return res;
}
info_fd = openat (root_fd, ".flatpak-info", O_RDONLY | O_CLOEXEC | O_NOCTTY);
@ -204,12 +204,12 @@ context_check_access(void *data, struct pw_impl_client *client)
res = check_flatpak(client, pid);
if (res != 0) {
if (res < 0) {
pw_log_warn(NAME" %p: client %p sandbox check failed: %s",
impl, client, spa_strerror(res));
if (res == -EACCES) {
access = "unrestricted";
goto granted;
}
pw_log_warn(NAME" %p: client %p sandbox check failed: %s",
impl, client, spa_strerror(res));
}
else if (res > 0) {
pw_log_debug(NAME" %p: flatpak client %p added", impl, client);