directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r432440 - in /directory/branches/apacheds/1.0: protocol-ldap/src/main/java/org/apache/directory/server/ldap/ server-unit/src/test/java/org/apache/directory/server/
Date Fri, 18 Aug 2006 00:12:47 GMT
Author: akarasulu
Date: Thu Aug 17 17:12:46 2006
New Revision: 432440

URL: http://svn.apache.org/viewvc?rev=432440&view=rev
Log:
Fix for DIRSERVER-609: Compare operations are performed without Authentication

Modified:
    directory/branches/apacheds/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java
    directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
    directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/MiscTest.java

Modified: directory/branches/apacheds/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java?rev=432440&r1=432439&r2=432440&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java
(original)
+++ directory/branches/apacheds/1.0/protocol-ldap/src/main/java/org/apache/directory/server/ldap/SessionRegistry.java
Thu Aug 17 17:12:46 2006
@@ -88,7 +88,7 @@
      *
      * @param env the properties associated with this SessionRegistry
      */
-    SessionRegistry(Hashtable env)
+    SessionRegistry( Hashtable env )
     {
         if ( s_singleton == null )
         {
@@ -266,7 +266,9 @@
         if ( ctx == null && allowAnonymous )
         {
             // if configuration says disable anonymous binds we throw exection
-            if ( env.containsKey( "server.disable.anonymous" ) )
+            StartupConfiguration config = ( StartupConfiguration ) Configuration.toConfiguration(
env );
+            
+            if ( ! config.isAllowAnonymousAccess() )
             {
                 throw new LdapNoPermissionException( "Anonymous binds have been disabled!"
);
             }

Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java?rev=432440&r1=432439&r2=432440&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
(original)
+++ directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddITest.java
Thu Aug 17 17:12:46 2006
@@ -211,7 +211,6 @@
      */
     public void testAddEntryWithTwoDescriptions() throws LDAPException
     {
-
         LDAPConnection con = new LDAPConnection();
         con.connect( 3, HOST, super.port, USER, PASSWORD );
         LDAPAttributeSet attrs = new LDAPAttributeSet();

Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/MiscTest.java?rev=432440&r1=432439&r2=432440&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
(original)
+++ directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
Thu Aug 17 17:12:46 2006
@@ -17,6 +17,10 @@
 package org.apache.directory.server;
 
 
+import netscape.ldap.LDAPAttribute;
+import netscape.ldap.LDAPConnection;
+import netscape.ldap.LDAPException;
+
 import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.asn1.util.Asn1StringUtils;
@@ -60,7 +64,8 @@
      */
     public void setUp() throws Exception
     {
-        if ( this.getName().equals( "testDisableAnonymousBinds" ) )
+        if ( this.getName().equals( "testDisableAnonymousBinds" ) ||
+             this.getName().equals( "testCompareWithoutAuthentication" ) )
         {
             configuration.setAllowAnonymousAccess( false );
         }
@@ -111,6 +116,23 @@
     }
 
 
+    public void testCompareWithoutAuthentication() throws LDAPException
+    {
+        LDAPConnection conn = new LDAPConnection();
+        conn.connect( "localhost", super.port );
+        LDAPAttribute attr = new LDAPAttribute( "uid", "admin" );
+        try
+        {
+            conn.compare( "uid=admin,ou=system", attr );
+            fail( "Compare success without authentication" );
+        }
+        catch( LDAPException e )
+        {
+            assertEquals( "no permission exception", 50, e.getLDAPResultCode() );
+        }
+    }
+    
+    
     /**
      * Test to make sure anonymous binds are disabled when going through
      * the wire protocol.



Mime
View raw message