|
|
@ -22,6 +22,8 @@ |
|
|
|
|
|
|
|
#if defined __linux__ and UGID_USE_RWLOCK == 0
|
|
|
|
# include <sys/syscall.h>
|
|
|
|
#elif __APPLE__
|
|
|
|
# include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
@ -90,6 +92,20 @@ gid_t_cache::lower_bound(gid_t_rec *begin, |
|
|
|
return begin; |
|
|
|
} |
|
|
|
|
|
|
|
static |
|
|
|
int |
|
|
|
_getgrouplist(const char *user, |
|
|
|
const gid_t group, |
|
|
|
gid_t *groups, |
|
|
|
int *ngroups) |
|
|
|
{ |
|
|
|
#if __APPLE__
|
|
|
|
return ::getgrouplist(user,group,(int*)groups,ngroups); |
|
|
|
#else
|
|
|
|
return ::getgrouplist(user,group,groups,ngroups); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
gid_t_rec * |
|
|
|
gid_t_cache::cache(const uid_t uid, |
|
|
|
const gid_t gid) |
|
|
@ -107,9 +123,9 @@ gid_t_cache::cache(const uid_t uid, |
|
|
|
if(pwdrv != NULL && rv == 0) |
|
|
|
{ |
|
|
|
rec->size = 0; |
|
|
|
::getgrouplist(pwd.pw_name,gid,NULL,&rec->size); |
|
|
|
::_getgrouplist(pwd.pw_name,gid,NULL,&rec->size); |
|
|
|
rec->size = std::min(MAXGIDS,rec->size); |
|
|
|
rv = ::getgrouplist(pwd.pw_name,gid,rec->gids,&rec->size); |
|
|
|
rv = ::_getgrouplist(pwd.pw_name,gid,rec->gids,&rec->size); |
|
|
|
if(rv == -1) |
|
|
|
{ |
|
|
|
rec->gids[0] = gid; |
|
|
|