From 1ade4cbc64e738f65e64c95a848f1f13f6e178fe Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 22 Oct 2014 22:21:04 +0200 Subject: [PATCH 1/5] Smack 4.0.6-SNAPSHOT --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5a6b20914..803c214ad 100644 --- a/build.gradle +++ b/build.gradle @@ -16,8 +16,8 @@ allprojects { apply plugin: 'eclipse' ext { - shortVersion = '4.0.5' - isSnapshot = false + shortVersion = '4.0.6' + isSnapshot = true gitCommit = getGitCommit() javadocAllDir = new File(buildDir, 'javadoc') documentationDir = new File(buildDir, 'documentation') From 4000adb70c19741d92e7f6df65d4115a8cbe05d4 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 10 Nov 2014 21:17:55 +0100 Subject: [PATCH 2/5] Fallback to host if DNS SRV lookup fails Also fix javadoc for DNSUtil, _jabber SRV records are no longer tried. Fixes SMACK-616. --- .../org/jivesoftware/smack/util/DNSUtil.java | 70 +++++++++---------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java index dcd2d60de..b241b7d3d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java @@ -85,24 +85,19 @@ public class DNSUtil { } /** - * Returns a list of HostAddresses under which the specified XMPP server can be - * reached at for client-to-server communication. A DNS lookup for a SRV - * record in the form "_xmpp-client._tcp.example.com" is attempted, according - * to section 14.4 of RFC 3920. If that lookup fails, a lookup in the older form - * of "_jabber._tcp.example.com" is attempted since servers that implement an - * older version of the protocol may be listed using that notation. If that - * lookup fails as well, it's assumed that the XMPP server lives at the - * host resolved by a DNS lookup at the specified domain on the default port - * of 5222.

- * + * Returns a list of HostAddresses under which the specified XMPP server can be reached at for client-to-server + * communication. A DNS lookup for a SRV record in the form "_xmpp-client._tcp.example.com" is attempted, according + * to section 3.2.1 of RFC 6120. If that lookup fails, it's assumed that the XMPP server lives at the host resolved + * by a DNS lookup at the specified domain on the default port of 5222. + *

* As an example, a lookup for "example.com" may return "im.example.com:5269". + *

* * @param domain the domain. - * @return List of HostAddress, which encompasses the hostname and port that the - * XMPP server can be reached at for the specified domain. - * @throws Exception + * @return List of HostAddress, which encompasses the hostname and port that the XMPP server can be reached at for + * the specified domain. */ - public static List resolveXMPPDomain(final String domain) throws Exception { + public static List resolveXMPPDomain(final String domain) { if (dnsResolver == null) { List addresses = new ArrayList(1); addresses.add(new HostAddress(domain, 5222)); @@ -112,24 +107,19 @@ public class DNSUtil { } /** - * Returns a list of HostAddresses under which the specified XMPP server can be - * reached at for server-to-server communication. A DNS lookup for a SRV - * record in the form "_xmpp-server._tcp.example.com" is attempted, according - * to section 14.4 of RFC 3920. If that lookup fails, a lookup in the older form - * of "_jabber._tcp.example.com" is attempted since servers that implement an - * older version of the protocol may be listed using that notation. If that - * lookup fails as well, it's assumed that the XMPP server lives at the - * host resolved by a DNS lookup at the specified domain on the default port - * of 5269.

- * + * Returns a list of HostAddresses under which the specified XMPP server can be reached at for server-to-server + * communication. A DNS lookup for a SRV record in the form "_xmpp-server._tcp.example.com" is attempted, according + * to section 3.2.1 of RFC 6120. If that lookup fails , it's assumed that the XMPP server lives at the host resolved + * by a DNS lookup at the specified domain on the default port of 5269. + *

* As an example, a lookup for "example.com" may return "im.example.com:5269". + *

* * @param domain the domain. - * @return List of HostAddress, which encompasses the hostname and port that the - * XMPP server can be reached at for the specified domain. - * @throws Exception + * @return List of HostAddress, which encompasses the hostname and port that the XMPP server can be reached at for + * the specified domain. */ - public static List resolveXMPPServerDomain(final String domain) throws Exception { + public static List resolveXMPPServerDomain(final String domain) { if (dnsResolver == null) { List addresses = new ArrayList(1); addresses.add(new HostAddress(domain, 5269)); @@ -138,7 +128,7 @@ public class DNSUtil { return resolveDomain(domain, 's'); } - private static List resolveDomain(String domain, char keyPrefix) throws Exception { + private static List resolveDomain(String domain, char keyPrefix) { List addresses = new ArrayList(); // Step one: Do SRV lookups @@ -150,15 +140,21 @@ public class DNSUtil { } else { srvDomain = domain; } - List srvRecords = dnsResolver.lookupSRVRecords(srvDomain); - if (LOGGER.isLoggable(Level.FINE)) { - String logMessage = "Resolved SRV RR for " + srvDomain + ":"; - for (SRVRecord r : srvRecords) - logMessage += " " + r; - LOGGER.fine(logMessage); + try { + List srvRecords = dnsResolver.lookupSRVRecords(srvDomain); + if (LOGGER.isLoggable(Level.FINE)) { + String logMessage = "Resolved SRV RR for " + srvDomain + ":"; + for (SRVRecord r : srvRecords) + logMessage += " " + r; + LOGGER.fine(logMessage); + } + List sortedRecords = sortSRVRecords(srvRecords); + addresses.addAll(sortedRecords); + } + catch (Exception e) { + LOGGER.log(Level.WARNING, "Exception while resovling SRV records for " + domain + + ". Consider adding '_xmpp-(server|client)._tcp' DNS SRV Records"); } - List sortedRecords = sortSRVRecords(srvRecords); - addresses.addAll(sortedRecords); // Step two: Add the hostname to the end of the list addresses.add(new HostAddress(domain)); From a8484372848231a43d75c92cc12057cde771e3f3 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 14 Nov 2014 21:02:18 +0100 Subject: [PATCH 3/5] Make digest() in EntityCapsManager synchronized Fixes SMACK-617 --- .../java/org/jivesoftware/smackx/caps/EntityCapsManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index 6bba70e3f..6af110c20 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -654,7 +654,10 @@ public class EntityCapsManager extends Manager { // encoded using Base64 as specified in Section 4 of RFC 4648 // (note: the Base64 output MUST NOT include whitespace and MUST set // padding bits to zero). - byte[] digest = md.digest(sb.toString().getBytes()); + byte[] digest; + synchronized(md) { + digest = md.digest(sb.toString().getBytes()); + } return Base64.encodeBytes(digest); } From a15245eb22b9eb3547175d906187ad3f05d62b20 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 4 Nov 2014 14:43:41 +0100 Subject: [PATCH 4/5] Add version.gradle --- build.gradle | 4 ++-- version.gradle | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 version.gradle diff --git a/build.gradle b/build.gradle index 803c214ad..f6322e86d 100644 --- a/build.gradle +++ b/build.gradle @@ -11,13 +11,13 @@ buildscript { } apply plugin: 'org.kordamp.gradle.markdown' +apply from: 'version.gradle' + allprojects { apply plugin: 'java' apply plugin: 'eclipse' ext { - shortVersion = '4.0.6' - isSnapshot = true gitCommit = getGitCommit() javadocAllDir = new File(buildDir, 'javadoc') documentationDir = new File(buildDir, 'documentation') diff --git a/version.gradle b/version.gradle new file mode 100644 index 000000000..c066ee6d2 --- /dev/null +++ b/version.gradle @@ -0,0 +1,6 @@ +allprojects { + ext { + shortVersion = '4.0.6' + isSnapshot = true + } +} From 721c3559d5ca11435146c98a52115272c1052566 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 23 Nov 2014 19:55:08 +0100 Subject: [PATCH 5/5] Smack 4.0.6 --- resources/releasedocs/changelog.html | 11 +++++++++++ version.gradle | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/releasedocs/changelog.html b/resources/releasedocs/changelog.html index e499364da..93b258e2d 100644 --- a/resources/releasedocs/changelog.html +++ b/resources/releasedocs/changelog.html @@ -141,6 +141,17 @@ hr {
+

4.0.6 -- 2014-11-23

+ +

Bug +

+
    +
  • [SMACK-616] - Smack should fallback to using host with default port if DNS SRV lookup fails +
  • +
  • [SMACK-617] - Message Digest in EntityCapsManager should be synchronized +
  • +
+

4.0.5 -- 2014-10-22

Bug diff --git a/version.gradle b/version.gradle index c066ee6d2..699d0f562 100644 --- a/version.gradle +++ b/version.gradle @@ -1,6 +1,6 @@ allprojects { ext { shortVersion = '4.0.6' - isSnapshot = true + isSnapshot = false } }