diff options
-rw-r--r-- | src/providers/ipa/ipa_common.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/ldap_common.c | 39 |
2 files changed, 3 insertions, 38 deletions
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c index 89a8751b..9972c341 100644 --- a/src/providers/ipa/ipa_common.c +++ b/src/providers/ipa/ipa_common.c @@ -643,7 +643,7 @@ static void ipa_resolve_callback(void *private_data, struct fo_server *server) return; } - new_uri = talloc_asprintf(service, "ldap://%s", safe_address); + new_uri = talloc_asprintf(service, "ldap://%s", fo_get_server_name(server)); if (!new_uri) { DEBUG(2, ("Failed to copy URI ...\n")); talloc_free(tmp_ctx); diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index 997e027c..2ffa878d 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -534,13 +534,9 @@ static void sdap_uri_callback(void *private_data, struct fo_server *server) TALLOC_CTX *tmp_ctx = NULL; struct sdap_service *service; struct resolv_hostent *srvaddr; - char *address; - const char *safe_address; struct sockaddr_storage *sockaddr; const char *tmp; char *new_uri; - LDAPURLDesc *lud; - int ret; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -564,13 +560,6 @@ static void sdap_uri_callback(void *private_data, struct fo_server *server) return; } - address = resolv_get_string_address(tmp_ctx, srvaddr); - if (address == NULL) { - DEBUG(1, ("resolv_get_string_address failed.\n")); - talloc_free(tmp_ctx); - return; - } - sockaddr = resolv_get_sockaddr_address(tmp_ctx, srvaddr, fo_get_server_port(server)); if (sockaddr == NULL) { @@ -579,40 +568,16 @@ static void sdap_uri_callback(void *private_data, struct fo_server *server) return; } - safe_address = sss_ldap_escape_ip_address(tmp_ctx, - srvaddr->family, - address); - talloc_zfree(address); - if (safe_address == NULL) { - DEBUG(1, ("sss_ldap_escape_ip_address failed.\n")); - talloc_free(tmp_ctx); - return; - } - if (fo_is_srv_lookup(server)) { if (!tmp) { DEBUG(1, ("Unknown service, using ldap\n")); tmp = SSS_LDAP_SRV_NAME; } new_uri = talloc_asprintf(service, "%s://%s:%d", - tmp, safe_address, + tmp, fo_get_server_name(server), fo_get_server_port(server)); } else { - if (tmp && ldap_is_ldap_url(tmp)) { - ret = ldap_url_parse(tmp, &lud); - if (ret != LDAP_SUCCESS) { - DEBUG(0, ("Failed to parse ldap URI (%s)!\n", tmp)); - talloc_free(tmp_ctx); - return; - } - new_uri = talloc_asprintf(service, "%s://%s:%d", - lud->lud_scheme, - safe_address, - fo_get_server_port(server)); - ldap_free_urldesc(lud); - } else { - new_uri = talloc_asprintf(service, "ldap://%s", safe_address); - } + new_uri = talloc_strdup(service, tmp); } if (!new_uri) { |