From bb921063e0fb3bb0d64b5994ff390370efa57db9 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 8 Mar 2012 19:35:44 -0800 Subject: [PATCH] ITS#7194 fix IPv6 URL detection --- libraries/libldap/tls_g.c | 8 ++------ libraries/libldap/tls_m.c | 8 ++------ libraries/libldap/tls_o.c | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/libraries/libldap/tls_g.c b/libraries/libldap/tls_g.c index e39c2815ac..7a3deb08c0 100644 --- a/libraries/libldap/tls_g.c +++ b/libraries/libldap/tls_g.c @@ -651,12 +651,8 @@ tlsg_session_chkhost( LDAP *ld, tls_session *session, const char *name_in ) } #ifdef LDAP_PF_INET6 - if (name[0] == '[' && strchr(name, ']')) { - char *n2 = ldap_strdup(name+1); - *strchr(n2, ']') = 0; - if (inet_pton(AF_INET6, n2, &addr)) - ntype = IS_IP6; - LDAP_FREE(n2); + if (inet_pton(AF_INET6, name, &addr)) { + ntype = IS_IP6; } else #endif if ((ptr = strrchr(name, '.')) && isdigit((unsigned char)ptr[1])) { diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c index 092b59f925..50c03dd6ea 100644 --- a/libraries/libldap/tls_m.c +++ b/libraries/libldap/tls_m.c @@ -2694,12 +2694,8 @@ tlsm_session_chkhost( LDAP *ld, tls_session *session, const char *name_in ) } #ifdef LDAP_PF_INET6 - if (name[0] == '[' && strchr(name, ']')) { - char *n2 = ldap_strdup(name+1); - *strchr(n2, ']') = 0; - if (inet_pton(AF_INET6, n2, &addr)) - ntype = IS_IP6; - LDAP_FREE(n2); + if (inet_pton(AF_INET6, name, &addr)) { + ntype = IS_IP6; } else #endif if ((ptr = strrchr(name, '.')) && isdigit((unsigned char)ptr[1])) { diff --git a/libraries/libldap/tls_o.c b/libraries/libldap/tls_o.c index 183410a4b4..338e527969 100644 --- a/libraries/libldap/tls_o.c +++ b/libraries/libldap/tls_o.c @@ -501,12 +501,8 @@ tlso_session_chkhost( LDAP *ld, tls_session *sess, const char *name_in ) } #ifdef LDAP_PF_INET6 - if (name[0] == '[' && strchr(name, ']')) { - char *n2 = ldap_strdup(name+1); - *strchr(n2, ']') = 0; - if (inet_pton(AF_INET6, n2, &addr)) - ntype = IS_IP6; - LDAP_FREE(n2); + if (inet_pton(AF_INET6, name, &addr)) { + ntype = IS_IP6; } else #endif if ((ptr = strrchr(name, '.')) && isdigit((unsigned char)ptr[1])) { -- 2.39.5