From 6439bba5cc09d6febc59bdc9e0d9bc25f1f1eb18 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Wed, 01 Sep 2010 09:04:15 +0000
Subject: [PATCH] Various improvements:

---
 sdk/src/org/opends/sdk/requests/ExternalSASLBindRequestImpl.java |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/sdk/src/org/opends/sdk/requests/ExternalSASLBindRequestImpl.java b/sdk/src/org/opends/sdk/requests/ExternalSASLBindRequestImpl.java
index 80acd82..b6afa0d 100644
--- a/sdk/src/org/opends/sdk/requests/ExternalSASLBindRequestImpl.java
+++ b/sdk/src/org/opends/sdk/requests/ExternalSASLBindRequestImpl.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2009-2010 Sun Microsystems, Inc.
  */
 
 package org.opends.sdk.requests;
@@ -102,26 +102,22 @@
     public boolean evaluateResult(final BindResult result)
         throws ErrorResultException
     {
-      if (result.getResultCode() == ResultCode.SASL_BIND_IN_PROGRESS
-          && result.getServerSASLCredentials() != null)
+      try
       {
-        try
-        {
-          setNextSASLCredentials(saslClient.evaluateChallenge(result
-              .getServerSASLCredentials().toByteArray()));
-          return false;
-        }
-        catch (final SaslException e)
-        {
-          // FIXME: I18N need to have a better error message.
-          // FIXME: Is this the best result code?
-          throw ErrorResultException.wrap(Responses.newResult(
-              ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
-              "An error occurred during multi-stage authentication")
-              .setCause(e));
-        }
+        setNextSASLCredentials(saslClient.evaluateChallenge(result
+            .getServerSASLCredentials() == null ? new byte[0] :
+            result.getServerSASLCredentials().toByteArray()));
+        return saslClient.isComplete();
       }
-      return true;
+      catch (final SaslException e)
+      {
+        // FIXME: I18N need to have a better error message.
+        // FIXME: Is this the best result code?
+        throw ErrorResultException.wrap(Responses.newResult(
+            ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
+            "An error occurred during multi-stage authentication")
+            .setCause(e));
+      }
     }
   }
 

--
Gitblit v1.10.0