powered by Jive Software

[patch] SASL authentication fails will NPE

Dear Smack Devs,

when trying to authenticate to my ejabberd I constantly received an NPE. This is because evaluateChallenge may return null according to its definition, and it does in my case. (This actually means no message would need to be sent, but it is easier to just send an empty message).

The following patch fixes it. Since it is trivial, fell free to to whatever with it (but please include it in smack, properly formatted ).


`Index: source/org/jivesoftware/smack/sasl/SASLMechanism.java

— source/org/jivesoftware/smack/sasl/SASLMechanism.java (Revision 11097)
+++ source/org/jivesoftware/smack/sasl/SASLMechanism.java (Arbeitskopie)
@@ -149,6 +149,7 @@
response = sc.evaluateChallenge(null);

+if (response==null) response=new byte[0];
String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
if(authenticationText.equals("")) {
authenticationText = “=”;