diff options
-rw-r--r-- | ldap/servers/plugins/passthru/ptconfig.c | 2 | ||||
-rw-r--r-- | ldap/servers/slapd/ldaputil.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/ldap/servers/plugins/passthru/ptconfig.c b/ldap/servers/plugins/passthru/ptconfig.c index 92629d88..850bd3d9 100644 --- a/ldap/servers/plugins/passthru/ptconfig.c +++ b/ldap/servers/plugins/passthru/ptconfig.c @@ -238,7 +238,7 @@ passthru_config( int argc, char **argv ) /* * parse the LDAP URL */ - if (( rc = slapi_ldap_url_parse( srvr->ptsrvr_url, &ludp, 0, &secure )) != 0 ) { + if (( rc = slapi_ldap_url_parse( srvr->ptsrvr_url, &ludp, 1, &secure )) != 0 ) { slapi_log_error( SLAPI_LOG_FATAL, PASSTHRU_PLUGIN_SUBSYSTEM, "unable to parse LDAP URL \"%s\" (%s)\n", srvr->ptsrvr_url, slapi_urlparse_err2string( rc )); diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c index 97162874..837f23eb 100644 --- a/ldap/servers/slapd/ldaputil.c +++ b/ldap/servers/slapd/ldaputil.c @@ -155,13 +155,16 @@ slapi_ldap_url_parse(const char *url, LDAPURLDesc **ludpp, int require_dn, int * rc = ldap_url_parse_ext(url, ludpp, require_dn ? LDAP_PVT_URL_PARSE_NONE : LDAP_PVT_URL_PARSE_NOEMPTY_DN); #else rc = ldap_url_parse(url, ludpp); - if (rc || !*ludpp || !require_dn) { /* failed - see if failure was due to missing dn */ + if ((rc || !*ludpp) && !require_dn) { /* failed - see if failure was due to missing dn */ size_t len = strlen(url); /* assume the url is just scheme://host:port[/] - add the empty string as the DN (adding a trailing / first if needed) and try to parse again */ char *urlcopy = slapi_ch_smprintf("%s%s%s", url, (url[len-1] == '/' ? "" : "/"), ""); + if (*ludpp) { + ldap_free_urldesc(*ludpp); /* free the old one, if any */ + } rc = ldap_url_parse(urlcopy, ludpp); slapi_ch_free_string(&urlcopy); if (0 == rc) { /* only problem was the DN - free it */ |