struct lsa_DomainInfo *d;
struct wbint_TransID *ids;
uint32_t num_ids;
+ uint32_t num_mapped = 0;
- struct id_map **id_map_ptrs = NULL;
+ struct id_map **maps = NULL;
struct idmap_domain *dom;
NTSTATUS status = NT_STATUS_NO_MEMORY;
ids = r->in.ids->ids;
num_ids = r->in.ids->num_ids;
- dom = idmap_find_domain_with_sid(d->name.string, d->sid);
- if (dom == NULL) {
- DEBUG(10, ("idmap domain %s:%s not found\n",
- d->name.string, sid_string_dbg(d->sid)));
-
- for (i=0; i<num_ids; i++) {
-
- ids[i].xid = (struct unixid) {
- .id = UINT32_MAX,
- .type = ID_TYPE_NOT_SPECIFIED
- };
- }
-
- return NT_STATUS_OK;
- }
-
- id_map_ptrs = id_map_ptrs_init(talloc_tos(), num_ids);
- if (id_map_ptrs == NULL) {
- goto nomem;
+ maps = id_map_ptrs_init(talloc_tos(), num_ids);
+ if (maps == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
/*
*/
for (i=0; i<num_ids; i++) {
- struct id_map *m = id_map_ptrs[i];
+ struct id_map *m = maps[i];
sid_compose(m->sid, d->sid, ids[i].rid);
m->status = ID_UNKNOWN;
m->xid = (struct unixid) { .type = ids[i].type };
}
- status = dom->methods->sids_to_unixids(dom, id_map_ptrs);
+ dom = idmap_find_domain_with_sid(d->name.string, d->sid);
+ if (dom == NULL) {
+ DEBUG(10, ("idmap domain %s:%s not found\n",
+ d->name.string, sid_string_dbg(d->sid)));
- if (!NT_STATUS_IS_OK(status)) {
+ status = NT_STATUS_NONE_MAPPED;
+ goto done;
+ }
+
+ status = dom->methods->sids_to_unixids(dom, maps);
+ if (!NT_STATUS_IS_OK(status) &&
+ !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED))
+ {
DEBUG(10, ("sids_to_unixids returned %s\n",
nt_errstr(status)));
goto done;
*/
for (i=0; i<num_ids; i++) {
- struct id_map *m = id_map_ptrs[i];
+ struct id_map *m = maps[i];
if (!idmap_unix_id_is_in_range(m->xid.id, dom)) {
m->status = ID_UNMAPPED;
if (m->status == ID_MAPPED) {
ids[i].xid = m->xid;
+ num_mapped += 1;
} else {
ids[i].xid.id = UINT32_MAX;
ids[i].xid.type = ID_TYPE_NOT_SPECIFIED;
}
}
- goto done;
-nomem:
- status = NT_STATUS_NO_MEMORY;
+ if (num_mapped == 0) {
+ status = NT_STATUS_NONE_MAPPED;
+ } else if (num_mapped < num_ids) {
+ status = STATUS_SOME_UNMAPPED;
+ } else {
+ status = NT_STATUS_OK;
+ }
+
done:
- TALLOC_FREE(id_map_ptrs);
+ TALLOC_FREE(maps);
return status;
}