48
48
status = pvfs_xattr_ndr_load(pvfs, mem_ctx, name->full_name, fd,
49
49
NFS4ACL_XATTR_NAME,
50
acl, ndr_pull_nfs4acl);
50
acl, (void *) ndr_pull_nfs4acl);
51
51
if (!NT_STATUS_IS_OK(status)) {
63
63
/* the number of ids to map is the acl count plus uid and gid */
64
64
num_ids = acl->a_count +2;
65
ids = talloc_array(sd, struct id_mapping, num_ids);
65
ids = talloc_array(sd, struct id_map, num_ids);
66
66
NT_STATUS_HAVE_NO_MEMORY(ids);
68
ids[0].unixid = talloc(ids, struct unixid);
69
NT_STATUS_HAVE_NO_MEMORY(ids[0].unixid);
70
ids[0].unixid->id = name->st.st_uid;
71
ids[0].unixid->type = ID_TYPE_UID;
68
ids[0].xid.id = name->st.st_uid;
69
ids[0].xid.type = ID_TYPE_UID;
73
ids[0].status = NT_STATUS_NONE_MAPPED;
71
ids[0].status = ID_UNKNOWN;
75
ids[1].unixid = talloc(ids, struct unixid);
76
NT_STATUS_HAVE_NO_MEMORY(ids[1].unixid);
77
ids[1].unixid->id = name->st.st_gid;
78
ids[1].unixid->type = ID_TYPE_GID;
73
ids[1].xid.id = name->st.st_gid;
74
ids[1].xid.type = ID_TYPE_GID;
80
ids[1].status = NT_STATUS_NONE_MAPPED;
76
ids[1].status = ID_UNKNOWN;
82
78
for (i=0;i<acl->a_count;i++) {
83
79
struct nfs4ace *a = &acl->ace[i];
84
ids[i+2].unixid = talloc(ids, struct unixid);
85
NT_STATUS_HAVE_NO_MEMORY(ids[i+2].unixid);
86
ids[i+2].unixid->id = a->e_id;
80
ids[i+2].xid.id = a->e_id;
87
81
if (a->e_flags & ACE4_IDENTIFIER_GROUP) {
88
ids[i+2].unixid->type = ID_TYPE_GID;
82
ids[i+2].xid.type = ID_TYPE_GID;
90
ids[i+2].unixid->type = ID_TYPE_UID;
84
ids[i+2].xid.type = ID_TYPE_UID;
92
86
ids[i+2].sid = NULL;
93
ids[i+2].status = NT_STATUS_NONE_MAPPED;
87
ids[i+2].status = ID_UNKNOWN;
96
90
/* Allocate memory for the sids from the security descriptor to be on
146
140
return NT_STATUS_NO_MEMORY;
149
ids = talloc_array(tmp_ctx, struct id_mapping, acl.a_count);
143
ids = talloc_array(tmp_ctx, struct id_map, acl.a_count);
150
144
if (ids == NULL) {
151
145
talloc_free(tmp_ctx);
152
146
return NT_STATUS_NO_MEMORY;
155
149
for (i=0;i<acl.a_count;i++) {
156
150
struct security_ace *ace = &sd->dacl->aces[i];
157
ids[i].unixid = NULL;
151
ZERO_STRUCT(ids[i].xid);
158
152
ids[i].sid = dom_sid_dup(ids, &ace->trustee);
159
153
if (ids[i].sid == NULL) {
160
154
talloc_free(tmp_ctx);
161
155
return NT_STATUS_NO_MEMORY;
163
ids[i].status = NT_STATUS_NONE_MAPPED;
157
ids[i].status = ID_UNKNOWN;
166
160
ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx,ids, acl.a_count, ids);
180
174
a->e_type = ace->type;
181
175
a->e_flags = ace->flags;
182
176
a->e_mask = ace->access_mask;
183
if (ids[i].unixid->type != ID_TYPE_UID) {
177
if (ids[i].xid.type != ID_TYPE_UID) {
184
178
a->e_flags |= ACE4_IDENTIFIER_GROUP;
186
a->e_id = ids[i].unixid->id;
180
a->e_id = ids[i].xid.id;
190
184
privs = root_privileges();
191
185
status = pvfs_xattr_ndr_save(pvfs, name->full_name, fd,
192
186
NFS4ACL_XATTR_NAME,
193
&acl, ndr_push_nfs4acl);
187
&acl, (void *) ndr_push_nfs4acl);
194
188
talloc_free(privs);
196
190
talloc_free(tmp_ctx);