summaryrefslogtreecommitdiff
path: root/source3/auth/token_util.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-08-26 20:54:13 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-09-11 18:46:05 +1000
commit4bf783d4d6693f927f5e7ef7a9855766c91983f2 (patch)
treef6cbe7bdc734997850ca85c6defd4c53a7bad148 /source3/auth/token_util.c
parent6a0176b07da0b416bc9d750ddea92c612849597c (diff)
downloadsamba-4bf783d4d6693f927f5e7ef7a9855766c91983f2.tar.gz
samba-4bf783d4d6693f927f5e7ef7a9855766c91983f2.tar.bz2
samba-4bf783d4d6693f927f5e7ef7a9855766c91983f2.zip
s3-auth Change type of num_sids to uint32_t
size_t is overkill here, and in struct security_token in the num_sids is uint32_t. This includes a change to the prototype of add_sid_to_array() and add_sid_to_array_unique(), which has had a number of consequnetial changes as I try to sort out all the callers using a pointer to the number of sids. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source3/auth/token_util.c')
-rw-r--r--source3/auth/token_util.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c
index feb930f686..8253e86fe8 100644
--- a/source3/auth/token_util.c
+++ b/source3/auth/token_util.c
@@ -725,7 +725,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
gid_t *gids;
struct dom_sid *group_sids;
struct dom_sid unix_group_sid;
- size_t num_group_sids;
+ uint32_t num_group_sids;
size_t num_gids;
size_t i;
@@ -743,7 +743,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
if (sid_check_is_in_our_domain(&user_sid)) {
bool ret;
-
+ size_t pdb_num_group_sids;
/* This is a passdb user, so ask passdb */
struct samu *sam_acct = NULL;
@@ -766,7 +766,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
result = pdb_enum_group_memberships(tmp_ctx, sam_acct,
&group_sids, &gids,
- &num_group_sids);
+ &pdb_num_group_sids);
if (!NT_STATUS_IS_OK(result)) {
DEBUG(1, ("enum_group_memberships failed for %s (%s): "
"%s\n", username, sid_string_dbg(&user_sid),
@@ -774,6 +774,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
DEBUGADD(1, ("Fall back to unix user %s\n", username));
goto unix_user;
}
+ num_group_sids = pdb_num_group_sids;
/* see the smb_panic() in pdb_default_enum_group_memberships */
SMB_ASSERT(num_group_sids > 0);
@@ -812,7 +813,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
*uid = sam_acct->unix_pw->pw_uid;
} else if (sid_check_is_in_unix_users(&user_sid)) {
-
+ size_t getgroups_num_group_sids;
/* This is a unix user not in passdb. We need to ask nss
* directly, without consulting passdb */
@@ -843,11 +844,12 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
}
if (!getgroups_unix_user(tmp_ctx, username, pass->pw_gid,
- &gids, &num_group_sids)) {
+ &gids, &getgroups_num_group_sids)) {
DEBUG(1, ("getgroups_unix_user for user %s failed\n",
username));
goto done;
}
+ num_group_sids = getgroups_num_group_sids;
if (num_group_sids) {
group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids);