|
|
2fc102 |
From 4206e5dbe37277a4002010e85438fe376b5b1812 Mon Sep 17 00:00:00 2001
|
|
|
2fc102 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
2fc102 |
Date: Mon, 3 Feb 2014 13:30:35 +0100
|
|
|
2fc102 |
Subject: [PATCH 93/97] IDMAP: add sss_idmap_check_collision(_ex)
|
|
|
2fc102 |
|
|
|
2fc102 |
---
|
|
|
2fc102 |
src/lib/idmap/sss_idmap.c | 129 ++++++++++++++++++++++++++------------
|
|
|
2fc102 |
src/lib/idmap/sss_idmap.h | 65 +++++++++++++++++++
|
|
|
2fc102 |
src/tests/cmocka/test_sss_idmap.c | 93 +++++++++++++++++++++++++++
|
|
|
2fc102 |
3 files changed, 247 insertions(+), 40 deletions(-)
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
|
|
|
2fc102 |
index 3f1e7a58f390a3c10999251e2155ef513ba69bd7..4c453120539a549807e9b6bb4db2dc396c1b3152 100644
|
|
|
2fc102 |
--- a/src/lib/idmap/sss_idmap.c
|
|
|
2fc102 |
+++ b/src/lib/idmap/sss_idmap.c
|
|
|
2fc102 |
@@ -380,55 +380,104 @@ enum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
return IDMAP_SUCCESS;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_check_collision_ex(const char *o_name,
|
|
|
2fc102 |
+ const char *o_sid,
|
|
|
2fc102 |
+ struct sss_idmap_range *o_range,
|
|
|
2fc102 |
+ uint32_t o_first_rid,
|
|
|
2fc102 |
+ const char *o_range_id,
|
|
|
2fc102 |
+ bool o_external_mapping,
|
|
|
2fc102 |
+ const char *n_name,
|
|
|
2fc102 |
+ const char *n_sid,
|
|
|
2fc102 |
+ struct sss_idmap_range *n_range,
|
|
|
2fc102 |
+ uint32_t n_first_rid,
|
|
|
2fc102 |
+ const char *n_range_id,
|
|
|
2fc102 |
+ bool n_external_mapping)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ bool names_equal;
|
|
|
2fc102 |
+ bool sids_equal;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* TODO: if both ranges have the same ID check if an update is
|
|
|
2fc102 |
+ * needed. */
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Check if ID ranges overlap.
|
|
|
2fc102 |
+ * ID ranges with external mapping may overlap. */
|
|
|
2fc102 |
+ if ((!n_external_mapping && !o_external_mapping)
|
|
|
2fc102 |
+ && ((n_range->min >= o_range->min
|
|
|
2fc102 |
+ && n_range->min <= o_range->max)
|
|
|
2fc102 |
+ || (n_range->max >= o_range->min
|
|
|
2fc102 |
+ && n_range->max <= o_range->max))) {
|
|
|
2fc102 |
+ return IDMAP_COLLISION;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ names_equal = (strcasecmp(n_name, o_name) == 0);
|
|
|
2fc102 |
+ sids_equal = ((n_sid == NULL && o_sid == NULL)
|
|
|
2fc102 |
+ || (n_sid != NULL && o_sid != NULL
|
|
|
2fc102 |
+ && strcasecmp(n_sid, o_sid) == 0));
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* check if domain name and SID are consistent */
|
|
|
2fc102 |
+ if ((names_equal && !sids_equal) || (!names_equal && sids_equal)) {
|
|
|
2fc102 |
+ return IDMAP_COLLISION;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* check if external_mapping is consistent */
|
|
|
2fc102 |
+ if (names_equal && sids_equal
|
|
|
2fc102 |
+ && n_external_mapping != o_external_mapping) {
|
|
|
2fc102 |
+ return IDMAP_COLLISION;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* check if RID ranges overlap */
|
|
|
2fc102 |
+ if (names_equal && sids_equal
|
|
|
2fc102 |
+ && n_external_mapping == false
|
|
|
2fc102 |
+ && n_first_rid >= o_first_rid
|
|
|
2fc102 |
+ && n_first_rid <= o_first_rid + (o_range->max - o_range->min)) {
|
|
|
2fc102 |
+ return IDMAP_COLLISION;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ return IDMAP_SUCCESS;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_check_collision(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ char *n_name, char *n_sid,
|
|
|
2fc102 |
+ struct sss_idmap_range *n_range,
|
|
|
2fc102 |
+ uint32_t n_first_rid,
|
|
|
2fc102 |
+ char *n_range_id,
|
|
|
2fc102 |
+ bool n_external_mapping)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ struct idmap_domain_info *dom;
|
|
|
2fc102 |
+ enum idmap_error_code err;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ for (dom = ctx->idmap_domain_info; dom != NULL; dom = dom->next) {
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(dom->name, dom->sid, dom->range,
|
|
|
2fc102 |
+ dom->first_rid, dom->range_id,
|
|
|
2fc102 |
+ dom->external_mapping,
|
|
|
2fc102 |
+ n_name, n_sid, n_range, n_first_rid,
|
|
|
2fc102 |
+ n_range_id, n_external_mapping);
|
|
|
2fc102 |
+ if (err != IDMAP_SUCCESS) {
|
|
|
2fc102 |
+ return err;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+ return IDMAP_SUCCESS;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
static enum idmap_error_code dom_check_collision(
|
|
|
2fc102 |
struct idmap_domain_info *dom_list,
|
|
|
2fc102 |
struct idmap_domain_info *new_dom)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
struct idmap_domain_info *dom;
|
|
|
2fc102 |
- bool names_equal;
|
|
|
2fc102 |
- bool sids_equal;
|
|
|
2fc102 |
+ enum idmap_error_code err;
|
|
|
2fc102 |
|
|
|
2fc102 |
for (dom = dom_list; dom != NULL; dom = dom->next) {
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- /* TODO: if both ranges have the same ID check if an update is
|
|
|
2fc102 |
- * needed. */
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- /* Check if ID ranges overlap.
|
|
|
2fc102 |
- * ID ranges with external mapping may overlap. */
|
|
|
2fc102 |
- if ((!new_dom->external_mapping && !dom->external_mapping)
|
|
|
2fc102 |
- && ((new_dom->range->min >= dom->range->min
|
|
|
2fc102 |
- && new_dom->range->min <= dom->range->max)
|
|
|
2fc102 |
- || (new_dom->range->max >= dom->range->min
|
|
|
2fc102 |
- && new_dom->range->max <= dom->range->max))) {
|
|
|
2fc102 |
- return IDMAP_COLLISION;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- names_equal = (strcasecmp(new_dom->name, dom->name) == 0);
|
|
|
2fc102 |
- sids_equal = ((new_dom->sid == NULL && dom->sid == NULL)
|
|
|
2fc102 |
- || (new_dom->sid != NULL && dom->sid != NULL
|
|
|
2fc102 |
- && strcasecmp(new_dom->sid, dom->sid) == 0));
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- /* check if domain name and SID are consistent */
|
|
|
2fc102 |
- if ((names_equal && !sids_equal) || (!names_equal && sids_equal)) {
|
|
|
2fc102 |
- return IDMAP_COLLISION;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- /* check if external_mapping is consistent */
|
|
|
2fc102 |
- if (names_equal && sids_equal
|
|
|
2fc102 |
- && new_dom->external_mapping != dom->external_mapping) {
|
|
|
2fc102 |
- return IDMAP_COLLISION;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
- /* check if RID ranges overlap */
|
|
|
2fc102 |
- if (names_equal && sids_equal
|
|
|
2fc102 |
- && new_dom->external_mapping == false
|
|
|
2fc102 |
- && new_dom->first_rid >= dom->first_rid
|
|
|
2fc102 |
- && new_dom->first_rid <=
|
|
|
2fc102 |
- dom->first_rid + (dom->range->max - dom->range->min)) {
|
|
|
2fc102 |
- return IDMAP_COLLISION;
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(dom->name, dom->sid, dom->range,
|
|
|
2fc102 |
+ dom->first_rid, dom->range_id,
|
|
|
2fc102 |
+ dom->external_mapping,
|
|
|
2fc102 |
+ new_dom->name, new_dom->sid,
|
|
|
2fc102 |
+ new_dom->range, new_dom->first_rid,
|
|
|
2fc102 |
+ new_dom->range_id,
|
|
|
2fc102 |
+ new_dom->external_mapping);
|
|
|
2fc102 |
+ if (err != IDMAP_SUCCESS) {
|
|
|
2fc102 |
+ return err;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
}
|
|
|
2fc102 |
-
|
|
|
2fc102 |
return IDMAP_SUCCESS;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/lib/idmap/sss_idmap.h b/src/lib/idmap/sss_idmap.h
|
|
|
2fc102 |
index 1e1c9a5cfe490301d0e633db808589f1bc0ef857..ccc63f7f760b877cdb17696325731f8e540b2736 100644
|
|
|
2fc102 |
--- a/src/lib/idmap/sss_idmap.h
|
|
|
2fc102 |
+++ b/src/lib/idmap/sss_idmap.h
|
|
|
2fc102 |
@@ -289,6 +289,71 @@ enum idmap_error_code sss_idmap_add_domain_ex(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
const char *range_id,
|
|
|
2fc102 |
uint32_t rid,
|
|
|
2fc102 |
bool external_mapping);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/**
|
|
|
2fc102 |
+ * @brief Check if a new range would collide with any existing one
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @param[in] ctx Idmap context
|
|
|
2fc102 |
+ * @param[in] n_name Zero-terminated string with the domain name the new
|
|
|
2fc102 |
+ * range should belong to
|
|
|
2fc102 |
+ * @param[in] n_sid Zero-terminated string representation of the domain
|
|
|
2fc102 |
+ * SID (S-1-15-.....) the new range sould belong to
|
|
|
2fc102 |
+ * @param[in] n_range The new id range
|
|
|
2fc102 |
+ * @param[in] n_range_id unique identifier of the new range, it is needed
|
|
|
2fc102 |
+ * to allow updates at runtime, may be NULL
|
|
|
2fc102 |
+ * @param[in] n_first_rid The RID that should be mapped to the first ID of the
|
|
|
2fc102 |
+ * new range.
|
|
|
2fc102 |
+ * @param[in] n_external_mapping Mapping type of the new range
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @return
|
|
|
2fc102 |
+ * - #IDMAP_COLLISION: New range collides with existing one
|
|
|
2fc102 |
+ */
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_check_collision(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ char *n_name, char *n_sid,
|
|
|
2fc102 |
+ struct sss_idmap_range *n_range,
|
|
|
2fc102 |
+ uint32_t n_first_rid,
|
|
|
2fc102 |
+ char *n_range_id,
|
|
|
2fc102 |
+ bool n_external_mapping);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/**
|
|
|
2fc102 |
+ * @brief Check if two ranges would collide
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @param[in] o_name Zero-terminated string with the domain name the
|
|
|
2fc102 |
+ * first range should belong to
|
|
|
2fc102 |
+ * @param[in] o_sid Zero-terminated string representation of the domain
|
|
|
2fc102 |
+ * SID (S-1-15-.....) the first range sould belong to
|
|
|
2fc102 |
+ * @param[in] o_range The first id range
|
|
|
2fc102 |
+ * @param[in] o_range_id unique identifier of the first range, it is needed
|
|
|
2fc102 |
+ * to allow updates at runtime, may be NULL
|
|
|
2fc102 |
+ * @param[in] o_first_rid The RID that should be mapped to the first ID of the
|
|
|
2fc102 |
+ * first range.
|
|
|
2fc102 |
+ * @param[in] o_external_mapping Mapping type of the first range
|
|
|
2fc102 |
+ * @param[in] n_name Zero-terminated string with the domain name the
|
|
|
2fc102 |
+ * second range should belong to
|
|
|
2fc102 |
+ * @param[in] n_sid Zero-terminated string representation of the domain
|
|
|
2fc102 |
+ * SID (S-1-15-.....) the second range sould belong to
|
|
|
2fc102 |
+ * @param[in] n_range The second id range
|
|
|
2fc102 |
+ * @param[in] n_range_id unique identifier of the second range, it is needed
|
|
|
2fc102 |
+ * to allow updates at runtime, may be NULL
|
|
|
2fc102 |
+ * @param[in] n_first_rid The RID that should be mapped to the first ID of the
|
|
|
2fc102 |
+ * second range.
|
|
|
2fc102 |
+ * @param[in] n_external_mapping Mapping type of the second range
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @return
|
|
|
2fc102 |
+ * - #IDMAP_COLLISION: New range collides with existing one
|
|
|
2fc102 |
+ */
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_check_collision_ex(const char *o_name,
|
|
|
2fc102 |
+ const char *o_sid,
|
|
|
2fc102 |
+ struct sss_idmap_range *o_range,
|
|
|
2fc102 |
+ uint32_t o_first_rid,
|
|
|
2fc102 |
+ const char *o_range_id,
|
|
|
2fc102 |
+ bool o_external_mapping,
|
|
|
2fc102 |
+ const char *n_name,
|
|
|
2fc102 |
+ const char *n_sid,
|
|
|
2fc102 |
+ struct sss_idmap_range *n_range,
|
|
|
2fc102 |
+ uint32_t n_first_rid,
|
|
|
2fc102 |
+ const char *n_range_id,
|
|
|
2fc102 |
+ bool n_external_mapping);
|
|
|
2fc102 |
/**
|
|
|
2fc102 |
* @brief Translate SID to a unix UID or GID
|
|
|
2fc102 |
*
|
|
|
2fc102 |
diff --git a/src/tests/cmocka/test_sss_idmap.c b/src/tests/cmocka/test_sss_idmap.c
|
|
|
2fc102 |
index 019b4618ef0e14e87cb86d64989e8f5ca9dfdfd8..ff933216416b61618bf764d8c2554b273706c787 100644
|
|
|
2fc102 |
--- a/src/tests/cmocka/test_sss_idmap.c
|
|
|
2fc102 |
+++ b/src/tests/cmocka/test_sss_idmap.c
|
|
|
2fc102 |
@@ -30,11 +30,15 @@
|
|
|
2fc102 |
#define TEST_RANGE_MAX 399999
|
|
|
2fc102 |
#define TEST_DOM_NAME "test.dom"
|
|
|
2fc102 |
#define TEST_DOM_SID "S-1-5-21-123-456-789"
|
|
|
2fc102 |
+#define TEST_FIRST_RID 0
|
|
|
2fc102 |
+#define TEST_EXT_MAPPING true
|
|
|
2fc102 |
|
|
|
2fc102 |
#define TEST_2_RANGE_MIN 600000
|
|
|
2fc102 |
#define TEST_2_RANGE_MAX 799999
|
|
|
2fc102 |
#define TEST_2_DOM_NAME "test2.dom"
|
|
|
2fc102 |
#define TEST_2_DOM_SID "S-1-5-21-987-654-321"
|
|
|
2fc102 |
+#define TEST_2_FIRST_RID 1000000
|
|
|
2fc102 |
+#define TEST_2_EXT_MAPPING true
|
|
|
2fc102 |
|
|
|
2fc102 |
#define TEST_OFFSET 1000000
|
|
|
2fc102 |
#define TEST_OFFSET_STR "1000000"
|
|
|
2fc102 |
@@ -408,6 +412,94 @@ void test_has_algorithmic_by_name(void **state)
|
|
|
2fc102 |
assert_false(use_id_mapping);
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
+void test_sss_idmap_check_collision_ex(void **state)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ enum idmap_error_code err;
|
|
|
2fc102 |
+ struct sss_idmap_range r1 = {TEST_RANGE_MIN, TEST_RANGE_MAX};
|
|
|
2fc102 |
+ struct sss_idmap_range r2 = {TEST_2_RANGE_MIN, TEST_2_RANGE_MAX};
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_EXT_MAPPING,
|
|
|
2fc102 |
+ TEST_2_DOM_NAME, TEST_2_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_2_EXT_MAPPING);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_SUCCESS);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Same name, different SID */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_EXT_MAPPING,
|
|
|
2fc102 |
+ TEST_DOM_NAME, TEST_2_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_2_EXT_MAPPING);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_COLLISION);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Same SID, different name */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_EXT_MAPPING,
|
|
|
2fc102 |
+ TEST_2_DOM_NAME, TEST_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_2_EXT_MAPPING);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_COLLISION);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Same SID and name, no overlaps */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_EXT_MAPPING,
|
|
|
2fc102 |
+ TEST_DOM_NAME, TEST_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_2_EXT_MAPPING);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_SUCCESS);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Same SID and name, different mappings */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ TEST_EXT_MAPPING,
|
|
|
2fc102 |
+ TEST_DOM_NAME, TEST_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ !TEST_EXT_MAPPING);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_COLLISION);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Same SID and name, Overlapping RID range */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ false,
|
|
|
2fc102 |
+ TEST_DOM_NAME, TEST_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ false);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_COLLISION);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Different SID and name, Overlapping RID range */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ false,
|
|
|
2fc102 |
+ TEST_2_DOM_NAME, TEST_2_DOM_SID, &r2,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ false);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_SUCCESS);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Overlapping ranges with no external mapping */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ false,
|
|
|
2fc102 |
+ TEST_2_DOM_NAME, TEST_2_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ false);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_COLLISION);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ /* Overlapping ranges with external mapping */
|
|
|
2fc102 |
+ err = sss_idmap_check_collision_ex(TEST_DOM_NAME, TEST_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_FIRST_RID, NULL,
|
|
|
2fc102 |
+ true,
|
|
|
2fc102 |
+ TEST_2_DOM_NAME, TEST_2_DOM_SID, &r1,
|
|
|
2fc102 |
+ TEST_2_FIRST_RID, NULL,
|
|
|
2fc102 |
+ true);
|
|
|
2fc102 |
+ assert_int_equal(err, IDMAP_SUCCESS);
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
int main(int argc, const char *argv[])
|
|
|
2fc102 |
{
|
|
|
2fc102 |
poptContext pc;
|
|
|
2fc102 |
@@ -439,6 +531,7 @@ int main(int argc, const char *argv[])
|
|
|
2fc102 |
unit_test_setup_teardown(test_has_algorithmic_by_name,
|
|
|
2fc102 |
test_sss_idmap_setup_with_both,
|
|
|
2fc102 |
test_sss_idmap_teardown),
|
|
|
2fc102 |
+ unit_test(test_sss_idmap_check_collision_ex),
|
|
|
2fc102 |
};
|
|
|
2fc102 |
|
|
|
2fc102 |
/* Set debug level to invalid value so we can deside if -d 0 was used. */
|
|
|
2fc102 |
--
|
|
|
2fc102 |
1.8.5.3
|
|
|
2fc102 |
|