You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ruediger Pluem <rp...@apache.org> on 2009/02/07 10:21:08 UTC
Re: svn commit: r741862 - in /apr/apr/trunk: ./ include/ include/arch/unix/
locks/beos/ locks/netware/ locks/os2/ locks/unix/ locks/win32/ shmem/beos/
shmem/os2/ shmem/unix/ shmem/win32/ threadproc/beos/ threadproc/netware/
threadproc/os2/ threadproc/unix/...
On 02/07/2009 10:05 AM, mturk@apache.org wrote:
> Author: mturk
> Date: Sat Feb 7 09:05:54 2009
> New Revision: 741862
>
> URL: http://svn.apache.org/viewvc?rev=741862&view=rev
> Log:
> Add object perms set macros and implement them for shm and mutex
>
> Added:
> apr/apr/trunk/include/apr_perms_set.h (with props)
> Modified:
> apr/apr/trunk/CHANGES
> apr/apr/trunk/include/apr_global_mutex.h
> apr/apr/trunk/include/apr_proc_mutex.h
> apr/apr/trunk/include/apr_shm.h
> apr/apr/trunk/include/apr_thread_proc.h
> apr/apr/trunk/include/arch/unix/apr_arch_proc_mutex.h
> apr/apr/trunk/include/arch/unix/apr_arch_shm.h
> apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h
> apr/apr/trunk/locks/beos/proc_mutex.c
> apr/apr/trunk/locks/netware/proc_mutex.c
> apr/apr/trunk/locks/os2/proc_mutex.c
> apr/apr/trunk/locks/unix/global_mutex.c
> apr/apr/trunk/locks/unix/proc_mutex.c
> apr/apr/trunk/locks/win32/proc_mutex.c
> apr/apr/trunk/shmem/beos/shm.c
> apr/apr/trunk/shmem/os2/shm.c
> apr/apr/trunk/shmem/unix/shm.c
> apr/apr/trunk/shmem/win32/shm.c
> apr/apr/trunk/threadproc/beos/proc.c
> apr/apr/trunk/threadproc/netware/proc.c
> apr/apr/trunk/threadproc/os2/proc.c
> apr/apr/trunk/threadproc/unix/proc.c
> apr/apr/trunk/threadproc/win32/proc.c
>
> Modified: apr/apr/trunk/threadproc/unix/proc.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/unix/proc.c?rev=741862&r1=741861&r2=741862&view=diff
> ==============================================================================
> --- apr/apr/trunk/threadproc/unix/proc.c (original)
> +++ apr/apr/trunk/threadproc/unix/proc.c Sat Feb 7 09:05:54 2009
> @@ -463,7 +463,19 @@
> _exit(-1); /* We have big problems, the child should exit. */
> }
> }
> + if (!geteuid()) {
> + apr_procattr_pscb_t *c = attr->perms_set_callbacks;
>
> + while (c) {
> + apr_status_t r;
> + r = (*c->perms_set_fn)((void *)c->data, c->perms,
> + attr->uid, attr->gid);
> + if (r != APR_SUCCESS || r != APR_ENOTIMPL) {
This is always true isn't it?
I guess it should be (r != APR_SUCCESS && r != APR_ENOTIMPL)
> + _exit(-1);
> + }
> + c = c->next;
> + }
> + }
> /* Only try to switch if we are running as root */
> if (attr->gid != -1 && !geteuid()) {
> if ((status = setgid(attr->gid))) {
> @@ -708,3 +720,20 @@
>
> return APR_SUCCESS;
> }
> +
> +APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr,
> + apr_perms_setfn_t *perms_set_fn,
> + void *data,
> + apr_fileperms_t perms)
> +{
> + apr_procattr_pscb_t *c;
> +
> + c = apr_palloc(attr->pool, sizeof(apr_procattr_pscb_t));
> + c->data = data;
> + c->perms = perms;
> + c->perms_set_fn = perms_set_fn;
> + c->next = attr->perms_set_callbacks;
> + attr->perms_set_callbacks = c;
Is it intended that we call the callback registered last first?
> +
> + return APR_SUCCESS;
> +}
>
Regards
RĂ¼diger