From: Debian OpenLDAP Maintainers Date: Sat, 24 Sep 2022 19:40:21 +0000 (+0100) Subject: sasl-default-path X-Git-Tag: archive/raspbian/2.5.13+dfsg-3+rpi1~1^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bf3f4e2df92e6971dc4698277e5f90a860e328de;p=openldap.git sasl-default-path Add /etc/ldap/sasl2 to the SASL configuration search path. Not submitted upstream. Somewhat Debian-specific and probably not of interest upstream. Gbp-Pq: Name sasl-default-path --- diff --git a/include/ldap_defaults.h b/include/ldap_defaults.h index 3822c548..51182af4 100644 --- a/include/ldap_defaults.h +++ b/include/ldap_defaults.h @@ -68,4 +68,6 @@ */ #define LLOADD_DEFAULT_CONFIGFILE LDAP_SYSCONFDIR LDAP_DIRSEP "lloadd.conf" +#define SASL_CONFIGPATH LDAP_SYSCONFDIR LDAP_DIRSEP "sasl2" + #endif /* _LDAP_CONFIG_H */ diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 1e173045..20e2d03e 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -1231,12 +1231,38 @@ static const rewrite_mapper slapd_mapper = { slapd_rw_destroy }; +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_cb_ft)&slap_sasl_log, NULL }, + { SASL_CB_GETCONFPATH, (slap_sasl_cb_ft)&slap_sasl_getconfpath, NULL }, { SASL_CB_GETOPT, (slap_sasl_cb_ft)&slap_sasl_getopt, NULL }, { SASL_CB_LIST_END, NULL, NULL } };