- numstr = talloc_asprintf(db, "%u", domainnum);
- if (!numstr) {
- ret = NT_STATUS_NO_MEMORY;
- goto error;
- }
+ /* increase the HWM */
+ ret = dbwrap_change_uint32_atomic(db, HWM, &domainnum, 1);
+ if (!NT_STATUS_IS_OK(ret)) {
+ DEBUG(1, ("Fatal error while fetching a new "
+ "domain range value!\n"));
+ goto error;
+ }
+
+ /* store away the new mapping in both directions */
+ ret = dbwrap_store_uint32(db, cfg->sid, domainnum);
+ if (!NT_STATUS_IS_OK(ret)) {
+ DEBUG(1, ("Fatal error while storing new "
+ "domain->range assignment!\n"));
+ goto error;
+ }
+
+ numstr = talloc_asprintf(db, "%u", domainnum);
+ if (!numstr) {
+ ret = NT_STATUS_NO_MEMORY;
+ goto error;
+ }