long val;
struct semid_ds *buf;
ushort *array;
-};
+ };
#endif
union semun ick;
struct semid_ds buf;
return APR_SUCCESS;
}
+AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
+{
+/* MPM shouldn't call us unless we're actually using a SysV sem;
+ * this is just to avoid compile issues on systems without that
+ * feature
+ */
+#if APR_HAS_SYSVSEM_SERIALIZE
+ apr_os_proc_mutex_t ospmutex;
+#if !APR_HAVE_UNION_SEMUN
+ union semun {
+ long val;
+ struct semid_ds *buf;
+ ushort *array;
+ };
+#endif
+ union semun ick;
+ struct semid_ds buf;
+
+ if (!geteuid()) {
+ apr_os_proc_mutex_get(&ospmutex, pmutex);
+ buf.sem_perm.uid = unixd_config.user_id;
+ buf.sem_perm.gid = unixd_config.group_id;
+ buf.sem_perm.mode = 0600;
+ ick.buf = &buf;
+ if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) {
+ return errno;
+ }
+ }
+#endif
+ return APR_SUCCESS;
+}
+
#include "apr_hooks.h"
#include "apr_thread_proc.h"
#include "apr_lock.h"
+#include "apr_proc_mutex.h"
#include <pwd.h>
#include <grp.h>
const char *arg, const char * arg2, int type);
#endif
AP_DECLARE(apr_status_t) unixd_set_lock_perms(apr_lock_t *lock);
+AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex);
#ifdef HAVE_KILLPG
#define unixd_killpg(x, y) (killpg ((x), (y)))