[Pkg-openldap-devel] Bug#398657: slapd's sasl looks in /usr/lib/sasl2/slapd.conf for its configuration

Matthijs Mohlmann matthijs at cacholong.nl
Sat Dec 9 16:25:57 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tag 398657 + patch
thanks

Here a patch which adds a callback for the sasl context to get the path
of the sasl configuration file. It also looks in the old path
(/usr/lib/sasl2)

I think applying this for Etch doesn't harm.

See for more information:
http://www.openldap.org/lists/openldap-bugs/200309/msg00071.html

Regards,

Matthijs Mohlmann

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFetWF2n1ROIkXqbARAvFjAJ9tQzd9QZA4l6nrqserpMzuzCWKawCgmsiJ
e0eJkh9RyI9gw6JoQFM4kRw=
=gm3R
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: include/ldap_defaults.h
===================================================================
--- include/ldap_defaults.h.orig
+++ include/ldap_defaults.h
@@ -65,4 +65,6 @@
 	/* dn of the default "monitor" subentry */
 #define SLAPD_MONITOR_DN		"cn=Monitor"
 
+#define SASL_CONFIGPATH                        LDAP_SYSCONFDIR LDAP_DIRSEP "sasl"
+
 #endif /* _LDAP_CONFIG_H */
Index: servers/slapd/sasl.c
===================================================================
--- servers/slapd/sasl.c.orig
+++ servers/slapd/sasl.c
@@ -951,12 +951,38 @@
 
 #endif /* HAVE_CYRUS_SASL */
 
+static int
+slap_sasl_getpath( void * context, char ** path )
+{
+	char * sasl_default_configpath;
+	size_t len;
+
+#if SASL_VERSION_MAJOR >= 2
+	sasl_default_configpath = "/usr/lib/sasl2";
+#else
+	sasl_default_configpath = "/usr/lib/sasl";
+#endif
+
+	len = strlen(SASL_CONFIGPATH) + 1 /* colon */ +
+		strlen(sasl_default_configpath) + 1 /* \0 */;
+	*path = malloc( len );
+	if ( *path == NULL )
+		return SASL_FAIL;
+
+	if (snprintf( *path, len, "%s:%s", SASL_CONFIGPATH,
+				sasl_default_configpath ) != len-1 )
+		return SASL_FAIL;
+
+	return SASL_OK;
+}
+
 int slap_sasl_init( void )
 {
 #ifdef HAVE_CYRUS_SASL
 	int rc;
 	static sasl_callback_t server_callbacks[] = {
 		{ SASL_CB_LOG, &slap_sasl_log, NULL },
+		{ SASL_CB_GETPATH, &slap_sasl_getpath, NULL },
 		{ SASL_CB_LIST_END, NULL, NULL }
 	};
 


More information about the Pkg-openldap-devel mailing list