diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-05-24 10:16:34 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-05-24 23:08:56 +1000 |
commit | 285647664cf60baa9f8f1a52bea0c55aa01b4e85 (patch) | |
tree | b86e569733a2c0fe8b56f675bd6acfc350d08b88 /source4/ntvfs | |
parent | 974ed9cf2c10ab3384c1070c22f5cd42908c95f1 (diff) | |
download | samba-285647664cf60baa9f8f1a52bea0c55aa01b4e85.tar.gz samba-285647664cf60baa9f8f1a52bea0c55aa01b4e85.tar.bz2 samba-285647664cf60baa9f8f1a52bea0c55aa01b4e85.zip |
s4:idmap Adjust code to new idmap structure names and layout.
Andrew Bartlett
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/posix/pvfs_acl.c | 40 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_acl_nfs4.c | 26 | ||||
-rw-r--r-- | source4/ntvfs/unixuid/vfs_unixuid.c | 24 |
3 files changed, 37 insertions, 53 deletions
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;i<acl->a_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;i<acl.a_count;i++) { struct security_ace *ace = &sd->dacl->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 = ""; } diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c index f6b73d7473..c80c52cc7d 100644 --- a/source4/ntvfs/unixuid/vfs_unixuid.c +++ b/source4/ntvfs/unixuid/vfs_unixuid.c @@ -184,11 +184,11 @@ static NTSTATUS nt_token_to_unix_security(struct ntvfs_module_context *ntvfs, ids = talloc_array(req, struct id_map, token->num_sids); NT_STATUS_HAVE_NO_MEMORY(ids); - ids[0].unixid = NULL; + ZERO_STRUCT(ids[0].xid); ids[0].sid = token->user_sid; ids[0].status = ID_UNKNOWN; - ids[1].unixid = NULL; + ZERO_STRUCT(ids[1].xid); ids[1].sid = token->group_sid; ids[1].status = ID_UNKNOWN; @@ -197,7 +197,7 @@ static NTSTATUS nt_token_to_unix_security(struct ntvfs_module_context *ntvfs, NT_STATUS_HAVE_NO_MEMORY((*sec)->groups); for (i=0;i<(*sec)->ngroups;i++) { - ids[i+2].unixid = NULL; + ZERO_STRUCT(ids[i+2].xid); ids[i+2].sid = token->sids[i+2]; ids[i+2].status = ID_UNKNOWN; } @@ -208,24 +208,24 @@ static NTSTATUS nt_token_to_unix_security(struct ntvfs_module_context *ntvfs, status = wbc_sids_to_xids_recv(ctx, &ids); NT_STATUS_NOT_OK_RETURN(status); - if (ids[0].unixid->type == ID_TYPE_BOTH || - ids[0].unixid->type == ID_TYPE_UID) { - (*sec)->uid = ids[0].unixid->id; + 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].unixid->type == ID_TYPE_BOTH || - ids[1].unixid->type == ID_TYPE_GID) { - (*sec)->gid = ids[1].unixid->id; + 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].unixid->type == ID_TYPE_BOTH || - ids[i+2].unixid->type == ID_TYPE_GID) { - (*sec)->groups[i] = ids[i+2].unixid->id; + 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; } |