summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-03-23 18:31:38 +0100
committerJeremy Allison <jra@samba.org>2011-04-13 14:13:25 -0700
commitddfeccc6e40a3e8d8d84ef1b23f9ad3562a44db1 (patch)
treef55c6ccc93bb0f8cebec0732bd65dd272d25a2e9 /source3/auth
parentb8dc235b08ba5ccd4c5d4756369eab4be89c91bf (diff)
downloadsamba-ddfeccc6e40a3e8d8d84ef1b23f9ad3562a44db1.tar.gz
samba-ddfeccc6e40a3e8d8d84ef1b23f9ad3562a44db1.tar.bz2
samba-ddfeccc6e40a3e8d8d84ef1b23f9ad3562a44db1.zip
s3: Use wbcSidsToUnixIds in create_local_token
Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_util.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 1cc78f0757..b7ec9fff70 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -447,10 +447,12 @@ NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
DATA_BLOB *session_key,
struct auth_serversupplied_info **session_info_out)
{
+ struct security_token *t;
NTSTATUS status;
size_t i;
struct dom_sid tmp_sid;
struct auth_serversupplied_info *session_info;
+ struct wbcUnixId *ids;
/* Ensure we can't possible take a code path leading to a
* null defref. */
@@ -516,18 +518,30 @@ NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
session_info->utok.ngroups = 0;
session_info->utok.groups = NULL;
+ t = session_info->security_token;
+
+ ids = TALLOC_ARRAY(talloc_tos(), struct wbcUnixId,
+ t->num_sids);
+ if (ids == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (!sids_to_unix_ids(t->sids, t->num_sids, ids)) {
+ TALLOC_FREE(ids);
+ return NT_STATUS_NO_MEMORY;
+ }
+
/* Start at index 1, where the groups start. */
- for (i=1; i<session_info->security_token->num_sids; i++) {
- gid_t gid;
- struct dom_sid *sid = &session_info->security_token->sids[i];
+ for (i=1; i<t->num_sids; i++) {
- if (!sid_to_gid(sid, &gid)) {
+ if (ids[i].type != WBC_ID_TYPE_GID) {
DEBUG(10, ("Could not convert SID %s to gid, "
- "ignoring it\n", sid_string_dbg(sid)));
+ "ignoring it\n",
+ sid_string_dbg(&t->sids[i])));
continue;
}
- if (!add_gid_to_array_unique(session_info, gid,
+ if (!add_gid_to_array_unique(session_info, ids[i].id.gid,
&session_info->utok.groups,
&session_info->utok.ngroups)) {
return NT_STATUS_NO_MEMORY;