Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 75180 invoked from network); 26 Oct 2005 21:29:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Oct 2005 21:29:33 -0000 Received: (qmail 47819 invoked by uid 500); 26 Oct 2005 21:29:32 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 47764 invoked by uid 500); 26 Oct 2005 21:29:32 -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 47753 invoked by uid 99); 26 Oct 2005 21:29:32 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2005 14:29:32 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 26 Oct 2005 14:29:30 -0700 Received: (qmail 75007 invoked by uid 65534); 26 Oct 2005 21:29:11 -0000 Message-ID: <20051026212911.75006.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r328742 - /directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java Date: Wed, 26 Oct 2005 21:29:11 -0000 To: commits@directory.apache.org From: szoerner@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: szoerner Date: Wed Oct 26 14:29:07 2005 New Revision: 328742 URL: http://svn.apache.org/viewcvs?rev=328742&view=rev Log: Added a new test method testAnonymousBindsEnabledBaseSearch in order to cover a problem which is described in DIREVE-283. It is commented out because it currently fails. Modified: directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java Modified: directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java?rev=328742&r1=328741&r2=328742&view=diff ============================================================================== --- directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java (original) +++ directory/apacheds/trunk/main/src/test/org/apache/ldap/server/MiscTest.java Wed Oct 26 14:29:07 2005 @@ -79,7 +79,29 @@ partition.setIndexedAttributes( Collections.singleton( "dc" ) ); partitions.add( partition ); configuration.setContextPartitionConfigurations( partitions ); + } + else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) ) + { + // allow anonymous access + configuration.setAllowAnonymousAccess( true ); + + // create a partition to search + Set partitions = new HashSet(); + partitions.addAll( configuration.getContextPartitionConfigurations() ); + MutableDirectoryPartitionConfiguration partition = new MutableDirectoryPartitionConfiguration(); + partition.setSuffix( "dc=apache,dc=org" ); + Attributes entry = new BasicAttributes( "dc", "apache", true ); + Attribute oc = new BasicAttribute( "objectClass" ); + entry.put( oc ); + oc.add( "top" ); + oc.add( "domain" ); + partition.setName( "apache" ); + partition.setContextEntry( entry ); + partition.setIndexedAttributes( Collections.singleton( "dc" ) ); + partitions.add( partition ); + configuration.setContextPartitionConfigurations( partitions ); } + super.setUp(); } @@ -159,6 +181,39 @@ assertEquals( "", result.getName().trim() ); } + /** + * Test to make sure that if anonymous binds are allowed a user may search + * within a a partition. + * + * @throws Exception if anything goes wrong + */ + /* + public void testAnonymousBindsEnabledBaseSearch() throws Exception + { + // Use the SUN JNDI provider to hit server port and bind as anonymous + + final Hashtable env = new Hashtable(); + + env.put( Context.PROVIDER_URL, "ldap://localhost:" + port + "/" ); + env.put( Context.SECURITY_AUTHENTICATION, "none" ); + env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" ); + + InitialDirContext ctx = new InitialDirContext( env ); + SearchControls cons = new SearchControls(); + cons.setSearchScope( SearchControls.OBJECT_SCOPE ); + NamingEnumeration list = ctx.search( "dc=apache,dc=org", "(objectClass=*)", cons ); + SearchResult result = null; + if ( list.hasMore() ) + { + result = ( SearchResult ) list.next(); + } + assertFalse( list.hasMore() ); + list.close(); + + assertNotNull( result ); + assertNotNull( result.getAttributes().get("dc") ); + } + */ /** * Reproduces the problem with