You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Guenter Knauf <fu...@apache.org> on 2010/11/22 06:39:44 UTC

initgroups() in mpm_coomon.h

Hi,
in mpm_common.c we have:

#ifndef HAVE_INITGROUPS
int initgroups(const char *name, gid_t basegid)
{
#if defined(_OSD_POSIX) || defined(OS2) || defined(WIN32) || 
defined(NETWARE)
     return 0;
#else
     gid_t groups[NGROUPS_MAX];
     struct group *g;
     int index = 0;

     setgrent();

     groups[index++] = basegid;

     while (index < NGROUPS_MAX && ((g = getgrent()) != NULL)) {
         if (g->gr_gid != basegid) {
             char **names;

             for (names = g->gr_mem; *names != NULL; ++names) {
                 if (!strcmp(*names, name))
                     groups[index++] = g->gr_gid;
             }
         }
     }

     endgrent();

     return setgroups(index, groups);
#endif
}
#endif /* def NEED_INITGROUPS */

the only other 2 source files which use initgroups() are mod_unixd.c and 
suexec.c; with 4 platforms this function is a dummy; 2 (NetWare and 
Win32) dont build mod_unix.d.c, and OS/2 does #ifndef the part in 
mod_unixd.c where initgroups() is used - remains only _OSD_POSIX which 
might need the dummy + any other strange Linux which lacks of 
initgroups(); then we have also no conditional prototype for it in any 
header; and finally suexec.c is a standalone program which seems not to 
be able to use this function unless linked with mpm_common.c ...
so wouldnt it make more sense to either move it into a separare file 
which can be linked to suexec too, or at least to move it into unixd.c 
or mod_unixd.c ?

Gün.




Re: initgroups() in mpm_coomon.h

Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Nov 22, 2010 at 12:39 AM, Guenter Knauf <fu...@apache.org> wrote:
> Hi,
> in mpm_common.c we have:
>
> #ifndef HAVE_INITGROUPS
> int initgroups(const char *name, gid_t basegid)
> {
> #if defined(_OSD_POSIX) || defined(OS2) || defined(WIN32) ||
> defined(NETWARE)
>    return 0;
> #else
>    gid_t groups[NGROUPS_MAX];
>    struct group *g;
>    int index = 0;
>
>    setgrent();
>
>    groups[index++] = basegid;
>
>    while (index < NGROUPS_MAX && ((g = getgrent()) != NULL)) {
>        if (g->gr_gid != basegid) {
>            char **names;
>
>            for (names = g->gr_mem; *names != NULL; ++names) {
>                if (!strcmp(*names, name))
>                    groups[index++] = g->gr_gid;
>            }
>        }
>    }
>
>    endgrent();
>
>    return setgroups(index, groups);
> #endif
> }
> #endif /* def NEED_INITGROUPS */
>
> the only other 2 source files which use initgroups() are mod_unixd.c and
> suexec.c; with 4 platforms this function is a dummy; 2 (NetWare and Win32)
> dont build mod_unix.d.c, and OS/2 does #ifndef the part in mod_unixd.c where
> initgroups() is used - remains only _OSD_POSIX which might need the dummy +
> any other strange Linux which lacks of initgroups(); then we have also no
> conditional prototype for it in any header; and finally suexec.c is a
> standalone program which seems not to be able to use this function unless
> linked with mpm_common.c ...
> so wouldnt it make more sense to either move it into a separare file which
> can be linked to suexec too, or at least to move it into unixd.c or
> mod_unixd.c ?

I suggest just deleting the function.  In the event that somebody
actually needs it, we find the appropriate solution then.

Re: initgroups() in mpm_coomon.h

Posted by Guenter Knauf <fu...@apache.org>.
Am 22.11.2010 06:39, schrieb Guenter Knauf:
> Hi,
> in mpm_common.c we have:
>
> #ifndef HAVE_INITGROUPS
> int initgroups(const char *name, gid_t basegid)
> {
> #if defined(_OSD_POSIX) || defined(OS2) || defined(WIN32) ||
> defined(NETWARE)
> return 0;
> #else
> gid_t groups[NGROUPS_MAX];
> struct group *g;
> int index = 0;
>
> setgrent();
>
> groups[index++] = basegid;
>
> while (index < NGROUPS_MAX && ((g = getgrent()) != NULL)) {
> if (g->gr_gid != basegid) {
> char **names;
>
> for (names = g->gr_mem; *names != NULL; ++names) {
> if (!strcmp(*names, name))
> groups[index++] = g->gr_gid;
> }
> }
> }
>
> endgrent();
>
> return setgroups(index, groups);
> #endif
> }
> #endif /* def NEED_INITGROUPS */
>
> the only other 2 source files which use initgroups() are mod_unixd.c and
> suexec.c; with 4 platforms this function is a dummy; 2 (NetWare and
> Win32) dont build mod_unix.d.c, and OS/2 does #ifndef the part in
> mod_unixd.c where initgroups() is used - remains only _OSD_POSIX which
> might need the dummy + any other strange Linux which lacks of
> initgroups(); then we have also no conditional prototype for it in any
> header; and finally suexec.c is a standalone program which seems not to
> be able to use this function unless linked with mpm_common.c ...
> so wouldnt it make more sense to either move it into a separare file
> which can be linked to suexec too, or at least to move it into unixd.c
> or mod_unixd.c ?
nobody any opinion?

Gün.



Re: initgroups() in mpm_coomon.h

Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 11/21/2010 11:39 PM, Guenter Knauf wrote:
> Hi,
> in mpm_common.c we have:
> 
> #ifndef HAVE_INITGROUPS
> int initgroups(const char *name, gid_t basegid)
> {
> #if defined(_OSD_POSIX) || defined(OS2) || defined(WIN32) || defined(NETWARE)
>     return 0;
> #else
>[...]


> the only other 2 source files which use initgroups() are mod_unixd.c and suexec.c; with 4
> platforms this function is a dummy; 2 (NetWare and Win32) dont build mod_unix.d.c, and
> OS/2 does #ifndef the part in mod_unixd.c where initgroups() is used - remains only
> _OSD_POSIX which might need the dummy + any other strange Linux which lacks of
> initgroups(); then we have also no conditional prototype for it in any header; and finally
> suexec.c is a standalone program which seems not to be able to use this function unless
> linked with mpm_common.c ...
> so wouldnt it make more sense to either move it into a separare file which can be linked
> to suexec too, or at least to move it into unixd.c or mod_unixd.c ?

And at the very least, namespace protect it too?