amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone
Blob Blame History Raw
From a886214ba26d9b74895269d83de62bd310b7d18c Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Mon, 2 Dec 2013 15:08:15 -0500
Subject: [PATCH 53/65] Ticket 47613 - Impossible to configure
 nsslapd-allowed-sasl-mechanisms

Bug Description:  The design doc sasy you can use comma separated list of supported mechanisms,
                  but in fact this was not supported.

Fix Description:  Allow comma separated lists.

https://fedorahosted.org/389/ticket/47613

Reviewed by: richm(Thanks!)
(cherry picked from commit 6200f6812682760cd2a54d6a3bcbb009a0dffe79)
(cherry picked from commit f1461312fc9e221413b19d6babbdf5a886794d10)
---
 ldap/servers/slapd/libglobs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index f8c5b01..b925a2c 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -125,6 +125,7 @@ static int config_set_onoff( const char *attrname, char *value,
 		int *configvalue, char *errorbuf, int apply );
 static int config_set_schemareplace ( const char *attrname, char *value,
 		char *errorbuf, int apply );
+static void remove_commas(char *str);
 
 /* Keeping the initial values */
 /* CONFIG_INT/CONFIG_LONG */
@@ -6764,6 +6765,9 @@ config_set_allowed_sasl_mechs(const char *attrname, char *value, char *errorbuf,
         return LDAP_SUCCESS;
     }
 
+    /* cyrus sasl doesn't like comma separated lists */
+    remove_commas(value);
+
     CFG_LOCK_WRITE(slapdFrontendConfig);
     slapdFrontendConfig->allowed_sasl_mechs = slapi_ch_strdup(value);
     CFG_UNLOCK_WRITE(slapdFrontendConfig);
@@ -7434,3 +7438,17 @@ slapi_err2string(int result)
 #endif
 }
 
+/* replace commas with spaces */
+static void
+remove_commas(char *str)
+{
+    int i;
+
+    for (i = 0; str && str[i]; i++)
+    {
+        if (str[i] == ',')
+        {
+            str[i] = ' ';
+        }
+    }
+}
-- 
1.8.1.4