Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 52136 invoked from network); 18 Oct 2010 22:18:56 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Oct 2010 22:18:56 -0000 Received: (qmail 37708 invoked by uid 500); 18 Oct 2010 22:18:56 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 37663 invoked by uid 500); 18 Oct 2010 22:18:56 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 37656 invoked by uid 99); 18 Oct 2010 22:18:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 22:18:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 22:18:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EA4F0238897A; Mon, 18 Oct 2010 22:17:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: kayyagari@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101018221756.EA4F0238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); + } + } }