diff options
author | Jeremy Allison <jra@samba.org> | 2005-04-19 07:12:44 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:56:39 -0500 |
commit | fecdaec41c70916dc8e591c6e98e830c0f5cb0b1 (patch) | |
tree | e36c60b612a4e79bcb2314ef9b4d7febdc097710 /source3/smbd/uid.c | |
parent | 7f247f7b4de67b3e0a857b146a186e5eabc79235 (diff) | |
download | samba-fecdaec41c70916dc8e591c6e98e830c0f5cb0b1.tar.gz samba-fecdaec41c70916dc8e591c6e98e830c0f5cb0b1.tar.xz samba-fecdaec41c70916dc8e591c6e98e830c0f5cb0b1.zip |
r6385: Convert checking of egid and secondary egid list into
iterator functions so it can be used easily in a for loop.
Drops duplicated code from posix_acls.c
Jeremy.
(This used to be commit 81f30bf5985f5c6dc8399c4695dfa6f14140fde1)
Diffstat (limited to 'source3/smbd/uid.c')
-rw-r--r-- | source3/smbd/uid.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 77dc19b87bf..d1ecaf6625f 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -24,6 +24,29 @@ extern struct current_user current_user; /**************************************************************************** + Iterator functions for getting all gid's from current_user. +****************************************************************************/ + +gid_t get_current_user_gid_first(int *piterator) +{ + *piterator = 0; + return current_user.gid; +} + +gid_t get_current_user_gid_next(int *piterator) +{ + gid_t ret; + + if (!current_user.groups || *piterator >= current_user.ngroups) { + return (gid_t)-1; + } + + ret = current_user.groups[*piterator]; + (*piterator) += 1; + return ret; +} + +/**************************************************************************** Become the guest user without changing the security context stack. ****************************************************************************/ |