summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-21 17:06:17 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-07-29 04:24:07 +0200
commitf5963aad18de80e837448cbc29feb52081897667 (patch)
tree130c53233356893eb5d11132a48f4f780153f2d0 /source4/ntvfs
parente84b8a72bd63d3f4af810536068ae65d33aabff8 (diff)
downloadsamba-f5963aad18de80e837448cbc29feb52081897667.tar.gz
samba-f5963aad18de80e837448cbc29feb52081897667.tar.bz2
samba-f5963aad18de80e837448cbc29feb52081897667.zip
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 <tridge@samba.org>
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/unixuid/vfs_unixuid.c56
-rw-r--r--source4/ntvfs/unixuid/wscript_build2
2 files changed, 4 insertions, 54 deletions
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;i<token->num_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'
)