summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-10-09 15:22:53 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-17 13:49:49 +0200
commit7e24fd63a6bdbab7b483aa4162deb78b69d1315c (patch)
treee3b1b02c6ed333f74eb7380e92ac2e35058ceb28 /src/lib
parentfcfc0415a4772330af7aa91eeffeda6ca4bea64d (diff)
downloadsssd-7e24fd63a6bdbab7b483aa4162deb78b69d1315c.tar.gz
sssd-7e24fd63a6bdbab7b483aa4162deb78b69d1315c.tar.xz
sssd-7e24fd63a6bdbab7b483aa4162deb78b69d1315c.zip
idmap: allow ranges with external mapping to overlap
If POSIX IDs are managed externally e.g. by AD it might be possible that the IDs are centrally manages for the whole forest. Hence there might not be a single ID range for each member domain in the forest but only a single ID range for the whole forest. This means that we have to allow collisions if ID ranges in this case. Unit tests are added to make sure that the collisions are only allowed for external mappings.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/idmap/sss_idmap.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
index 89c55fc95..17bd5779e 100644
--- a/src/lib/idmap/sss_idmap.c
+++ b/src/lib/idmap/sss_idmap.c
@@ -357,11 +357,13 @@ static enum idmap_error_code dom_check_collision(
/* TODO: if both ranges have the same ID check if an update is
* needed. */
- /* check if ID ranges overlap */
- if ((new_dom->range->min >= dom->range->min
- && new_dom->range->min <= dom->range->max)
- || (new_dom->range->max >= dom->range->min
- && new_dom->range->max <= dom->range->max)) {
+ /* Check if ID ranges overlap.
+ * ID ranges with external mapping may overlap. */
+ if ((!new_dom->external_mapping && !dom->external_mapping)
+ && ((new_dom->range->min >= dom->range->min
+ && new_dom->range->min <= dom->range->max)
+ || (new_dom->range->max >= dom->range->min
+ && new_dom->range->max <= dom->range->max))) {
return IDMAP_COLLISION;
}