static int dbwrap_tool_store_uint32(struct db_context *db, const char *keyname, const char *data) { NTSTATUS status; uint32_t value = (uint32_t)strtol(data, NULL, 10); status = dbwrap_trans_store_uint32(db, keyname, value); if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "ERROR: could not store uint32 key '%s': %s\n", keyname, nt_errstr(status)); return -1; } return 0; }
static NTSTATUS idmap_tdb_set_hwm(struct unixid *xid) { const char *hwmkey; const char *hwmtype; uint32_t hwm; uint32_t high_hwm; NTSTATUS ret; /* Get current high water mark */ switch (xid->type) { case ID_TYPE_UID: hwmkey = HWM_USER; hwmtype = "UID"; high_hwm = idmap_tdb_state.high_uid; break; case ID_TYPE_GID: hwmkey = HWM_GROUP; hwmtype = "GID"; high_hwm = idmap_tdb_state.high_gid; break; default: return NT_STATUS_INVALID_PARAMETER; } hwm = xid->id; /* Warn if it is out of range */ if (hwm >= high_hwm) { DEBUG(0, ("Warning: %s range full!! (max: %lu)\n", hwmtype, (unsigned long)high_hwm)); } ret = dbwrap_trans_store_uint32(idmap_alloc_db, hwmkey, hwm); return ret; }