From 154b0f8185c1979578cc5c62e5e51b4574bec88f Mon Sep 17 00:00:00 2001 From: Matthew Harmsen Date: Aug 10 2016 00:05:26 +0000 Subject: Resolves: rhbz #1353564 - Bugzilla Bug #1353564 - ldapjdk needs to support IPv6 (mreynolds) --- diff --git a/ldap-gjdoc.patch b/ldap-gjdoc.patch deleted file mode 100644 index 9a44ac7..0000000 --- a/ldap-gjdoc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- mozilla/directory/java-sdk/ldap.mk 2005-11-04 23:44:56.000000000 -0500 -+++ mozilla/directory/java-sdk/ldap.mk.new 2005-11-04 23:45:29.000000000 -0500 -@@ -158,7 +158,7 @@ - endif - - ifndef JAVADOC -- JAVADOC=$(JDKBIN)javadoc -classpath "$(JAVACLASSPATH)$(SEP)$(BASEDIR)/ldapbeans" -+ JAVADOC=$(JDKBIN)javadoc -classpath "$(JAVACLASSPATH)$(SEP)$(BASEDIR)/ldapbeans" -sourcepath ldapjdk:ldapbeans:ldapfilter - endif - - # Destination for class files and packages diff --git a/ldapjdk-support-IPv6.patch b/ldapjdk-support-IPv6.patch new file mode 100644 index 0000000..a62090f --- /dev/null +++ b/ldapjdk-support-IPv6.patch @@ -0,0 +1,157 @@ +diff -r 0f7c3698a961 java-sdk/ldapjdk/netscape/ldap/LDAPConnection.java +--- a/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPConnection.java Fri Feb 27 03:58:00 2015 -0500 ++++ b/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPConnection.java Mon Aug 08 12:01:38 2016 -0400 +@@ -879,12 +879,14 @@ + * @param host host name of the LDAP server to which you want to connect. + * This value can also be a space-delimited list of hostnames or + * hostnames and port numbers (using the syntax +- * hostname:portnumber). For example, you can specify +- * the following values for the host argument:
++ * hostname:portnumber). For IPv6 enclose the address in square brackets. ++ * For example, you can specify the following values for the ++ * host argument:
+ *
+      *   myhost
+      *   myhost hishost:389 herhost:5000 whathost
+      *   myhost:686 myhost:389 hishost:5000 whathost:1024
++     *   [::1]:389 [2620:52:0:102f:5054:1ff:fe2c:e12d]:636
+      *
+ * If multiple servers are specified in the host list, the connection + * setup policy specified with the ConnSetupDelay property controls +@@ -934,13 +936,32 @@ + int i = 0; + while( st.hasMoreTokens() ) { + String s = st.nextToken(); +- int colon = s.indexOf( ':' ); +- if ( colon > 0 ) { +- hostList[i] = s.substring( 0, colon ); +- portList[i] = Integer.parseInt( s.substring( colon+1 ) ); ++ int colon; ++ ++ if ( s.startsWith( "[" ) ) { ++ // We have an ipv6 address ++ int end = s.indexOf( ']' ); ++ if ( end == -1 ) { ++ throw new LDAPException ( "invalid URL for IPv6 address", ++ LDAPException.PARAM_ERROR ); ++ } ++ String remainder = s.substring( end+1 ); ++ hostList[i] = s.substring( 0, end+1 ); ++ colon = remainder.indexOf( ':' ); ++ if ( colon >= 0 ){ ++ portList[i] = Integer.parseInt( remainder.substring( colon+1 ) ); ++ } else { ++ portList[i] = defaultPort; ++ } + } else { +- hostList[i] = s; +- portList[i] = defaultPort; ++ colon = s.indexOf( ':' ); ++ if ( colon > 0 ) { ++ hostList[i] = s.substring( 0, colon ); ++ portList[i] = Integer.parseInt( s.substring( colon+1 ) ); ++ } else { ++ hostList[i] = s; ++ portList[i] = defaultPort; ++ } + } + i++; + } +diff -r 0f7c3698a961 java-sdk/ldapjdk/netscape/ldap/LDAPUrl.java +--- a/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPUrl.java Fri Feb 27 03:58:00 2015 -0500 ++++ b/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPUrl.java Mon Aug 08 12:01:38 2016 -0400 +@@ -135,9 +135,11 @@ + * (ldaps) is also supported. + */ + private void parseUrl(String url) throws MalformedURLException { +- StringTokenizer urlParser = new StringTokenizer (url, ":/?", true); ++ StringTokenizer urlParser = new StringTokenizer (url, ":/?[]", true); ++ StringTokenizer markParser = new StringTokenizer (url, ":/?[]", true); + String currentToken; + String str = null; ++ boolean usingIPv6 = false; + + try { + currentToken = urlParser.nextToken(); +@@ -160,8 +162,10 @@ + if (!currentToken.equals("/")) { + throw new MalformedURLException (); + } +- + currentToken = urlParser.nextToken(); ++ if (currentToken.equals("[")) { ++ usingIPv6 = true; ++ } + } + catch (NoSuchElementException e) { + throw new MalformedURLException (); +@@ -176,36 +180,48 @@ + throw new MalformedURLException ("No hostname"); + } else if (currentToken.equals ("?")) { + throw new MalformedURLException ("No host[:port]"); ++ } else if (usingIPv6){ ++ StringBuilder sb = new StringBuilder(); ++ while (urlParser.hasMoreElements()) { ++ currentToken = urlParser.nextToken(); ++ if (currentToken.equals("]")) { ++ break; ++ } ++ sb.append(currentToken); ++ } ++ m_hostName = sb.toString(); + } else { + m_hostName = currentToken; ++ } ++ ++ // Set the port ++ if (urlParser.countTokens() == 0) { ++ m_portNumber = m_secure ? DEFAULT_SECURE_PORT : LDAPv2.DEFAULT_PORT; ++ return; ++ } ++ currentToken = urlParser.nextToken (); // either ":" or "/" ++ ++ if (currentToken.equals (":")) { ++ try { ++ m_portNumber = Integer.parseInt (urlParser.nextToken()); ++ } catch (NumberFormatException nf) { ++ throw new MalformedURLException ("Port not a number"); ++ } catch (NoSuchElementException ex) { ++ throw new MalformedURLException ("No port number"); ++ } ++ + if (urlParser.countTokens() == 0) { +- m_portNumber = m_secure ? DEFAULT_SECURE_PORT : LDAPv2.DEFAULT_PORT; + return; + } +- currentToken = urlParser.nextToken (); // either ":" or "/" +- +- if (currentToken.equals (":")) { +- try { +- m_portNumber = Integer.parseInt (urlParser.nextToken()); +- } catch (NumberFormatException nf) { +- throw new MalformedURLException ("Port not a number"); +- } catch (NoSuchElementException ex) { +- throw new MalformedURLException ("No port number"); +- } +- +- if (urlParser.countTokens() == 0) { +- return; +- } +- else if (! urlParser.nextToken().equals("/")) { +- throw new MalformedURLException (); +- } +- +- } else if (currentToken.equals ("/")) { +- m_portNumber = m_secure ? DEFAULT_SECURE_PORT : LDAPv2.DEFAULT_PORT; +- } else { +- // expecting ":" or "/" ++ else if (! urlParser.nextToken().equals("/")) { + throw new MalformedURLException (); + } ++ ++ } else if (currentToken.equals ("/")) { ++ m_portNumber = m_secure ? DEFAULT_SECURE_PORT : LDAPv2.DEFAULT_PORT; ++ } else { ++ // expecting ":" or "/" ++ throw new MalformedURLException (); + } diff --git a/ldapjdk.spec b/ldapjdk.spec index 87c78cc..2244eae 100644 --- a/ldapjdk.spec +++ b/ldapjdk.spec @@ -4,7 +4,7 @@ Name: ldapjdk Version: 4.18 -Release: 18%{?dist} +Release: 19%{?dist} Epoch: 0 Summary: The Mozilla LDAP Java SDK License: MPLv1.1 or GPLv2+ or LGPLv2+ @@ -19,10 +19,12 @@ Source: http://pki.fedoraproject.org/pki/sources/%{name}/%{name}-%{version}.tar Source1: http://pki.fedoraproject.org/pki/sources/%{name}/%{name}-%{version}.pom Patch0: %{name}-jarnamefix.patch Patch1: matching-rule-parsing-640750.patch +Patch2: %{name}-support-IPv6.patch Requires: jpackage-utils >= 0:1.5 Requires: jss BuildRequires: ant +BuildRequires: java-devel BuildRequires: jpackage-utils >= 0:1.5 BuildRequires: jss @@ -48,6 +50,7 @@ rm -f ./mozilla/directory/java-sdk/ldapjdk/lib/{jss32_stub,jsse,jnet,jaas,jndi}. %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build # cleanup CVS dirs @@ -94,6 +97,9 @@ cp -r mozilla/directory/java-sdk/dist/doc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name %{_javadocdir}/%{name}/* %changelog +* Tue Aug 9 2016 Matthew Harmsen 0:4.18-19 +- Resolves: rhbz #1353564 - ldapjdk needs to support IPv6 (mreynolds) + * Thu Feb 04 2016 Fedora Release Engineering - 0:4.18-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/ldapsp-gjdoc.patch b/ldapsp-gjdoc.patch deleted file mode 100644 index 3e51a73..0000000 --- a/ldapsp-gjdoc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- mozilla/directory/java-sdk/ldapsp.mk 2005-11-04 23:45:01.000000000 -0500 -+++ mozilla/directory/java-sdk/ldapsp.mk.new 2005-11-04 23:45:35.000000000 -0500 -@@ -92,7 +92,7 @@ - endif - - ifndef JAVADOC -- JAVADOC=$(JDKBIN)javadoc -classpath "$(JAVACLASSPATH)" -+ JAVADOC=$(JDKBIN)javadoc -classpath "$(JAVACLASSPATH)" -sourcepath ldapsp - endif - - all: classes