diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2011-05-27 11:44:16 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-10-26 10:29:37 -0400 |
commit | d0b2e0675ea5c65854e81deca14469cb89e57be8 (patch) | |
tree | ce82dff4a961b752be5b319c9358bdff9e2e8f1b /src/util | |
parent | b24fa6e0a359fbdf5d3900016a205cbf4d9d84d9 (diff) | |
download | sssd-d0b2e0675ea5c65854e81deca14469cb89e57be8.tar.gz sssd-d0b2e0675ea5c65854e81deca14469cb89e57be8.tar.xz sssd-d0b2e0675ea5c65854e81deca14469cb89e57be8.zip |
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.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/sss_ldap.c | 8 | ||||
-rw-r--r-- | src/util/sss_ldap.h | 4 |
2 files changed, 12 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>. */ #include <stdlib.h> +#include <netdb.h> #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); +} diff --git a/src/util/sss_ldap.h b/src/util/sss_ldap.h index 14747dffc..619bde641 100644 --- a/src/util/sss_ldap.h +++ b/src/util/sss_ldap.h @@ -22,9 +22,13 @@ #define __SSS_LDAP_H__ #include <ldap.h> +#include <talloc.h> int sss_ldap_control_create(const char *oid, int iscritical, struct berval *value, int dupval, LDAPControl **ctrlp); +inline const char * +sss_ldap_escape_ip_address(TALLOC_CTX *mem_ctx, int family, const char *addr); + #endif /* __SSS_LDAP_H__ */ |