summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2010-08-12 17:51:10 -0600
committerRich Megginson <rmeggins@redhat.com>2010-08-31 13:35:54 -0600
commit17d86aef5a9a718857a03e9c8ada870fb65b84ce (patch)
tree86415ef540a30c7b22e5bc16348f16f3a340c57a /ldap/servers/slapd
parentb5431929adfc464bb4d2ad16b012e2dc5deacd7e (diff)
downloadds-17d86aef5a9a718857a03e9c8ada870fb65b84ce.tar.gz
ds-17d86aef5a9a718857a03e9c8ada870fb65b84ce.tar.xz
ds-17d86aef5a9a718857a03e9c8ada870fb65b84ce.zip
fix the url_parse logic when looking for a missing suffix DN
The logic looking for a missing suffix DN in a parsed URL was incorrect. In addition, since passthru requires a suffix DN, pass the require_dn flag.
Diffstat (limited to 'ldap/servers/slapd')
-rw-r--r--ldap/servers/slapd/ldaputil.c5
1 files changed, 4 insertions, 1 deletions
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 */