diff options
author | Gerald Carter <jerry@samba.org> | 2002-09-25 15:19:00 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-09-25 15:19:00 +0000 |
commit | a834a73e341059be154426390304a42e4a011f72 (patch) | |
tree | 7f53b0f7819238e0ee0396daccf5d924cb9b8d29 /source3/lib/system_smbd.c | |
parent | 115a39775cb923d026dde58633b6ba6aef3a1943 (diff) | |
download | samba-a834a73e341059be154426390304a42e4a011f72.tar.gz samba-a834a73e341059be154426390304a42e4a011f72.tar.bz2 samba-a834a73e341059be154426390304a42e4a011f72.zip |
sync'ing up for 3.0alpha20 release
(This used to be commit 65e7b5273bb58802bf0c389b77f7fcae0a1f6139)
Diffstat (limited to 'source3/lib/system_smbd.c')
-rw-r--r-- | source3/lib/system_smbd.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c index 28ceaf3939..0cd3086945 100644 --- a/source3/lib/system_smbd.c +++ b/source3/lib/system_smbd.c @@ -41,6 +41,11 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in gid_t *gids_saved; int ret, ngrp_saved; + if (non_root_mode()) { + *grpcnt = 0; + return 0; + } + /* work out how many groups we need to save */ ngrp_saved = getgroups(0, NULL); if (ngrp_saved == -1) { @@ -56,13 +61,14 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in ngrp_saved = getgroups(ngrp_saved, gids_saved); if (ngrp_saved == -1) { - free(gids_saved); + SAFE_FREE(gids_saved); /* very strange! */ return -1; } if (initgroups(user, gid) != 0) { - free(gids_saved); + DEBUG(0, ("getgrouplist_internals: initgroups() failed!\n")); + SAFE_FREE(gids_saved); return -1; } @@ -101,5 +107,6 @@ int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grpcnt) become_root(); retval = getgrouplist_internals(user, gid, groups, grpcnt); unbecome_root(); + return retval; #endif } |