directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r413442 - in /directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core: authz/AuthorizationService.java authz/DefaultAuthorizationService.java subtree/SubentryService.java
Date Sun, 11 Jun 2006 13:23:25 GMT
Author: akarasulu
Date: Sun Jun 11 06:23:25 2006
New Revision: 413442

URL: http://svn.apache.org/viewvc?rev=413442&view=rev
Log:
checkpointing partial work on authz normalization fixes

Modified:
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java?rev=413442&r1=413441&r2=413442&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
Sun Jun 11 06:23:25 2006
@@ -183,7 +183,9 @@
         // stuff for dealing with subentries (garbage for now)
         String subschemaSubentry = ( String ) factoryCfg.getPartitionNexus().getRootDSE().get(
"subschemaSubentry" )
             .get();
-        subschemaSubentryDn = new LdapDN( subschemaSubentry ).toString().toLowerCase();
+        LdapDN subschemaSubentryDnName = new LdapDN( subschemaSubentry );
+        subschemaSubentryDnName.normalize();
+        subschemaSubentryDn = subschemaSubentryDnName.toNormName();
     }
 
 
@@ -923,12 +925,15 @@
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
         LdapPrincipal user = ctx.getPrincipal();
+        LdapDN principalDn = new LdapDN( user.getName() );
+        principalDn.normalize();
+        
         NamingEnumeration e = next.search( base, env, filter, searchCtls );
 
-        boolean isSubschemaSubentryLookup = subschemaSubentryDn.equals( base.toString() );
+        boolean isSubschemaSubentryLookup = subschemaSubentryDn.equals( base.toNormName()
);
         boolean isRootDSELookup = base.size() == 0 && searchCtls.getSearchScope()
== SearchControls.OBJECT_SCOPE;
-        if ( user.getName().equalsIgnoreCase( DirectoryPartitionNexus.ADMIN_PRINCIPAL_NORMALIZED
) || !enabled || isRootDSELookup
-            || isSubschemaSubentryLookup )
+        if ( principalDn.toNormName().equals( DirectoryPartitionNexus.ADMIN_PRINCIPAL_NORMALIZED
) || !enabled || 
+            isRootDSELookup || isSubschemaSubentryLookup )
         {
             return e;
         }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java?rev=413442&r1=413441&r2=413442&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
Sun Jun 11 06:23:25 2006
@@ -197,19 +197,20 @@
     }
 
 
-    private void protectModifyAlterations( Name dn ) throws LdapNoPermissionException
+    private void protectModifyAlterations( LdapDN dn ) throws NamingException
     {
-        Name principalDn = getPrincipal().getJndiName();
+        LdapDN principalDn = new LdapDN( getPrincipal().getJndiName() );
+        principalDn.normalize();
 
-        if ( dn.toString().equals( "" ) )
+        if ( dn.size() == 0 )
         {
             String msg = "The rootDSE cannot be modified!";
             throw new LdapNoPermissionException( msg );
         }
 
-        if ( !principalDn.equals( ADMIN_DN ) )
+        if ( !principalDn.toNormName().equals( DirectoryPartitionNexus.ADMIN_PRINCIPAL_NORMALIZED
) )
         {
-            if ( dn.equals( DirectoryPartitionNexus.ADMIN_PRINCIPAL ) )
+            if ( dn.toNormName().equals( DirectoryPartitionNexus.ADMIN_PRINCIPAL_NORMALIZED
) )
             {
                 String msg = "User " + principalDn;
                 msg += " does not have permission to modify the account of the";

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=413442&r1=413441&r2=413442&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
Sun Jun 11 06:23:25 2006
@@ -272,7 +272,7 @@
             LdapDN subentryDn = new LdapDN( subentryDnStr );
             LdapDN apDn = ( LdapDN ) subentryDn.clone();
             apDn.remove( apDn.size() - 1 );
-            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDn );
+            SubtreeSpecification ss = ( SubtreeSpecification ) subtrees.get( subentryDnStr
);
 
             if ( evaluator.evaluate( ss, apDn, dn, objectClasses ) )
             {



Mime
View raw message