From f5963aad18de80e837448cbc29feb52081897667 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 21 Jul 2011 17:06:17 +1000 Subject: s4-auth Move conversion of security_token to unix_token to auth This allows us to honour the AUTH_SESSION_INFO_UNIX_TOKEN flag. Andrew Bartlett Signed-off-by: Andrew Tridgell --- source4/ntvfs/unixuid/vfs_unixuid.c | 56 ++----------------------------------- source4/ntvfs/unixuid/wscript_build | 2 +- 2 files changed, 4 insertions(+), 54 deletions(-) (limited to 'source4/ntvfs/unixuid') diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c index 02b7cb8db5..0221b4391c 100644 --- a/source4/ntvfs/unixuid/vfs_unixuid.c +++ b/source4/ntvfs/unixuid/vfs_unixuid.c @@ -164,60 +164,10 @@ static NTSTATUS nt_token_to_unix_security(struct ntvfs_module_context *ntvfs, struct security_unix_token **sec) { struct unixuid_private *priv = ntvfs->private_data; - int i; - NTSTATUS status; - struct id_map *ids; - struct composite_context *ctx; - *sec = talloc(req, struct security_unix_token); - - /* we can't do unix security without a user and group */ - if (token->num_sids < 2) { - return NT_STATUS_ACCESS_DENIED; - } - - ids = talloc_array(req, struct id_map, token->num_sids); - NT_STATUS_HAVE_NO_MEMORY(ids); - - (*sec)->ngroups = token->num_sids - 2; - (*sec)->groups = talloc_array(*sec, gid_t, (*sec)->ngroups); - NT_STATUS_HAVE_NO_MEMORY((*sec)->groups); - - for (i=0;inum_sids;i++) { - ZERO_STRUCT(ids[i].xid); - ids[i].sid = &token->sids[i]; - ids[i].status = ID_UNKNOWN; - } - - ctx = wbc_sids_to_xids_send(priv->wbc_ctx, ids, token->num_sids, ids); - NT_STATUS_HAVE_NO_MEMORY(ctx); - - status = wbc_sids_to_xids_recv(ctx, &ids); - NT_STATUS_NOT_OK_RETURN(status); - if (ids[0].xid.type == ID_TYPE_BOTH || - ids[0].xid.type == ID_TYPE_UID) { - (*sec)->uid = ids[0].xid.id; - } else { - return NT_STATUS_INVALID_SID; - } - - if (ids[1].xid.type == ID_TYPE_BOTH || - ids[1].xid.type == ID_TYPE_GID) { - (*sec)->gid = ids[1].xid.id; - } else { - return NT_STATUS_INVALID_SID; - } - - for (i=0;i<(*sec)->ngroups;i++) { - if (ids[i+2].xid.type == ID_TYPE_BOTH || - ids[i+2].xid.type == ID_TYPE_GID) { - (*sec)->groups[i] = ids[i+2].xid.id; - } else { - return NT_STATUS_INVALID_SID; - } - } - - return NT_STATUS_OK; + return security_token_to_unix_token(req, + priv->wbc_ctx, + token, sec); } /* diff --git a/source4/ntvfs/unixuid/wscript_build b/source4/ntvfs/unixuid/wscript_build index fe5620886a..3a7570956b 100644 --- a/source4/ntvfs/unixuid/wscript_build +++ b/source4/ntvfs/unixuid/wscript_build @@ -4,6 +4,6 @@ bld.SAMBA_MODULE('ntvfs_unixuid', source='vfs_unixuid.c', subsystem='ntvfs', init_function='ntvfs_unixuid_init', - deps='samdb' + deps='auth_unix_token' ) -- cgit