You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/08/06 04:36:27 UTC

svn commit: r683088 - /directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewBindHandler.java

Author: akarasulu
Date: Tue Aug  5 19:36:27 2008
New Revision: 683088

URL: http://svn.apache.org/viewvc?rev=683088&view=rev
Log:
fixed bind bug after referral handling introduction

Modified:
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewBindHandler.java

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewBindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewBindHandler.java?rev=683088&r1=683087&r2=683088&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewBindHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewBindHandler.java Tue Aug  5 19:36:27 2008
@@ -23,6 +23,7 @@
 import java.util.Map;
 
 import javax.naming.Name;
+import javax.naming.NameNotFoundException;
 import javax.security.auth.Subject;
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
@@ -137,15 +138,24 @@
              * detect conditions where ancestors of the DN are referrals
              * and delegate appropriately.
              */
-            ClonedServerEntry principalEntry = getLdapServer().getDirectoryService()
-                .getAdminSession().lookup( bindRequest.getName() );
+            ClonedServerEntry principalEntry = null;
+            
+            try
+            {
+                principalEntry = getLdapServer().getDirectoryService()
+                    .getAdminSession().lookup( bindRequest.getName() );
+            }
+            catch ( NameNotFoundException e ) 
+            {
+                // this is OK
+            }
+
             if ( principalEntry == null || 
                  principalEntry.getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT, 
                      SchemaConstants.REFERRAL_OC ) )
             {
                 LdapResult result = bindRequest.getResultResponse().getLdapResult();
                 result.setErrorMessage( "Bind principalDn points to referral." );
-                result.setMatchedDn( bindRequest.getName() );
                 result.setResultCode( ResultCodeEnum.INVALID_CREDENTIALS );
                 ldapSession.getIoSession().write( bindRequest.getResultResponse() );
                 return;