[PATCH 1/3] add bb_getgrouplist_malloc to libbb
Tito
farmatito at tiscali.it
Sun Sep 21 05:55:18 PDT 2008
Hi,
this patch adds the bb_getgrouplist_malloc funtion to libb:
llist_t* FAST_FUNC bb_getgrouplist_malloc(uid_t ruid, gid_t rgid, gid_t *egid)
The functon returns a malloced linked list of the user's gids that you will have to free
yourself, or NULL on failure. If gid_t *egid is not NULL and *egid != rgid *egid is added
at the second place of the list.
The advantages of this function are:
1) the list is easy to walk (without the need of group number counters)
2) used memory is easy to free (without the need of saved pointers to the beginning of the allocated memory).
3) the function uses getgrouplist if available or getgrent.
4) it can handle egid != rgid if needed
llist_t* FAST_FUNC bb_getgrouplist_malloc(uid_t ruid, gid_t rgid, gid_t *egid)
Please apply if you like it.
Hints and critics are welcome.
Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1_bb_getgrouplist_malloc.patch
Type: text/x-diff
Size: 3934 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20080921/3792a7bb/attachment.patch
More information about the busybox
mailing list