Browse Source

Secure promiscuous mode for shared memory segments

Adjusts the permissions of shared memory segments when promiscuous mode is
enabled.
tags/v1.9.12
Cédric Schieli 8 years ago
parent
commit
325b8ff80f
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      common/shm.c

+ 6
- 0
common/shm.c View File

@@ -52,6 +52,7 @@
#include <sys/shm.h>
#include <sys/sem.h>
#include <stdlib.h>
#include "promiscuous.h"

#endif

@@ -837,6 +838,7 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
int shm_fd;
int rc = -1;
char name[SHM_NAME_MAX+1];
const char* promiscuous;

if (jack_shm_lock_registry () < 0) {
jack_error ("jack_shm_lock_registry fails...");
@@ -877,6 +879,10 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
goto unlock;
}

promiscuous = getenv("JACK_PROMISCUOUS_SERVER");
if ((promiscuous != NULL) && (jack_promiscuous_perms(shm_fd, name, jack_group2gid(promiscuous)) < 0))
goto unlock;

close (shm_fd);
registry->size = size;
strncpy (registry->id, name, sizeof (registry->id));


Loading…
Cancel
Save