config.h.in | 3 ++
configure | 10 +++++++
configure.ac | 6 ++++
ldap/servers/slapd/ldaputil.c | 50 +++++++++++++++++++++++++++++--------
ldap/servers/slapd/saslbind.c | 8 -----
ldap/servers/slapd/slapi-private.h | 3 ++
6 files changed, 63 insertions(+), 17 deletions(-)
New commits:
commit 4c1dfafd915ad6e13b2734b97a57b4b46f28bbf6
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Oct 29 16:31:51 2013 -0700
Ticket #538 - hardcoded sasl2 plugin path in ldaputil.c, saslbind.c
Bug description: The hardcoded sasl2 path is Fedora/RHEL specific.
It needs to support other architectures with other filesystem
format.
Fix description: This patch supports ARM architectures with GNU
triplet format.
https://fedorahosted.org/389/ticket/538
Reviewed by rmeggins (Thank you, Rich!)
diff --git a/config.h.in b/config.h.in
index d8ac371..52379ea 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,6 +6,9 @@
/* Define to 1 if the `closedir' function returns void instead of `int'. */
#undef CLOSEDIR_VOID
+/* cpu type arm */
+#undef CPU_arm
+
/* cpu type pa-risc */
#undef CPU_hppa
diff --git a/configure b/configure
index c8a1e1e..b37b5e2 100755
--- a/configure
+++ b/configure
@@ -18415,6 +18415,16 @@ $as_echo "#define CPU_x86_64 /**/" >>confdefs.h
$as_echo "#define ATOMIC_64BIT_OPERATIONS 1" >>confdefs.h
;;
+ aarch64-*-linux*)
+
+$as_echo "#define CPU_arm /**/" >>confdefs.h
+
+ ;;
+ arm*-linux*)
+
+$as_echo "#define CPU_arm /**/" >>confdefs.h
+
+ ;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC provided 64-bit atomic
bool cas function ..." >&5
$as_echo_n "checking for GCC provided 64-bit atomic bool cas function ...... "
>&6; }
diff --git a/configure.ac b/configure.ac
index f01a0e0..7216f88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -512,6 +512,12 @@ case $host in
AC_DEFINE([CPU_x86_64], [], [cpu type x86_64])
AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
;;
+ aarch64-*-linux*)
+ AC_DEFINE([CPU_arm], [], [cpu type arm])
+ ;;
+ arm*-linux*)
+ AC_DEFINE([CPU_arm], [], [cpu type arm])
+ ;;
esac
AC_MSG_CHECKING([for GCC provided 64-bit atomic bool cas function ...])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 32c05ec..e687802 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -707,22 +707,16 @@ slapi_ldap_init_ext(
char *pp = NULL;
if (NULL == pluginpath || (*pluginpath == '\0')) {
- slapi_log_error(SLAPI_LOG_SHELL, "slapi_ldap_init_ext",
- "configpluginpath == NULL\n");
- if (!(pluginpath = getenv("SASL_PATH"))) {
-#if defined(LINUX) && defined(__LP64__)
- pluginpath = "/usr/lib64/sasl2";
-#else
- pluginpath = "/usr/lib/sasl2";
-#endif
- }
+ slapi_log_error(SLAPI_LOG_SHELL, "slapi_ldap_init_ext",
+ "config_get_saslpath returns NULL\n");
+ pluginpath = ldaputil_get_saslpath();
}
if ('\0' == util_sasl_path[0] || /* first time */
NULL == (pp = strchr(util_sasl_path, '=')) || /* invalid arg for putenv
*/
(0 != strcmp(++pp, pluginpath)) /* sasl_path has been updated */ )
{
PR_snprintf(util_sasl_path, sizeof(util_sasl_path), "SASL_PATH=%s",
pluginpath);
- slapi_log_error(SLAPI_LOG_SHELL, "slapi_ldap_init_ext",
"putenv(%s)\n", util_sasl_path);
+ slapi_log_error(SLAPI_LOG_SHELL, "slapi_ldap_init_ext",
"putenv(%s)\n", util_sasl_path);
putenv(util_sasl_path);
}
slapi_ch_free_string(&configpluginpath);
@@ -990,6 +984,42 @@ done:
return( ld );
}
+char *
+ldaputil_get_saslpath()
+{
+ char *saslpath = getenv("SASL_PATH");
+ if (NULL == saslpath) {
+#if defined(LINUX) && defined(__LP64__)
+ saslpath = "/usr/lib64/sasl2";
+ if (PR_SUCCESS != PR_Access(saslpath, PR_ACCESS_EXISTS)) {
+#ifdef CPU_arm
+ /* the 64-bit ARMv8 architecture. */
+ saslpath = "/usr/lib/aarch64-linux-gnu";
+#else
+ /* Try x86_64 gnu triplet */
+ saslpath = "/usr/lib/x86_64-linux-gnu";
+#endif
+ }
+#else
+ saslpath = "/usr/lib/sasl2";
+ if (PR_SUCCESS != PR_Access(saslpath, PR_ACCESS_EXISTS)) {
+#ifdef CPU_arm
+ /* the latest 32 bit ARM architecture using the hard-float version of EABI.
*/
+ saslpath = "/usr/lib/arm-linux-gnueabihf";
+ if (PR_SUCCESS != PR_Access(saslpath, PR_ACCESS_EXISTS)) {
+ /* the 32 bit ARM architecture of EABI. */
+ saslpath = "/usr/lib/arm-linux-gnueabi";
+ }
+#else
+ /* Try i386 gnu triplet */
+ saslpath = "/usr/lib/i386-linux-gnu";
+#endif
+ }
+#endif
+ }
+ return saslpath;
+}
+
/*
* Function: slapi_ldap_init()
* Description: just like ldap_ssl_init() but also arranges for the LDAP
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 96b1f8c..22c0588 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -550,13 +550,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"))) {
-#if defined(LINUX) && defined(__LP64__)
- pluginpath = "/usr/lib64/sasl2";
-#else
- pluginpath = "/usr/lib/sasl2";
-#endif
- }
+ pluginpath = ldaputil_get_saslpath();
}
*path = pluginpath;
return SASL_OK;
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 2c60cc4..e71179a 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -1276,6 +1276,9 @@ void modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods
*smods);
/* add.c */
void add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e);
+/* ldaputil.c */
+char *ldaputil_get_saslpath();
+
#ifdef __cplusplus
}
#endif