summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-08-26 10:54:09 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-29 08:24:04 -0400
commit5e9a8ba6a9e20f984722f6252575f08231f35701 (patch)
tree35768af6bd605fcf07f008ad2317a7631f303b83 /src/providers
parent088ebc59997fd75d290ca2a5ea1e9c1261ae2006 (diff)
downloadsssd-5e9a8ba6a9e20f984722f6252575f08231f35701.tar.gz
sssd-5e9a8ba6a9e20f984722f6252575f08231f35701.tar.xz
sssd-5e9a8ba6a9e20f984722f6252575f08231f35701.zip
Add LDAP provider option to set LDAP_OPT_X_SASL_NOCANON
https://fedorahosted.org/sssd/ticket/978
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ipa/ipa_common.c3
-rw-r--r--src/providers/ipa/ipa_common.h2
-rw-r--r--src/providers/ldap/ldap_common.c3
-rw-r--r--src/providers/ldap/sdap.h1
-rw-r--r--src/providers/ldap/sdap_async_connection.c11
5 files changed, 17 insertions, 3 deletions
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c
index 115172250..0736f69c1 100644
--- a/src/providers/ipa/ipa_common.c
+++ b/src/providers/ipa/ipa_common.c
@@ -94,7 +94,8 @@ struct dp_option ipa_def_ldap_opts[] = {
* manpages or SSSDConfig API
*/
{ "ldap_auth_disable_tls_never_use_in_production", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
- { "ldap_page_size", DP_OPT_NUMBER, { .number = 1000 }, NULL_NUMBER }
+ { "ldap_page_size", DP_OPT_NUMBER, { .number = 1000 }, NULL_NUMBER },
+ { "ldap_sasl_canonicalize", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }
};
struct sdap_attr_map ipa_attr_map[] = {
diff --git a/src/providers/ipa/ipa_common.h b/src/providers/ipa/ipa_common.h
index f6e1d4e5b..7a36a709c 100644
--- a/src/providers/ipa/ipa_common.h
+++ b/src/providers/ipa/ipa_common.h
@@ -35,7 +35,7 @@ struct ipa_service {
/* the following defines are used to keep track of the options in the ldap
* module, so that if they change and ipa is not updated correspondingly
* this will trigger a runtime abort error */
-#define IPA_OPTS_BASIC_TEST 49
+#define IPA_OPTS_BASIC_TEST 50
/* the following define is used to keep track of the options in the krb5
* module, so that if they change and ipa is not updated correspondingly
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index 4af36ba68..5a1b4fa50 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -86,7 +86,8 @@ struct dp_option default_basic_opts[] = {
* manpages or SSSDConfig API
*/
{ "ldap_auth_disable_tls_never_use_in_production", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
- { "ldap_page_size", DP_OPT_NUMBER, { .number = 1000 }, NULL_NUMBER }
+ { "ldap_page_size", DP_OPT_NUMBER, { .number = 1000 }, NULL_NUMBER },
+ { "ldap_sasl_canonicalize", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }
};
struct sdap_attr_map generic_attr_map[] = {
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index 7fa56331e..ed24e756d 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -204,6 +204,7 @@ enum sdap_basic_opt {
SDAP_ENUM_SEARCH_TIMEOUT,
SDAP_DISABLE_AUTH_TLS,
SDAP_PAGE_SIZE,
+ SDAP_SASL_CANONICALIZE,
SDAP_OPTS_BASIC /* opts counter */
};
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index e2a8426df..c02307814 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -147,6 +147,7 @@ static void sdap_sys_connect_done(struct tevent_req *subreq)
int ldap_deref_val;
struct sdap_rebind_proc_params *rebind_proc_params;
int sd;
+ bool sasl_nocanon;
ret = sss_ldap_init_recv(subreq, &state->sh->ldap, &sd);
talloc_zfree(subreq);
@@ -256,6 +257,16 @@ static void sdap_sys_connect_done(struct tevent_req *subreq)
}
+ /* Set host name canonicalization for LDAP SASL bind */
+ sasl_nocanon = !dp_opt_get_bool(state->opts->basic, SDAP_SASL_CANONICALIZE);
+ lret = ldap_set_option(state->sh->ldap, LDAP_OPT_X_SASL_NOCANON,
+ sasl_nocanon ? LDAP_OPT_ON : LDAP_OPT_OFF);
+ if (lret != LDAP_OPT_SUCCESS) {
+ DEBUG(1, ("Failed to set LDAP SASL nocanon option to %s\n",
+ sasl_nocanon ? "true" : "false"));
+ goto fail;
+ }
+
/* if we do not use start_tls the connection is not really connected yet
* just fake an async procedure and leave connection to the bind call */
if (!state->use_start_tls) {