summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-04-21 09:09:43 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-05-03 14:09:14 -0400
commit2fd5864ac8eb2c4cfa0fafe7c0431a74f2ebe1fb (patch)
tree52617e91f66878f085b4bc09ec0f681d65a8d129 /src/providers
parent8538f3d5109c548049c344fa042684d9d40f04d6 (diff)
downloadsssd-2fd5864ac8eb2c4cfa0fafe7c0431a74f2ebe1fb.tar.gz
sssd-2fd5864ac8eb2c4cfa0fafe7c0431a74f2ebe1fb.tar.xz
sssd-2fd5864ac8eb2c4cfa0fafe7c0431a74f2ebe1fb.zip
LDAP: Add autorid compatibility mode
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ipa/ipa_opts.h1
-rw-r--r--src/providers/ldap/ldap_opts.h1
-rw-r--r--src/providers/ldap/sdap.h1
-rw-r--r--src/providers/ldap/sdap_idmap.c22
4 files changed, 17 insertions, 8 deletions
diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h
index 866bd3ce0..ee9ff15f3 100644
--- a/src/providers/ipa/ipa_opts.h
+++ b/src/providers/ipa/ipa_opts.h
@@ -117,6 +117,7 @@ struct dp_option ipa_def_ldap_opts[] = {
{ "ldap_idmap_range_min", DP_OPT_NUMBER, { .number = 100001 }, NULL_NUMBER },
{ "ldap_idmap_range_max", DP_OPT_NUMBER, { .number = 2000100000LL }, NULL_NUMBER },
{ "ldap_idmap_range_size", DP_OPT_NUMBER, { .number = 200000 }, NULL_NUMBER },
+ { "ldap_idmap_autorid_compat", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
DP_OPTION_TERMINATOR
};
diff --git a/src/providers/ldap/ldap_opts.h b/src/providers/ldap/ldap_opts.h
index a4c780691..8b8ea25c6 100644
--- a/src/providers/ldap/ldap_opts.h
+++ b/src/providers/ldap/ldap_opts.h
@@ -99,6 +99,7 @@ struct dp_option default_basic_opts[] = {
{ "ldap_idmap_range_min", DP_OPT_NUMBER, { .number = 100001 }, NULL_NUMBER },
{ "ldap_idmap_range_max", DP_OPT_NUMBER, { .number = 2000100000LL }, NULL_NUMBER },
{ "ldap_idmap_range_size", DP_OPT_NUMBER, { .number = 200000 }, NULL_NUMBER },
+ { "ldap_idmap_autorid_compat", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
DP_OPTION_TERMINATOR
};
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index d72a0edd9..7c55ad5a0 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -214,6 +214,7 @@ enum sdap_basic_opt {
SDAP_IDMAP_LOWER,
SDAP_IDMAP_UPPER,
SDAP_IDMAP_RANGESIZE,
+ SDAP_IDMAP_AUTORID_COMPAT,
SDAP_OPTS_BASIC /* opts counter */
};
diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c
index ea65195ac..24e7ef371 100644
--- a/src/providers/ldap/sdap_idmap.c
+++ b/src/providers/ldap/sdap_idmap.c
@@ -196,15 +196,21 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx,
} else {
/* If slice is -1, we're being asked to pick a new slice */
- /* Hash the domain sid string */
- hash_val = murmurhash3(dom_sid, strlen(dom_sid), 0xdeadbeef);
-
- /* Now get take the modulus of the hash val and the max_slices
- * to determine its optimal position in the range.
- */
- new_slice->slice_num = hash_val % max_slices;
- orig_slice = new_slice->slice_num;
+ if (dp_opt_get_bool(idmap_ctx->id_ctx->opts->basic, SDAP_IDMAP_AUTORID_COMPAT)) {
+ /* In autorid compatibility mode, always start at 0 and find the first
+ * free value.
+ */
+ orig_slice = 0;
+ } else {
+ /* Hash the domain sid string */
+ hash_val = murmurhash3(dom_sid, strlen(dom_sid), 0xdeadbeef);
+ /* Now get take the modulus of the hash val and the max_slices
+ * to determine its optimal position in the range.
+ */
+ new_slice->slice_num = hash_val % max_slices;
+ orig_slice = new_slice->slice_num;
+ }
/* Verify that this slice is not already in use */
do {
DLIST_FOR_EACH(s, idmap_ctx->slices) {