Solaris 7 and shmem share modes error

Jeremy Allison jeremy at valinux.com
Sat Nov 6 02:14:51 GMT 1999


This will be fixed in 2.0.6, but in the meantime this
patch should tide you over.

Regards,

        Jeremy Allison,
        Samba Team.

---- /usr/people/jallison/tmp/samba-2.0.5a/source/locking/shmem_sysv.c  Tue Jul
20 18:25:11 1999
+++ locking/shmem_sysv.c        Tue Oct 12 17:30:16 1999
@@ -528,6 +528,7 @@
 /*******************************************************************
   open the shared memory
   ******************************************************************/
+
 struct shmem_ops *sysv_shm_open(int ronly)
 {
        BOOL other_processes;
@@ -536,6 +537,8 @@
        union semun su;
        int i;
        pid_t pid;
+       struct passwd *root_pwd = sys_getpwuid((uid_t)0);
+       gid_t root_gid = root_pwd ? root_pwd->pw_gid : (gid_t)0;
 
        read_only = ronly;
 
@@ -593,8 +596,9 @@
        hash_size = sem_ds.sem_nsems-1;
 
        if (!read_only) {
-               if (sem_ds.sem_perm.cuid != 0 || sem_ds.sem_perm.cgid != 0) {
-                       DEBUG(0,("ERROR: root did not create the semaphore\n"));
+               if (sem_ds.sem_perm.cuid != 0 || ((sem_ds.sem_perm.cgid !=
root_gid) && (sem_ds.sem_perm.cgid
!= 0))) {
+                       DEBUG(0,("ERROR: root did not create the semaphore:
semgid=%u, rootgid=%u\n",
+                  (unsigned int)sem_ds.sem_perm.cgid, (unsigned int)root_gid));
                        return NULL;
                }
 
@@ -684,7 +688,7 @@
        }
 
        if (!read_only) {
-               if (shm_ds.shm_perm.cuid != 0 || shm_ds.shm_perm.cgid != 0) {
+               if (shm_ds.shm_perm.cuid != 0 || ((shm_ds.shm_perm.cgid !=
root_gid) && (shm_ds.shm_perm.cgid
!= 0))) {
                        DEBUG(0,("ERROR: root did not create the shmem\n"));
                        global_unlock();
                        return NULL;
-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba mailing list