Changeset 150

Show
Ignore:
Timestamp:
02/08/06 10:45:50 (3 years ago)
Author:
zoeloelip
Message:

The owner of the a sysvipc mutex will now be changed on creation of

of the mutex. The user will be set to the uid set with
--with-eaccelerator-userid. This way the semaphore doesn't need to
be public writable anymore.

Moved some inactive contributors to the inactive list.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/AUTHORS

    r84 r150  
    11Actual Team : 
    2 - Frank Alcantara  <frankalcantara at users.sourceforge.net> 
    32- Franck Tabary <franck34 at users.sourceforge.net> 
    43- Bart Vanbrabant <zoeloelip at users.sourceforge.net> 
    5 - Shin Seung Woo <segv74 at users.sourceforge.net> 
    64 
    75Inactive member(s) : 
    86- Everaldo Canuto <everaldo_canuto at users.sourceforge.net> 
    97- Reiner Jung  <reinerj at users.sourceforge.net>   
     8- Shin Seung Woo <segv74 at users.sourceforge.net> 
     9- Frank Alcantara  <frankalcantara at users.sourceforge.net> 
    1010 
    1111eAccelerator is based on Turck MMCache, written by 
  • eaccelerator/trunk/ChangeLog

    r144 r150  
     12006-02-08 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * The owner of the a sysvipc mutex will now be changed on creation of 
     4          of the mutex. The user will be set to the uid set with  
     5          --with-eaccelerator-userid. This way the semaphore doesn't need to 
     6          be public writable anymore. 
     7        * Moved some inactive contributors to the inactive list. 
     8 
    192006-01-10 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    210 
  • eaccelerator/trunk/config.m4

    r134 r150  
    9393]) 
    9494 
     95AC_ARG_WITH(eaccelerator-userid, 
     96[  --with-eaccelerator-userid               eAccelerator runs under this userid, only needed when using sysvipc semaphores.],[ 
     97  ea_userid=$withval 
     98],[ 
     99  ea_userid=0 
     100]) 
     101 
    95102dnl PHP_BUILD_SHARED 
    96103if test "$PHP_EACCELERATOR" != "no"; then 
     
    98105  AC_DEFINE(HAVE_EACCELERATOR, 1, [Define if you like to use eAccelerator]) 
    99106 
     107  AC_DEFINE_UNQUOTED(EA_USERID, $ea_userid, [The userid eAccelerator will be running under.])  
     108     
    100109  if test "$eaccelerator_crash_detection" = "yes"; then 
    101110    AC_DEFINE(WITH_EACCELERATOR_CRASH_DETECTION, 1, [Define if you like to release eAccelerator resources on PHP crash]) 
     
    301310    msg="spinlock" 
    302311  elif test "$mm_sem_ipc" = "yes"; then 
    303     AC_DEFINE(MM_SEM_IPC, 1, [Define if you like to use sysvipc based semaphores]) 
    304     msg="sysvipc" 
     312    if test $ea_userid = 0; then 
     313        AC_MSG_ERROR("You need to pass the user id eaccelerator will be running under when using sysvipc semaphores") 
     314    else 
     315        AC_DEFINE(MM_SEM_IPC, 1, [Define if you like to use sysvipc based semaphores]) 
     316        msg="sysvipc" 
     317    fi 
    305318  elif test "$mm_sem_fcntl" = "yes"; then 
    306319    AC_DEFINE(MM_SEM_FCNTL, 1, [Define if you like to use fcntl based semaphores]) 
  • eaccelerator/trunk/eaccelerator.c

    r140 r150  
    247247  } 
    248248  EACCELERATOR_UNLOCK_RW(); 
    249 } 
    250  
    251 /* check the cache dir */ 
    252 static int check_cache_dir(char *cache_dir) { 
    253   struct stat buf; 
    254 //  int uid = 0; 
    255 //  int gid = 0; 
    256    
    257   if (stat(cache_dir, &buf) == -1) { 
    258     ea_debug_error("Cache dir does not exist (could not stat %s)\n", cache_dir); 
    259     return FAILURE; 
    260   } 
    261   if (!(buf.st_mode & S_IFDIR)) { 
    262     ea_debug_error("%s is not a directory!\n", cache_dir); 
    263     return FAILURE; 
    264   } 
    265 #if 0 
    266   uid = getuid(); 
    267   gid = getgid(); 
    268   if (!((buf.st_uid == uid && (buf.st_mode & (S_IRUSR | S_IWUSR))) /* not root, owner and rw */ 
    269         || (buf.st_gid == gid && (buf.st_mode & (S_IRGRP | S_IWGRP))) /* not root, group and rw */ 
    270         || (buf.st_mode & (S_IROTH & S_IWOTH)))) { /* other and rw */ 
    271     ea_debug_error("%s hasn't got the right permissions!\n", cache_dir); 
    272     return 0; 
    273   } 
    274 #endif 
    275   return SUCCESS; 
    276249} 
    277250 
     
    20231996      eaccelerator_mm_instance->enabled = 0; 
    20241997    } 
    2025 #if 0 
    2026     if (!eaccelerator_scripts_shm_only && check_cache_dir(EAG(cache_dir)) == FAILURE) { 
    2027       zend_error(E_CORE_WARNING,"[%s] Can not init the cache directory", EACCELERATOR_EXTENSION_NAME); 
    2028       /* disable eA */ 
    2029       eaccelerator_mm_instance->enabled = 0; 
    2030     } 
    2031 #endif 
    20321998    mm_saved_zend_compile_file = zend_compile_file; 
    20331999 
  • eaccelerator/trunk/mm.c

    r131 r150  
    322322  int rc; 
    323323  union semun arg; 
    324  
    325   if ((lock->semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0666)) < 0) { 
    326     return 0; 
    327   } 
     324  struct semid_ds buf; 
     325 
     326  if ((lock->semid = semget(IPC_PRIVATE, 1, IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR)) < 0) { 
     327    return 0; 
     328  } 
     329 
     330  arg.buf = &buf; 
     331  do { 
     332    rc = semctl(lock->semid, 0, IPC_STAT, arg); 
     333  } while (rc < 0 && errno == EINTR); 
     334 
     335  buf.sem_perm.uid = EA_USERID; 
     336 
     337  do { 
     338    rc = semctl(lock->semid, 0, IPC_SET, arg); 
     339  } while (rc < 0 && errno == EINTR); 
     340   
    328341  arg.val = 1; 
    329342  do {