From 285647664cf60baa9f8f1a52bea0c55aa01b4e85 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 24 May 2010 10:16:34 +1000 Subject: s4:idmap Adjust code to new idmap structure names and layout. Andrew Bartlett --- source4/ntvfs/posix/pvfs_acl.c | 40 ++++++++++++++----------------------- source4/ntvfs/posix/pvfs_acl_nfs4.c | 26 ++++++++++-------------- 2 files changed, 25 insertions(+), 41 deletions(-) (limited to 'source4/ntvfs/posix') diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index 4cb6fce217..97c5341007 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -169,18 +169,12 @@ static NTSTATUS pvfs_default_acl(struct pvfs_state *pvfs, ids = talloc_zero_array(sd, struct id_map, 2); NT_STATUS_HAVE_NO_MEMORY(ids); - ids[0].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY(ids[0].unixid); - - ids[0].unixid->id = name->st.st_uid; - ids[0].unixid->type = ID_TYPE_UID; + ids[0].xid.id = name->st.st_uid; + ids[0].xid.type = ID_TYPE_UID; ids[0].sid = NULL; - ids[1].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY(ids[1].unixid); - - ids[1].unixid->id = name->st.st_gid; - ids[1].unixid->type = ID_TYPE_GID; + ids[1].xid.id = name->st.st_gid; + ids[1].xid.type = ID_TYPE_GID; ids[1].sid = NULL; ctx = wbc_xids_to_sids_send(pvfs->wbc_ctx, ids, 2, ids); @@ -314,7 +308,7 @@ NTSTATUS pvfs_acl_set(struct pvfs_state *pvfs, ids = talloc(req, struct id_map); NT_STATUS_HAVE_NO_MEMORY(ids); - ids->unixid = NULL; + ZERO_STRUCT(ids->xid); ids->sid = NULL; ids->status = ID_UNKNOWN; @@ -336,9 +330,9 @@ NTSTATUS pvfs_acl_set(struct pvfs_state *pvfs, status = wbc_sids_to_xids_recv(ctx, &ids); NT_STATUS_NOT_OK_RETURN(status); - if (ids->unixid->type == ID_TYPE_BOTH || - ids->unixid->type == ID_TYPE_UID) { - new_uid = ids->unixid->id; + if (ids->xid.type == ID_TYPE_BOTH || + ids->xid.type == ID_TYPE_UID) { + new_uid = ids->xid.id; } } sd->owner_sid = new_sd->owner_sid; @@ -354,9 +348,9 @@ NTSTATUS pvfs_acl_set(struct pvfs_state *pvfs, status = wbc_sids_to_xids_recv(ctx, &ids); NT_STATUS_NOT_OK_RETURN(status); - if (ids->unixid->type == ID_TYPE_BOTH || - ids->unixid->type == ID_TYPE_GID) { - new_gid = ids->unixid->id; + if (ids->xid.type == ID_TYPE_BOTH || + ids->xid.type == ID_TYPE_GID) { + new_gid = ids->xid.id; } } @@ -895,17 +889,13 @@ NTSTATUS pvfs_acl_inherited_sd(struct pvfs_state *pvfs, ids = talloc_array(sd, struct id_map, 2); NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids, tmp_ctx); - ids[0].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids[0].unixid, tmp_ctx); - ids[0].unixid->id = geteuid(); - ids[0].unixid->type = ID_TYPE_UID; + ids[0].xid.id = geteuid(); + ids[0].xid.type = ID_TYPE_UID; ids[0].sid = NULL; ids[0].status = ID_UNKNOWN; - ids[1].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids[1].unixid, tmp_ctx); - ids[1].unixid->id = getegid(); - ids[1].unixid->type = ID_TYPE_GID; + ids[1].xid.id = getegid(); + ids[1].xid.type = ID_TYPE_GID; ids[1].sid = NULL; ids[1].status = ID_UNKNOWN; diff --git a/source4/ntvfs/posix/pvfs_acl_nfs4.c b/source4/ntvfs/posix/pvfs_acl_nfs4.c index c6dbf79c57..8824602dea 100644 --- a/source4/ntvfs/posix/pvfs_acl_nfs4.c +++ b/source4/ntvfs/posix/pvfs_acl_nfs4.c @@ -65,29 +65,23 @@ static NTSTATUS pvfs_acl_load_nfs4(struct pvfs_state *pvfs, struct pvfs_filename ids = talloc_array(sd, struct id_map, num_ids); NT_STATUS_HAVE_NO_MEMORY(ids); - ids[0].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY(ids[0].unixid); - ids[0].unixid->id = name->st.st_uid; - ids[0].unixid->type = ID_TYPE_UID; + ids[0].xid.id = name->st.st_uid; + ids[0].xid.type = ID_TYPE_UID; ids[0].sid = NULL; ids[0].status = ID_UNKNOWN; - ids[1].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY(ids[1].unixid); - ids[1].unixid->id = name->st.st_gid; - ids[1].unixid->type = ID_TYPE_GID; + ids[1].xid.id = name->st.st_gid; + ids[1].xid.type = ID_TYPE_GID; ids[1].sid = NULL; ids[1].status = ID_UNKNOWN; for (i=0;ia_count;i++) { struct nfs4ace *a = &acl->ace[i]; - ids[i+2].unixid = talloc(ids, struct unixid); - NT_STATUS_HAVE_NO_MEMORY(ids[i+2].unixid); - ids[i+2].unixid->id = a->e_id; + ids[i+2].xid.id = a->e_id; if (a->e_flags & ACE4_IDENTIFIER_GROUP) { - ids[i+2].unixid->type = ID_TYPE_GID; + ids[i+2].xid.type = ID_TYPE_GID; } else { - ids[i+2].unixid->type = ID_TYPE_UID; + ids[i+2].xid.type = ID_TYPE_UID; } ids[i+2].sid = NULL; ids[i+2].status = ID_UNKNOWN; @@ -154,7 +148,7 @@ static NTSTATUS pvfs_acl_save_nfs4(struct pvfs_state *pvfs, struct pvfs_filename for (i=0;idacl->aces[i]; - ids[i].unixid = NULL; + ZERO_STRUCT(ids[i].xid); ids[i].sid = dom_sid_dup(ids, &ace->trustee); if (ids[i].sid == NULL) { talloc_free(tmp_ctx); @@ -180,10 +174,10 @@ static NTSTATUS pvfs_acl_save_nfs4(struct pvfs_state *pvfs, struct pvfs_filename a->e_type = ace->type; a->e_flags = ace->flags; a->e_mask = ace->access_mask; - if (ids[i].unixid->type != ID_TYPE_UID) { + if (ids[i].xid.type != ID_TYPE_UID) { a->e_flags |= ACE4_IDENTIFIER_GROUP; } - a->e_id = ids[i].unixid->id; + a->e_id = ids[i].xid.id; a->e_who = ""; } -- cgit