Revert "impl-core: require WX flags to destroy an object"

This reverts commit c14e89a578.

This makes it impossible for flatpak apps to remove links. Maybe:

- Flatpaks apps are not allowed to make lingering links
- Flatpak apps can only delete their own links.
- Some flatpaks apps needs to be tagged as manager in order to created
  lingering links and destroy any link.

Fixes #1920
This commit is contained in:
Wim Taymans 2021-12-18 08:42:03 +01:00
parent f8cdc05720
commit abbb034fa4
2 changed files with 5 additions and 6 deletions

View file

@ -110,7 +110,7 @@ static int registry_destroy(void *object, uint32_t id)
if (!PW_PERM_IS_R(permissions))
goto error_no_id;
if (id == PW_ID_CORE || !PW_PERM_CHECK(permissions, PW_PERM_X|PW_PERM_W))
if (id == PW_ID_CORE || !PW_PERM_IS_X(permissions))
goto error_not_allowed;
pw_log_debug("global %p: destroy global id %d", global, id);

View file

@ -53,11 +53,10 @@ extern "C" {
#define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
#define PW_PERM_RWXM (PW_PERM_RWX|PW_PERM_M)
#define PW_PERM_CHECK(p,b) (((p)&(b)) == (b))
#define PW_PERM_IS_R(p) PW_PERM_CHECK(p, PW_PERM_R)
#define PW_PERM_IS_W(p) PW_PERM_CHECK(p, PW_PERM_W)
#define PW_PERM_IS_X(p) PW_PERM_CHECK(p, PW_PERM_X)
#define PW_PERM_IS_M(p) PW_PERM_CHECK(p, PW_PERM_M)
#define PW_PERM_IS_R(p) (((p)&PW_PERM_R) == PW_PERM_R)
#define PW_PERM_IS_W(p) (((p)&PW_PERM_W) == PW_PERM_W)
#define PW_PERM_IS_X(p) (((p)&PW_PERM_X) == PW_PERM_X)
#define PW_PERM_IS_M(p) (((p)&PW_PERM_M) == PW_PERM_M)
#define PW_PERM_ALL PW_PERM_RWXM
#define PW_PERM_INVALID (uint32_t)(0xffffffff)