diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-03-03 00:17:46 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-03-14 11:23:02 +0100 |
| commit | 46a93d01e73374223ba9bca67215dc959a3a0fab (patch) | |
| tree | 474b50f1afdad05b01d2ee2b52877678aa44cafa /src/lib/ssm | |
| parent | 1f84236b0a7bbf364b4901dc13bcd6561f26214c (diff) | |
| download | ouroboros-46a93d01e73374223ba9bca67215dc959a3a0fab.tar.gz ouroboros-46a93d01e73374223ba9bca67215dc959a3a0fab.zip | |
lib: Fix chown of GSPP to ouroboros group
The Global Shared Packet Pool (GSPP) was not correctly chowned to the
ouroboros group.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/ssm')
| -rw-r--r-- | src/lib/ssm/pool.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/ssm/pool.c b/src/lib/ssm/pool.c index 5c98b515..f17a6e65 100644 --- a/src/lib/ssm/pool.c +++ b/src/lib/ssm/pool.c @@ -107,6 +107,8 @@ static const struct ssm_size_class_cfg ssm_pup_cfg[SSM_POOL_MAX_CLASSES] = { : SSM_PUP_FILE_SIZE) #define GET_POOL_CFG(uid) (IS_GSPP(uid) ? ssm_gspp_cfg : ssm_pup_cfg) +#define NEEDS_CHOWN(uid, gid) ((uid) != geteuid() || (gid) != getegid()) + struct ssm_pool { uint8_t * shm_base; /* start of blocks */ struct _ssm_pool_hdr * hdr; /* shared memory header */ @@ -548,7 +550,7 @@ static struct ssm_pool * __pool_create(const char * name, if (flags & O_CREAT) { if (ftruncate(fd, (off_t) file_size) < 0) goto fail_truncate; - if (uid != geteuid() && fchown(fd, uid, gid) < 0) + if (NEEDS_CHOWN(uid, gid) && fchown(fd, uid, gid) < 0) goto fail_truncate; } |
