summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2006-11-07 04:42:55 +0000
committerNathan Kinder <nkinder@redhat.com>2006-11-07 04:42:55 +0000
commit22ad5a9a938cf0698f8a2e096ff863670c4d03af (patch)
treeff44141dfd7841e491de97a6c050be73f0433514 /ldap
parent6b0713023b625336b49d3c6daeac16c4a6388f43 (diff)
downloadds-22ad5a9a938cf0698f8a2e096ff863670c4d03af.tar.gz
ds-22ad5a9a938cf0698f8a2e096ff863670c4d03af.tar.xz
ds-22ad5a9a938cf0698f8a2e096ff863670c4d03af.zip
Related: 214238
Summary: Make fallback SASL path work for 64-bit Linux default location.
Diffstat (limited to 'ldap')
-rw-r--r--ldap/servers/slapd/charray.c30
-rw-r--r--ldap/servers/slapd/saslbind.c4
-rw-r--r--ldap/servers/slapd/slapi-private.h1
3 files changed, 30 insertions, 5 deletions
diff --git a/ldap/servers/slapd/charray.c b/ldap/servers/slapd/charray.c
index 855b2463..327de756 100644
--- a/ldap/servers/slapd/charray.c
+++ b/ldap/servers/slapd/charray.c
@@ -270,9 +270,20 @@ charray_dup( char **a )
char **
str2charray( char *str, char *brkstr )
{
+ return( str2charray_ext( str, brkstr, 1 ));
+}
+
+/*
+ * extended version of str2charray lets you disallow
+ * duplicate values into the array.
+ */
+char **
+str2charray_ext( char *str, char *brkstr, int allow_dups )
+{
char **res;
char *s;
- int i;
+ int i, j;
+ int dup_found = 0;
char * iter = NULL;
i = 1;
@@ -284,9 +295,22 @@ str2charray( char *str, char *brkstr )
res = (char **) slapi_ch_malloc( (i + 1) * sizeof(char *) );
i = 0;
- for ( s = ldap_utf8strtok_r( str, brkstr , &iter); s != NULL;
+ for ( s = ldap_utf8strtok_r( str, brkstr , &iter); s != NULL;
s = ldap_utf8strtok_r( NULL, brkstr , &iter) ) {
- res[i++] = slapi_ch_strdup( s );
+ dup_found = 0;
+ /* Always copy the first value into the array */
+ if ( (!allow_dups) && (i != 0) ) {
+ /* Check for duplicates */
+ for ( j = 0; j < i; j++ ) {
+ if ( strncmp( res[j], s, strlen( s ) ) == 0 ) {
+ dup_found = 1;
+ break;
+ }
+ }
+ }
+
+ if ( !dup_found )
+ res[i++] = slapi_ch_strdup( s );
}
res[i] = NULL;
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 1c91fe92..8bd1a19c 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -560,7 +560,7 @@ static int ids_sasl_getpluginpath(sasl_conn_t *conn, const char **path)
char *pluginpath = config_get_saslpath();
if ((!pluginpath) || (*pluginpath == '\0')) {
if (!(pluginpath = getenv("SASL_PATH"))) {
- pluginpath = "/usr/lib/sasl2";
+ pluginpath = "/usr/lib64/sasl2:/usr/lib/sasl2";
}
}
*path = pluginpath;
@@ -744,7 +744,7 @@ char **ids_sasl_listmech(Slapi_PBlock *pb)
LDAPDebug(LDAP_DEBUG_TRACE, "sasl library mechs: %s\n", str, 0, 0);
/* merge into result set */
dupstr = slapi_ch_strdup(str);
- others = str2charray(dupstr, ",");
+ others = str2charray_ext(dupstr, ",", 0 /* don't list duplicate mechanisms */);
charray_merge(&ret, others, 1);
charray_free(others);
slapi_ch_free((void**)&dupstr);
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 7cb6021c..fdb883d1 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -760,6 +760,7 @@ int charray_inlist( char **a, char *s );
int charray_utf8_inlist( char **a, char *s );
char ** charray_dup( char **a );
char ** str2charray( char *str, char *brkstr );
+char ** str2charray_ext( char *str, char *brkstr, int allow_dups );
int charray_remove(char **a,const char *s);
char ** cool_charray_dup( char **a );
void cool_charray_free( char **array );