Browse Source

[172824] Link SASL library dynamically
i1) For non-RHEL platforms, package cyrus sasl library and the supported plugins.
2) by default, cyrus sasl expects to see the plugins in /usr/lib/sasl2.
Instead, tell sasl to search "../../../lib/sasl2" (relative path from ns-slapd)
for the plugins.

Noriko Hosoi 20 years ago
parent
commit
473436cc27
2 changed files with 33 additions and 1 deletions
  1. 8 0
      ldap/cm/Makefile
  2. 25 1
      ldap/servers/slapd/saslbind.c

+ 8 - 0
ldap/cm/Makefile

@@ -423,6 +423,14 @@ endif
 endif
 endif
 
+# if not Linux, we need package sasl library and supported plugins
+ifneq ($(ARCH), Linux)
+	$(INSTALL) -m 755 $(SASL_LIBPATH)/*.$(DLL_SUFFIX)* $(RELDIR)/lib
+	-mkdir $(RELDIR)/lib/sasl2
+	$(INSTALL) -m 755 $(SASL_LIBPATH)/sasl2/libdigestmd5.$(DLL_SUFFIX)* $(RELDIR)/lib/sasl2
+	$(INSTALL) -m 755 $(SASL_LIBPATH)/sasl2/libgssapiv2.$(DLL_SUFFIX)* $(RELDIR)/lib/sasl2
+endif
+
 # the plugin API
 	$(INSTALL) -m 644 $(BUILD_DRIVE)$(BUILD_ROOT)/ldap/servers/slapd/slapi-plugin.h $(RELDIR)/plugins/slapd/slapi/include
 	$(INSTALL) -m 644 $(NSPR_INCDIR)/*.h $(RELDIR)/plugins/slapd/slapi/include

+ 25 - 1
ldap/servers/slapd/saslbind.c

@@ -551,7 +551,18 @@ static int ids_sasl_canon_user(
     return returnvalue;
 }
 
-static sasl_callback_t ids_sasl_callbacks[5] =
+#ifdef CYRUS_SASL
+#if !defined(LINUX)
+static int ids_sasl_getpluginpath(sasl_conn_t *conn, const char **path)
+{
+    static char *pluginpath = "../../../lib/sasl2";
+    *path = pluginpath;
+    return SASL_OK;
+}
+#endif
+#endif
+
+static sasl_callback_t ids_sasl_callbacks[] =
 {
     {
       SASL_CB_GETOPT,
@@ -577,6 +588,19 @@ static sasl_callback_t ids_sasl_callbacks[5] =
       (IFP) ids_sasl_canon_user,
       NULL
     },
+#ifdef CYRUS_SASL
+    /* On Linux: we use system sasl and plugins are found in the default path
+     * /usr/lib/sasl2
+     * On other platforms: we need to tell cyrus sasl where they are localted.
+     */
+#if !defined(LINUX)
+    {
+      SASL_CB_GETPATH,
+      (IFP) ids_sasl_getpluginpath,
+      NULL
+    },
+#endif
+#endif
     {
       SASL_CB_LIST_END,
       (IFP) NULL,