[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 18:31:28 CET 2006


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

Hi,

Hm my patch wasn't ok, an updated is attached. The previous patch had
the wrong configuration file location. And used the wrong callback
function to set the configuration path. (My first testing did go ok, but
I didn't remove the /usr/lib/sasl2/slapd.conf and then the
authentication succeeded)

Updated version attached.

Regards,

Matthijs Mohlmann

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

iD8DBQFFevLw2n1ROIkXqbARAuDfAKCoUofnJWgwv2IdQcn/2xmNEEXYdQCeLC3t
U1QpR3nkZINtjCPu+3nY1eo=
=gr/L
-----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 "sasl2"
+
 #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_getconfpath( 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_GETCONFPATH, &slap_sasl_getconfpath, NULL },
 		{ SASL_CB_LIST_END, NULL, NULL }
 	};
 


More information about the Pkg-openldap-devel mailing list