Instead of keeping separate groups and gids arrays, create struct
group_info and use it to store both, along with a count for each. Cache group info on a per-user basis using getgrouplist() to get the groups. We no longer need special to special case the user or list user for user_in_group() and thus no longer need to reset the groups list when listing another user.
This commit is contained in:
@@ -286,6 +286,9 @@ void closefrom(int);
|
||||
#ifndef HAVE_GETCWD
|
||||
char *getcwd(char *, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_GETGROUPLIST
|
||||
int getgrouplist(const char *, gid_t, gid_t *, int *);
|
||||
#endif
|
||||
#ifndef HAVE_GETLINE
|
||||
ssize_t getline(char **, size_t *, FILE *);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user