if ((state->ids[i]->status == ID_UNMAPPED) &&
state->allocate_unmapped)
{
- ret = idmap_tdb2_new_mapping(state->dom, state->ids[i]);
- if (!NT_STATUS_IS_OK(ret)) {
- goto done;
+ if (state->ids[i]->sid != NULL) {
+ ret = idmap_tdb2_new_mapping(state->dom,
+ state->ids[i]);
+ if (!NT_STATUS_IS_OK(ret)) {
+ goto done;
+ }
+ } else {
+ /*
+ * Special treatment to only allocate an ID.
+ * (No mapping is stored.)
+ */
+ ret = idmap_tdb2_get_new_id(state->dom,
+ &state->ids[i]->xid);
+ if (!NT_STATUS_IS_OK(ret)) {
+ DEBUG(3, ("Could not allocate id: "
+ "%s\n", nt_errstr(ret)));
+ goto done;
+ }
+ state->ids[i]->status = ID_MAPPED;
}
}
}