diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/db/sysdb_ops.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c index 687c754f..e62711a2 100644 --- a/server/db/sysdb_ops.c +++ b/server/db/sysdb_ops.c @@ -1334,15 +1334,27 @@ static void sysdb_get_new_id_base(struct tevent_req *subreq) /* verify the id is actually really free. * search all entries with id >= new_id and < max_id */ - filter = talloc_asprintf(state, - "(|(&(%s>=%u)(%s<=%u))(&(%s>=%u)(%s<=%u)))", - SYSDB_UIDNUM, state->new_id, - SYSDB_UIDNUM, state->domain->id_max, - SYSDB_GIDNUM, state->new_id, - SYSDB_GIDNUM, state->domain->id_max); - if (!filter) { - tevent_req_error(req, ENOMEM); - return; + if (state->domain->id_max) { + filter = talloc_asprintf(state, + "(|(&(%s>=%u)(%s<=%u))(&(%s>=%u)(%s<=%u)))", + SYSDB_UIDNUM, state->new_id, + SYSDB_UIDNUM, state->domain->id_max, + SYSDB_GIDNUM, state->new_id, + SYSDB_GIDNUM, state->domain->id_max); + if (!filter) { + tevent_req_error(req, ENOMEM); + return; + } + } + else { + filter = talloc_asprintf(state, + "(|(%s>=%u)(%s>=%u))", + SYSDB_UIDNUM, state->new_id, + SYSDB_GIDNUM, state->new_id); + if (!filter) { + tevent_req_error(req, ENOMEM); + return; + } } ret = ldb_build_search_req(&ldbreq, state->handle->ctx->ldb, state, |