HPUX shared memory creates error (PR#19573)

Jeremy Allison jallison at cthulhu.engr.sgi.com
Sat Aug 14 00:45:45 GMT 1999


Phillip.Link at alcatel.fr wrote:

> The problem
> -----------
> I've been trying to install the latest samba distrib (2.0.5a) on a hpux
> 10.20 machine, but the connection times out, apparently because of
> shared memory access.
> 
> Trying to make an smbclient connection (or using the windows nt explorer
> to connect generates the following log.smb (smbd launched as smbd -D -d
> 4):
> 
> [1999/08/11 10:14:28, 4] locking/shmem_sysv.c:(544)
>   Trying sysv shmem open of size 1048576
> [1999/08/11 10:14:28, 0] locking/shmem_sysv.c:(597)
>   ERROR: root did not create the semaphore
> [1999/08/11 10:14:28, 0] locking/locking.c:(169)
>   ERROR: Failed to initialise share modes!

Phillip,

	Can you please try this patch to see if it addresses
the problem ?

Regards,

	Jeremy Allison,
	Samba Team.

--- shmem_sysv.c        Tue Aug 10 16:10:18 1999
+++ shmem_sysv.c.fixed  Tue Aug 10 16:08:16 1999
@@ -536,6 +536,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 +595,8 @@
        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=%d, rootgid=%d\n", sem_ds.sem_perm.cgid, root_gid));
                        return NULL;
                }
 
@@ -684,7 +686,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