From commits-return-35939-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Sat Feb 2 10:07:39 2013 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30707E69C for ; Sat, 2 Feb 2013 10:07:39 +0000 (UTC) Received: (qmail 36932 invoked by uid 500); 2 Feb 2013 10:07:39 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 36822 invoked by uid 500); 2 Feb 2013 10:07:36 -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 36793 invoked by uid 99); 2 Feb 2013 10:07:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2013 10:07:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Sat, 02 Feb 2013 10:07:32 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4C6AB2388A29; Sat, 2 Feb 2013 10:07:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1441721 - /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java Date: Sat, 02 Feb 2013 10:07:12 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130202100712.4C6AB2388A29@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Sat Feb 2 10:07:11 2013 New Revision: 1441721 URL: http://svn.apache.org/viewvc?rev=1441721&view=rev Log: Added two tests to check that the rootDSE can be accessed by an anonymous user, even if the ACI subsystem is activated Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java?rev=1441721&r1=1441720&r2=1441721&view=diff ============================================================================== --- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java (original) +++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/getRootDse/GetRootDseIT.java Sat Feb 2 10:07:11 2013 @@ -27,6 +27,8 @@ import static org.junit.Assert.assertTru import org.apache.directory.api.ldap.model.entry.Entry; import org.apache.directory.ldap.client.api.LdapConnection; +import org.apache.directory.server.core.api.DirectoryService; +import org.apache.directory.server.core.api.LdapCoreSessionConnection; import org.apache.directory.server.core.integ.AbstractLdapTestUnit; import org.apache.directory.server.core.integ.FrameworkRunner; import org.apache.directory.server.core.integ.IntegrationUtils; @@ -62,7 +64,7 @@ public class GetRootDseIT extends Abstra public void testGetRootDse() throws Exception { Entry rootDse = connection.getRootDse(); - + assertNotNull( rootDse ); assertEquals( 1, rootDse.size() ); @@ -98,7 +100,7 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "+" ); assertNotNull( rootDse ); - + assertEquals( 9, rootDse.size() ); assertTrue( rootDse.containsAttribute( "entryUUID" ) ); assertTrue( rootDse.containsAttribute( "namingContexts" ) ); @@ -123,7 +125,7 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "objectClass", "vendorName", "vendorVersion" ); assertNotNull( rootDse ); - + assertEquals( 3, rootDse.size() ); assertTrue( rootDse.containsAttribute( "objectClass" ) ); assertTrue( rootDse.containsAttribute( "vendorName" ) ); @@ -143,7 +145,7 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "*", "vendorName", "vendorVersion" ); assertNotNull( rootDse ); - + assertEquals( 3, rootDse.size() ); assertTrue( rootDse.containsAttribute( "objectClass" ) ); assertTrue( rootDse.containsAttribute( "vendorName" ) ); @@ -163,7 +165,7 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "+", "Objectclass" ); assertNotNull( rootDse ); - + assertEquals( 10, rootDse.size() ); assertTrue( rootDse.containsAttribute( "objectClass" ) ); assertTrue( rootDse.containsAttribute( "entryUUID" ) ); @@ -190,7 +192,7 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "+", "*" ); assertNotNull( rootDse ); - + assertEquals( 10, rootDse.size() ); assertTrue( rootDse.containsAttribute( "objectClass" ) ); assertTrue( rootDse.containsAttribute( "entryUUID" ) ); @@ -216,7 +218,7 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "1.1" ); assertNotNull( rootDse ); - + assertEquals( 0, rootDse.size() ); } @@ -232,8 +234,44 @@ public class GetRootDseIT extends Abstra Entry rootDse = connection.getRootDse( "1.1", "objectClass" ); assertNotNull( rootDse ); - + assertEquals( 1, rootDse.size() ); assertTrue( rootDse.containsAttribute( "objectClass" ) ); } + + + /** + * Check that we cannot access the RootDSE with an anonymous user and default access control + * @throws Exception + */ + @Test + public void testGetRootDSEAnonymousNoAccessControl() throws Exception + { + DirectoryService service = getService(); + service.setAccessControlEnabled( false ); + LdapCoreSessionConnection connection = new LdapCoreSessionConnection( service ); + connection.bind( "", "" ); + + Entry rootDse = connection.getRootDse(); + + assertNotNull( rootDse ); + } + + + /** + * Check that we can access the RootDSE with an anonymous user and access control set (but no ACI) + * @throws Exception + */ + @Test + public void testGetRootDSEAnonymousWithAccessControl() throws Exception + { + DirectoryService service = getService(); + service.setAccessControlEnabled( true ); + LdapCoreSessionConnection connection = new LdapCoreSessionConnection( service ); + connection.bind( "", "" ); + + Entry rootDse = connection.getRootDse(); + + assertNotNull( rootDse ); + } }