From 2fd5864ac8eb2c4cfa0fafe7c0431a74f2ebe1fb Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Sat, 21 Apr 2012 09:09:43 -0400 Subject: LDAP: Add autorid compatibility mode --- src/providers/ldap/sdap_idmap.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/providers/ldap/sdap_idmap.c') diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c index ea65195a..24e7ef37 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) { -- cgit