You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2009/03/29 18:05:53 UTC

svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Author: mturk
Date: Sun Mar 29 16:05:53 2009
New Revision: 759711

URL: http://svn.apache.org/viewvc?rev=759711&view=rev
Log:
Use apr-2 object perms setter

Modified:
    httpd/httpd/trunk/os/unix/unixd.c

Modified: httpd/httpd/trunk/os/unix/unixd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/os/unix/unixd.c?rev=759711&r1=759710&r2=759711&view=diff
==============================================================================
--- httpd/httpd/trunk/os/unix/unixd.c (original)
+++ httpd/httpd/trunk/os/unix/unixd.c Sun Mar 29 16:05:53 2009
@@ -26,6 +26,7 @@
 #include "apr_thread_proc.h"
 #include "apr_strings.h"
 #include "apr_portable.h"
+#include "apr_perms_set.h"
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
@@ -208,71 +209,19 @@
                                               attr, ugid, p);
 }
 
-/* XXX move to APR and externalize (but implement differently :) ) */
-static apr_lockmech_e proc_mutex_mech(apr_proc_mutex_t *pmutex)
-{
-    const char *mechname = apr_proc_mutex_name(pmutex);
-
-    if (!strcmp(mechname, "sysvsem")) {
-        return APR_LOCK_SYSVSEM;
-    }
-    else if (!strcmp(mechname, "flock")) {
-        return APR_LOCK_FLOCK;
-    }
-    return APR_LOCK_DEFAULT;
-}
-
 AP_DECLARE(apr_status_t) ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
 {
+    apr_status_t rv = APR_SUCCESS;
     if (!geteuid()) {
-        apr_lockmech_e mech = proc_mutex_mech(pmutex);
-
-        switch(mech) {
-#if APR_HAS_SYSVSEM_SERIALIZE
-        case APR_LOCK_SYSVSEM:
-        {
-            apr_os_proc_mutex_t ospmutex;
-#if !APR_HAVE_UNION_SEMUN
-            union semun {
-                long val;
-                struct semid_ds *buf;
-                unsigned short *array;
-            };
-#endif
-            union semun ick;
-            struct semid_ds buf;
-
-            apr_os_proc_mutex_get(&ospmutex, pmutex);
-            buf.sem_perm.uid = ap_unixd_config.user_id;
-            buf.sem_perm.gid = ap_unixd_config.group_id;
-            buf.sem_perm.mode = 0600;
-            ick.buf = &buf;
-            if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) {
-                return errno;
-            }
-        }
-        break;
-#endif
-#if APR_HAS_FLOCK_SERIALIZE
-        case APR_LOCK_FLOCK:
-        {
-            const char *lockfile = apr_proc_mutex_lockfile(pmutex);
-
-            if (lockfile) {
-                if (chown(lockfile, ap_unixd_config.user_id,
-                          -1 /* no gid change */) < 0) {
-                    return errno;
-                }
-            }
-        }
-        break;
-#endif
-        default:
-            /* do nothing */
-            break;
+        rv = APR_PERMS_SET_FN(proc_mutex)(pmutex,
+                                          APR_FPROT_GWRITE | APR_FPROT_UWRITE,
+                                          ap_unixd_config.user_id,
+                                          ap_unixd_config.group_id);
+        if (rv == APR_ENOTIMPL) {
+            rv = APR_SUCCESS;
         }
     }
-    return APR_SUCCESS;
+    return rv;
 }
 
 AP_DECLARE(apr_status_t) ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex)



Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
 

> -----Ursprüngliche Nachricht-----
> Von: Mladen Turk 
> Gesendet: Montag, 30. März 2009 17:08
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c
> 
> Jim Jagielski wrote:
> > FWIW, this means that apr-1.4 is no longer viable for httpd-trunk.
> > As of a few days ago, I could build with 1.4.x.... no longer.
> > 
> > Are we *sure* we want to do that?
> > 
> 
> I was under the impression that apr-2 is now mandatory,

No, it is not and it shouldn't as its API is not stable yet and it is unclear
when it is ready. For stablizing trunk we need an APR with a stable API.
Though for APR it is important that trunk runs with APR 2.0 as
otherwise we have no consumers to crosscheck and test the state of APR 2.0.

Regards

Rüdiger


Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by Mladen Turk <mt...@apache.org>.
Jim Jagielski wrote:
> FWIW, this means that apr-1.4 is no longer viable for httpd-trunk.
> As of a few days ago, I could build with 1.4.x.... no longer.
> 
> Are we *sure* we want to do that?
> 

I was under the impression that apr-2 is now mandatory,
regardless of the apr-2 permission setter api.

> Just asking :)
> 

OK. It's not clear to me neither.

Regards
-- 
^(TM)

Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Mon, Mar 30, 2009 at 11:36 PM, William A. Rowe, Jr.
<wr...@rowe-clan.net> wrote:
> Plüm, Rüdiger, VF-Group wrote:
>>
>> IMHO we shouldn't require APR 2.0 for trunk (although trunk should be
>> capable to run with 2.0).
>
> +1

+1.  -- justin

Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Plüm, Rüdiger, VF-Group wrote:
> IMHO we shouldn't require APR 2.0 for trunk (although trunk should be capable to run with 2.0).

+1

Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: Mladen Turk 
> Gesendet: Montag, 30. März 2009 17:11
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c
> 
> Plüm, Rüdiger, VF-Group wrote:
> > IMHO we shouldn't require APR 2.0 for trunk (although trunk 
> should be capable to run with 2.0).
> > Apart from the other stuff you mentioned before it makes it 
> much harder to cut 2.4.
> > 
> > So I am -1 on this change until APR 2.0 is at least in beta state.
> > So Mladen please revert.
> > 
> 
> OK, no problem.
> I'm not at my dev machine right now, so you can do it
> if not willing to wait for couple of hours.

I have enough patience to wait for your return to your dev machine :-).

Regards

Rüdiger


Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by Mladen Turk <mt...@apache.org>.
Plüm, Rüdiger, VF-Group wrote:
> IMHO we shouldn't require APR 2.0 for trunk (although trunk should be capable to run with 2.0).
> Apart from the other stuff you mentioned before it makes it much harder to cut 2.4.
> 
> So I am -1 on this change until APR 2.0 is at least in beta state.
> So Mladen please revert.
> 

OK, no problem.
I'm not at my dev machine right now, so you can do it
if not willing to wait for couple of hours.

Regards
-- 
^(TM)

Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
IMHO we shouldn't require APR 2.0 for trunk (although trunk should be capable to run with 2.0).
Apart from the other stuff you mentioned before it makes it much harder to cut 2.4.

So I am -1 on this change until APR 2.0 is at least in beta state.
So Mladen please revert.

Regards

Rüdiger

> -----Ursprüngliche Nachricht-----
> Von: Jim Jagielski [mailto:jim@jaguNET.com] 
> Gesendet: Montag, 30. März 2009 16:58
> An: dev@httpd.apache.org
> Cc: cvs@httpd.apache.org
> Betreff: Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c
> 
> FWIW, this means that apr-1.4 is no longer viable for httpd-trunk.
> As of a few days ago, I could build with 1.4.x.... no longer.
> 
> Are we *sure* we want to do that?
> 
> Just asking :)
> 
> On Mar 29, 2009, at 12:05 PM, mturk@apache.org wrote:
> 
> > Author: mturk
> > Date: Sun Mar 29 16:05:53 2009
> > New Revision: 759711
> >
> > URL: http://svn.apache.org/viewvc?rev=759711&view=rev
> > Log:
> > Use apr-2 object perms setter
> >
> > Modified:
> >    httpd/httpd/trunk/os/unix/unixd.c
> >
> > Modified: httpd/httpd/trunk/os/unix/unixd.c
> > URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/os/unix/unixd.c
> ?rev=759711&r1=759710&r2=759711&view=diff
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > 
> ======================================================================
> > --- httpd/httpd/trunk/os/unix/unixd.c (original)
> > +++ httpd/httpd/trunk/os/unix/unixd.c Sun Mar 29 16:05:53 2009
> > @@ -26,6 +26,7 @@
> > #include "apr_thread_proc.h"
> > #include "apr_strings.h"
> > #include "apr_portable.h"
> > +#include "apr_perms_set.h"
> > #ifdef HAVE_PWD_H
> > #include <pwd.h>
> > #endif
> > @@ -208,71 +209,19 @@
> >                                               attr, ugid, p);
> > }
> >
> > -/* XXX move to APR and externalize (but implement 
> differently :) ) */
> > -static apr_lockmech_e proc_mutex_mech(apr_proc_mutex_t *pmutex)
> > -{
> > -    const char *mechname = apr_proc_mutex_name(pmutex);
> > -
> > -    if (!strcmp(mechname, "sysvsem")) {
> > -        return APR_LOCK_SYSVSEM;
> > -    }
> > -    else if (!strcmp(mechname, "flock")) {
> > -        return APR_LOCK_FLOCK;
> > -    }
> > -    return APR_LOCK_DEFAULT;
> > -}
> > -
> > AP_DECLARE(apr_status_t)  
> > ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
> > {
> > +    apr_status_t rv = APR_SUCCESS;
> >     if (!geteuid()) {
> > -        apr_lockmech_e mech = proc_mutex_mech(pmutex);
> > -
> > -        switch(mech) {
> > -#if APR_HAS_SYSVSEM_SERIALIZE
> > -        case APR_LOCK_SYSVSEM:
> > -        {
> > -            apr_os_proc_mutex_t ospmutex;
> > -#if !APR_HAVE_UNION_SEMUN
> > -            union semun {
> > -                long val;
> > -                struct semid_ds *buf;
> > -                unsigned short *array;
> > -            };
> > -#endif
> > -            union semun ick;
> > -            struct semid_ds buf;
> > -
> > -            apr_os_proc_mutex_get(&ospmutex, pmutex);
> > -            buf.sem_perm.uid = ap_unixd_config.user_id;
> > -            buf.sem_perm.gid = ap_unixd_config.group_id;
> > -            buf.sem_perm.mode = 0600;
> > -            ick.buf = &buf;
> > -            if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) {
> > -                return errno;
> > -            }
> > -        }
> > -        break;
> > -#endif
> > -#if APR_HAS_FLOCK_SERIALIZE
> > -        case APR_LOCK_FLOCK:
> > -        {
> > -            const char *lockfile = apr_proc_mutex_lockfile(pmutex);
> > -
> > -            if (lockfile) {
> > -                if (chown(lockfile, ap_unixd_config.user_id,
> > -                          -1 /* no gid change */) < 0) {
> > -                    return errno;
> > -                }
> > -            }
> > -        }
> > -        break;
> > -#endif
> > -        default:
> > -            /* do nothing */
> > -            break;
> > +        rv = APR_PERMS_SET_FN(proc_mutex)(pmutex,
> > +                                          APR_FPROT_GWRITE |  
> > APR_FPROT_UWRITE,
> > +                                          ap_unixd_config.user_id,
> > +                                          
> ap_unixd_config.group_id);
> > +        if (rv == APR_ENOTIMPL) {
> > +            rv = APR_SUCCESS;
> >         }
> >     }
> > -    return APR_SUCCESS;
> > +    return rv;
> > }
> >
> > AP_DECLARE(apr_status_t)  
> > ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex)
> >
> >
> 
> 

Re: svn commit: r759711 - /httpd/httpd/trunk/os/unix/unixd.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
FWIW, this means that apr-1.4 is no longer viable for httpd-trunk.
As of a few days ago, I could build with 1.4.x.... no longer.

Are we *sure* we want to do that?

Just asking :)

On Mar 29, 2009, at 12:05 PM, mturk@apache.org wrote:

> Author: mturk
> Date: Sun Mar 29 16:05:53 2009
> New Revision: 759711
>
> URL: http://svn.apache.org/viewvc?rev=759711&view=rev
> Log:
> Use apr-2 object perms setter
>
> Modified:
>    httpd/httpd/trunk/os/unix/unixd.c
>
> Modified: httpd/httpd/trunk/os/unix/unixd.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/os/unix/unixd.c?rev=759711&r1=759710&r2=759711&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- httpd/httpd/trunk/os/unix/unixd.c (original)
> +++ httpd/httpd/trunk/os/unix/unixd.c Sun Mar 29 16:05:53 2009
> @@ -26,6 +26,7 @@
> #include "apr_thread_proc.h"
> #include "apr_strings.h"
> #include "apr_portable.h"
> +#include "apr_perms_set.h"
> #ifdef HAVE_PWD_H
> #include <pwd.h>
> #endif
> @@ -208,71 +209,19 @@
>                                               attr, ugid, p);
> }
>
> -/* XXX move to APR and externalize (but implement differently :) ) */
> -static apr_lockmech_e proc_mutex_mech(apr_proc_mutex_t *pmutex)
> -{
> -    const char *mechname = apr_proc_mutex_name(pmutex);
> -
> -    if (!strcmp(mechname, "sysvsem")) {
> -        return APR_LOCK_SYSVSEM;
> -    }
> -    else if (!strcmp(mechname, "flock")) {
> -        return APR_LOCK_FLOCK;
> -    }
> -    return APR_LOCK_DEFAULT;
> -}
> -
> AP_DECLARE(apr_status_t)  
> ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
> {
> +    apr_status_t rv = APR_SUCCESS;
>     if (!geteuid()) {
> -        apr_lockmech_e mech = proc_mutex_mech(pmutex);
> -
> -        switch(mech) {
> -#if APR_HAS_SYSVSEM_SERIALIZE
> -        case APR_LOCK_SYSVSEM:
> -        {
> -            apr_os_proc_mutex_t ospmutex;
> -#if !APR_HAVE_UNION_SEMUN
> -            union semun {
> -                long val;
> -                struct semid_ds *buf;
> -                unsigned short *array;
> -            };
> -#endif
> -            union semun ick;
> -            struct semid_ds buf;
> -
> -            apr_os_proc_mutex_get(&ospmutex, pmutex);
> -            buf.sem_perm.uid = ap_unixd_config.user_id;
> -            buf.sem_perm.gid = ap_unixd_config.group_id;
> -            buf.sem_perm.mode = 0600;
> -            ick.buf = &buf;
> -            if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) {
> -                return errno;
> -            }
> -        }
> -        break;
> -#endif
> -#if APR_HAS_FLOCK_SERIALIZE
> -        case APR_LOCK_FLOCK:
> -        {
> -            const char *lockfile = apr_proc_mutex_lockfile(pmutex);
> -
> -            if (lockfile) {
> -                if (chown(lockfile, ap_unixd_config.user_id,
> -                          -1 /* no gid change */) < 0) {
> -                    return errno;
> -                }
> -            }
> -        }
> -        break;
> -#endif
> -        default:
> -            /* do nothing */
> -            break;
> +        rv = APR_PERMS_SET_FN(proc_mutex)(pmutex,
> +                                          APR_FPROT_GWRITE |  
> APR_FPROT_UWRITE,
> +                                          ap_unixd_config.user_id,
> +                                          ap_unixd_config.group_id);
> +        if (rv == APR_ENOTIMPL) {
> +            rv = APR_SUCCESS;
>         }
>     }
> -    return APR_SUCCESS;
> +    return rv;
> }
>
> AP_DECLARE(apr_status_t)  
> ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex)
>
>