From bdc61a2db2cc91ddca24503372942d8f83645568 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Thu, 10 May 2007 21:45:26 +0000 Subject: [PATCH] Use the FQDN for SASL auth -- fixes GSSAPI (SMACK-224). git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@8272 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/SASLAuthentication.java | 6 ++++-- source/org/jivesoftware/smack/sasl/SASLMechanism.java | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/org/jivesoftware/smack/SASLAuthentication.java b/source/org/jivesoftware/smack/SASLAuthentication.java index 2f6304ae4..45eedd8cf 100644 --- a/source/org/jivesoftware/smack/SASLAuthentication.java +++ b/source/org/jivesoftware/smack/SASLAuthentication.java @@ -188,8 +188,10 @@ public class SASLAuthentication implements UserAuthentication { Constructor constructor = selected .getConstructor(new Class[]{SASLAuthentication.class}); currentMechanism = (SASLMechanism) constructor.newInstance(new Object[]{this}); - // Trigger SASL authentication with the selected mechanism - currentMechanism.authenticate(username, connection.getServiceName(), password); + // Trigger SASL authentication with the selected mechanism. We use + // connection.getHost() since GSAPI requires the FQDN of the server, which + // may not match the XMPP domain. + currentMechanism.authenticate(username, connection.getHost(), password); // Wait until SASL negotiation finishes synchronized (this) { diff --git a/source/org/jivesoftware/smack/sasl/SASLMechanism.java b/source/org/jivesoftware/smack/sasl/SASLMechanism.java index d6a70a0a0..adf7e7a06 100644 --- a/source/org/jivesoftware/smack/sasl/SASLMechanism.java +++ b/source/org/jivesoftware/smack/sasl/SASLMechanism.java @@ -73,6 +73,7 @@ public abstract class SASLMechanism { * response to the server's challenge. * * @param challenge a base64 encoded string representing the challenge. + * @throws IOException if an exception sending the response occurs. */ public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text