directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1024045 - in /directory/apacheds/trunk: ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
Date Mon, 18 Oct 2010 22:17:56 GMT
Author: kayyagari
Date: Mon Oct 18 22:17:56 2010
New Revision: 1024045

URL: http://svn.apache.org/viewvc?rev=1024045&view=rev
Log:
o applied patch provided by Victor Antonovich for DIRSERVER-1548
o added a test case to check the intended behaviour of the bind handler

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=1024045&r1=1024044&r2=1024045&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Mon Oct 18 22:17:56 2010
@@ -448,4 +448,26 @@ public class SimpleBindRequestTest exten
         assertEquals( 2, bindResponse.getMessageId() );
         assertTrue( connection.isAuthenticated() );
     }
+    
+    
+    /**
+     * DIRSERVER-1548
+     */
+    @Test
+    public void testSimpleBindInvalidFwdByValidOnSameCon() throws Exception
+    {
+        connection.setTimeOut( Integer.MAX_VALUE );
+        BindResponse response = connection.bind( "uid=admin,ou=system", "wrongpwd" );
+        LdapResult ldapResult = response.getLdapResult();
+        assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, ldapResult.getResultCode() );
+        assertEquals( 1, response.getMessageId() );
+        assertFalse( connection.isAuthenticated() );
+        
+        response = connection.bind( "uid=admin,ou=system", "secret" );
+        ldapResult = response.getLdapResult();
+        assertEquals( ResultCodeEnum.SUCCESS, ldapResult.getResultCode() );
+        assertEquals( 2, response.getMessageId() );
+        assertTrue( connection.isAuthenticated() );
+    }
+
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=1024045&r1=1024044&r2=1024045&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
Mon Oct 18 22:17:56 2010
@@ -241,6 +241,14 @@ public class BindHandler extends LdapReq
             bindRequest.getResultResponse().addAllControls( bindContext.getResponseControls()
);
             ldapSession.getIoSession().write( bindRequest.getResultResponse() );
         }
+        finally
+        {
+            // Reset LDAP session bind status to anonymous if authentication failed
+            if ( !ldapSession.isAuthenticated() )
+            {
+                ldapSession.setAnonymous();
+            }
+        }
     }
 
 



Mime
View raw message