[guardian-dev] [PATCH 1/2] Add patch to fix SASL DIGEST-MD5 authentication.

Adrian-Ken Rueegsegger ken at codelabs.ch
Mon Mar 14 07:36:26 EDT 2011


Do not add padding when converting an empty response to XML string.

Some servers (e.g. jabberd2) cannot cope with empty responses containing
padding from the client to finalize DIGEST-MD5 authentication. Send a
completely empty response instead.
---
 patch/50-SASL-No-padding-on-empty-response.patch |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 patch/50-SASL-No-padding-on-empty-response.patch

diff --git a/patch/50-SASL-No-padding-on-empty-response.patch b/patch/50-SASL-No-padding-on-empty-response.patch
new file mode 100644
index 0000000..b30aa6b
--- /dev/null
+++ b/patch/50-SASL-No-padding-on-empty-response.patch
@@ -0,0 +1,16 @@
+--- org.orig//jivesoftware/smack/sasl/SASLMechanism.java	2011-03-14 11:46:56.426503835 +0100
++++ org/jivesoftware/smack/sasl/SASLMechanism.java	2011-03-14 11:57:05.898706360 +0100
+@@ -260,12 +260,9 @@
+         public String toXML() {
+             StringBuilder stanza = new StringBuilder();
+             stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
+-            if (authenticationText != null) {
++            if (authenticationText != null && authenticationText.trim().length() > 0) {
+                 stanza.append(authenticationText);
+             }
+-            else {
+-                stanza.append("=");
+-            }
+             stanza.append("</response>");
+             return stanza.toString();
+         }
-- 
1.7.2.3



More information about the Guardian-dev mailing list