From 358f930fc38fc53b2c2d308d219075dce0288f3a Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Sun, 22 Apr 2012 13:57:54 -0400
Subject: [PATCH 05/20] LDAP: Add ID mapping range settings

---
 src/config/SSSDConfig.py                 |    4 ++++
 src/config/etc/sssd.api.d/sssd-ipa.conf  |    3 +++
 src/config/etc/sssd.api.d/sssd-ldap.conf |    3 +++
 src/providers/ipa/ipa_opts.h             |    3 +++
 src/providers/ldap/ldap_opts.h           |    3 +++
 src/providers/ldap/sdap.h                |    3 +++
 6 files changed, 19 insertions(+)

diff --git a/src/config/SSSDConfig.py b/src/config/SSSDConfig.py
index 3433cb62f8ab0eaa0626532d2061b6a298e0a7b7..a4eef0cbfa370362135b6c12f50f91efa914d9cd 100644
--- a/src/config/SSSDConfig.py
+++ b/src/config/SSSDConfig.py
@@ -260,6 +260,10 @@ option_strings = {
     'ldap_service_proto' : _('Service protocol attribute'),
     #replaced by ldap_entry_usn# 'ldap_service_entry_usn' : _('Service entryUSN attribute'),
 
+    'ldap_idmap_range_min' : _('Lower bound for ID-mapping'),
+    'ldap_idmap_range_max' : _('Upper bound for ID-mapping'),
+    'ldap_idmap_range_size' : _('Number of IDs for each slice when ID-mapping'),
+
     # [provider/ldap/auth]
     'ldap_pwd_policy' : _('Policy to evaluate the password expiration'),
 
diff --git a/src/config/etc/sssd.api.d/sssd-ipa.conf b/src/config/etc/sssd.api.d/sssd-ipa.conf
index 162dab579dece30e7e51191bebc6d71e17fc475a..1cad031fc053fd748549630fadb3f7428c0877c5 100644
--- a/src/config/etc/sssd.api.d/sssd-ipa.conf
+++ b/src/config/etc/sssd.api.d/sssd-ipa.conf
@@ -110,6 +110,9 @@ ldap_service_entry_usn = str, None, false
 ipa_host_object_class = str, None, false
 ipa_host_fqdn = str, None, false
 ipa_host_ssh_public_key = str, None, false
+ldap_idmap_range_min = int, None, false
+ldap_idmap_range_max = int, None, false
+ldap_idmap_range_size = int, None, false
 
 [provider/ipa/auth]
 krb5_ccachedir = str, None, false
diff --git a/src/config/etc/sssd.api.d/sssd-ldap.conf b/src/config/etc/sssd.api.d/sssd-ldap.conf
index 766216f64ebe964d6f29e84c14196cdaf3548d31..795181554dff969c910ac1fee1ef35f0ca61bf61 100644
--- a/src/config/etc/sssd.api.d/sssd-ldap.conf
+++ b/src/config/etc/sssd.api.d/sssd-ldap.conf
@@ -104,6 +104,9 @@ ldap_service_port = str, None, false
 ldap_service_proto = str, None, false
 ldap_service_search_base = str, None, false
 ldap_service_entry_usn = str, None, false
+ldap_idmap_range_min = int, None, false
+ldap_idmap_range_max = int, None, false
+ldap_idmap_range_size = int, None, false
 
 [provider/ldap/auth]
 ldap_pwd_policy = str, None, false
diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h
index 75ce632e09b62ad8331f78cb3f3e3f3b775aeeaf..866bd3ce0a21ade58f79ba05504c837296eae4bf 100644
--- a/src/providers/ipa/ipa_opts.h
+++ b/src/providers/ipa/ipa_opts.h
@@ -114,6 +114,9 @@ struct dp_option ipa_def_ldap_opts[] = {
     { "ldap_sasl_canonicalize", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
     { "ldap_connection_expire_timeout", DP_OPT_NUMBER, { .number = 900 }, NULL_NUMBER },
     { "ldap_disable_paging", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
+    { "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 },
     DP_OPTION_TERMINATOR
 };
 
diff --git a/src/providers/ldap/ldap_opts.h b/src/providers/ldap/ldap_opts.h
index 1f9ca57a892b90208eacfabb4ad13ce6aecc3ef3..a4c780691f46a77bd8068ed21bd1e1d84d510087 100644
--- a/src/providers/ldap/ldap_opts.h
+++ b/src/providers/ldap/ldap_opts.h
@@ -96,6 +96,9 @@ struct dp_option default_basic_opts[] = {
     { "ldap_sasl_canonicalize", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
     { "ldap_connection_expire_timeout", DP_OPT_NUMBER, { .number = 900 }, NULL_NUMBER },
     { "ldap_disable_paging", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
+    { "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 },
     DP_OPTION_TERMINATOR
 };
 
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index 9ef880042237bb2b85252667f67c24d31e0cd3d6..71ae246d01ff7ccfd25413f4d8add69ba3f329b9 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -211,6 +211,9 @@ enum sdap_basic_opt {
     SDAP_SASL_CANONICALIZE,
     SDAP_EXPIRE_TIMEOUT,
     SDAP_DISABLE_PAGING,
+    SDAP_IDMAP_LOWER,
+    SDAP_IDMAP_UPPER,
+    SDAP_IDMAP_RANGESIZE,
 
     SDAP_OPTS_BASIC /* opts counter */
 };
-- 
1.7.10

