diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2009-03-09 16:35:35 +0000 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2009-03-09 16:35:35 +0000 |
commit | 029a16b1d3afdede02bad11569ebcdfbbbe471c3 (patch) | |
tree | 8bbe470f34f61f28c1e53c16f38ad8702854da03 /ldap/servers/slapd | |
parent | 38b7743d68154b040d79b023a2e354a0a725a648 (diff) | |
download | ds-029a16b1d3afdede02bad11569ebcdfbbbe471c3.tar.gz ds-029a16b1d3afdede02bad11569ebcdfbbbe471c3.tar.xz ds-029a16b1d3afdede02bad11569ebcdfbbbe471c3.zip |
Resolves: #488856
Summary: slapi_ldap_init_ext needs to be modified due to the build failure on Solaris
Description: instead of replacing client_callbacks, set sasl path to SASL_PATH
using putenv.
Diffstat (limited to 'ldap/servers/slapd')
-rw-r--r-- | ldap/servers/slapd/util.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c index 0088af40..4fcae3ba 100644 --- a/ldap/servers/slapd/util.c +++ b/ldap/servers/slapd/util.c @@ -916,23 +916,6 @@ static int slapd_sasl_getpluginpath(sasl_conn_t *conn, const char **path) return SASL_OK; } -/* copied from mozldap libldap/saslbind.c - except - SASL_CB_GETPATH added as last item (before SASL_CB_LIST_END - This allows us to set the sasl path used for outgoing - client connections */ -sasl_callback_t slapd_client_callbacks[] = { - { SASL_CB_GETOPT, slapd_sasl_fail, NULL }, - { SASL_CB_GETREALM, NULL, NULL }, - { SASL_CB_USER, NULL, NULL }, - { SASL_CB_CANON_USER, NULL, NULL }, - { SASL_CB_AUTHNAME, NULL, NULL }, - { SASL_CB_PASS, NULL, NULL }, - { SASL_CB_ECHOPROMPT, NULL, NULL }, - { SASL_CB_NOECHOPROMPT, NULL, NULL }, - { SASL_CB_GETPATH, slapd_sasl_getpluginpath, NULL }, - { SASL_CB_LIST_END, NULL, NULL } -}; - /* Perform LDAP init and return an LDAP* handle. If ldapurl is given, that is used as the basis for the protocol, host, port, and whether @@ -947,6 +930,10 @@ sasl_callback_t slapd_client_callbacks[] = { filename is the ldapi file name - if this is given, and no other options are given, ldapi is assumed. */ +/* util_sasl_path: the string argument for putenv. + It must be a global or a static */ +char util_sasl_path[MAXPATHLEN]; + LDAP * slapi_ldap_init_ext( const char *ldapurl, /* full ldap url */ @@ -962,16 +949,36 @@ slapi_ldap_init_ext( LDAPURLDesc *ludp = NULL; LDAP *ld = NULL; int rc = 0; - extern sasl_callback_t *client_callbacks; /* We need to provide a sasl path used for client connections, especially if the server is not set up to be a sasl server - since mozldap provides - no way to override the default path programatically, we replace its - client callback list with our own so that we can provide a CB_GETPATH - callback */ - if (client_callbacks != slapd_client_callbacks) { - client_callbacks = slapd_client_callbacks; + no way to override the default path programatically, we set the sasl + path to the environment variable SASL_PATH. */ + char *configpluginpath = config_get_saslpath(); + char *pluginpath = configpluginpath; + char *pp = NULL; + + if (NULL == pluginpath || (*pluginpath == '\0')) { + slapi_log_error(SLAPI_LOG_FATAL, "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 + } + } + 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_FATAL, "slapi_ldap_init_ext", + "putenv(%s)\n", util_sasl_path); + putenv(util_sasl_path); } + slapi_ch_free_string(&configpluginpath); /* if ldapurl is given, parse it */ if (ldapurl && ((rc = ldap_url_parse_no_defaults(ldapurl, &ludp, 0)) || |