From d0b2e0675ea5c65854e81deca14469cb89e57be8 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 27 May 2011 11:44:16 +0200 Subject: Properly support IPv6 in LDAP URIs for IPA and LDAP providers Add utility function to return IP address as string Add a utility function to escape IPv6 address for use in URIs Use escaped IP addresses in LDAP provider Escape IPv6 IP addresses in the IPA provider https://fedorahosted.org/sssd/ticket/880 Fix bad merge We merged in a patch, but missed that it missed a dependency added by another earlier patch. --- src/util/sss_ldap.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/util/sss_ldap.c') diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c index f098e7d6d..94a10386d 100644 --- a/src/util/sss_ldap.c +++ b/src/util/sss_ldap.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include +#include #include "config.h" @@ -68,3 +69,10 @@ int sss_ldap_control_create(const char *oid, int iscritical, return LDAP_SUCCESS; #endif } + +inline const char * +sss_ldap_escape_ip_address(TALLOC_CTX *mem_ctx, int family, const char *addr) +{ + return family == AF_INET6 ? talloc_asprintf(mem_ctx, "[%s]", addr) : + talloc_strdup(mem_ctx, addr); +} -- cgit