From 2fe18a1614007d20ffaa74387e162b5af4dcafb0 Mon Sep 17 00:00:00 2001 From: Pavel Reichl Date: Wed, 13 Jan 2016 09:07:39 -0500 Subject: [PATCH 48/55] IDMAP: Fix computing max id for slice range Max value of id mapping range was 1 unit too high. Resolves: https://fedorahosted.org/sssd/ticket/2922 Reviewed-by: Sumit Bose (cherry picked from commit 7db89d44b5582a0cb0a61a7aa42a2fac7ca9408f) --- src/lib/idmap/sss_idmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c index 4c453120539a549807e9b6bb4db2dc396c1b3152..b5457f92dbb91ac5109ad17258920549e8808d26 100644 --- a/src/lib/idmap/sss_idmap.c +++ b/src/lib/idmap/sss_idmap.c @@ -336,7 +336,7 @@ enum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx, } min = (rangesize * new_slice) + idmap_lower; - max = min + rangesize; + max = min + rangesize - 1; /* Verify that this slice is not already in use */ do { for (dom = ctx->idmap_domain_info; dom != NULL; dom = dom->next) { @@ -353,7 +353,7 @@ enum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx, } min = (rangesize * new_slice) + idmap_lower; - max = min + rangesize; + max = min + rangesize - 1; break; } } @@ -371,7 +371,7 @@ enum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx, } _range->min = (rangesize * new_slice) + idmap_lower; - _range->max = _range->min + rangesize; + _range->max = _range->min + rangesize - 1; if (slice_num) { *slice_num = new_slice; -- 2.5.0