directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-server] branch master updated: o Fixed some wrong call to Value.getStringh() when the AT is binary o Removed useless Value creations o Removed unused variables declarations o Fixed typoes
Date Sat, 11 May 2019 07:18:45 GMT
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git


The following commit(s) were added to refs/heads/master by this push:
     new d13e45f  o Fixed some wrong call to Value.getStringh() when the AT is binary o Removed
useless  Value creations o Removed unused variables declarations o Fixed typoes
d13e45f is described below

commit d13e45fee5265b7e67ea58ff030c4002a44f6742
Author: emmanuel lecharny <elecharny@apache.org>
AuthorDate: Sat May 11 09:18:41 2019 +0200

    o Fixed some wrong call to Value.getStringh() when the AT is binary
    o Removed useless  Value creations
    o Removed unused variables declarations
    o Fixed typoes
---
 .../server/core/api/event/LeafEvaluator.java       | 75 +---------------------
 .../core/kerberos/KeyDerivationInterceptor.java    |  2 +-
 .../OperationalAttributeInterceptor.java           |  2 +-
 .../xdbm/search/evaluator/LessEqEvaluator.java     |  4 +-
 4 files changed, 4 insertions(+), 79 deletions(-)

diff --git a/core-api/src/main/java/org/apache/directory/server/core/api/event/LeafEvaluator.java
b/core-api/src/main/java/org/apache/directory/server/core/api/event/LeafEvaluator.java
index d724d94..fb6ca24 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/api/event/LeafEvaluator.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/api/event/LeafEvaluator.java
@@ -20,14 +20,11 @@
 package org.apache.directory.server.core.api.event;
 
 
-import java.util.Comparator;
-
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidSearchFilterException;
-import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException;
 import org.apache.directory.api.ldap.model.filter.ApproximateNode;
 import org.apache.directory.api.ldap.model.filter.EqualityNode;
 import org.apache.directory.api.ldap.model.filter.ExprNode;
@@ -40,9 +37,7 @@ import org.apache.directory.api.ldap.model.filter.SimpleNode;
 import org.apache.directory.api.ldap.model.filter.SubstringNode;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
-import org.apache.directory.api.ldap.model.schema.LdapComparator;
 import org.apache.directory.api.ldap.model.schema.MatchingRule;
-import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.util.exception.NotImplementedException;
 import org.apache.directory.server.i18n.I18n;
 
@@ -153,8 +148,6 @@ public class LeafEvaluator implements Evaluator
     private boolean evalGreaterOrLesser( SimpleNode<?> node, Entry entry, boolean isGreaterOrLesser
)
         throws LdapException
     {
-        AttributeType attributeType = node.getAttributeType();
-
         // get the attribute associated with the node
         Attribute attr = entry.get( node.getAttribute() );
 
@@ -168,7 +161,6 @@ public class LeafEvaluator implements Evaluator
          * We need to iterate through all values and for each value we normalize
          * and use the comparator to determine if a match exists.
          */
-        Normalizer normalizer = getNormalizer( attributeType );
         Value filterValue = node.getValue();
 
         /*
@@ -233,9 +225,6 @@ public class LeafEvaluator implements Evaluator
      */
     private boolean evalEquality( EqualityNode<?> node, Entry entry ) throws LdapException
     {
-        Normalizer normalizer = getNormalizer( node.getAttributeType() );
-        Comparator comparator = getComparator( node.getAttributeType() );
-
         // get the attribute associated with the node
         Attribute attr = entry.get( node.getAttribute() );
 
@@ -246,29 +235,7 @@ public class LeafEvaluator implements Evaluator
         }
 
         // check if Ava value exists in attribute
-        AttributeType attributeType = node.getAttributeType();
-        Value value = null;
-
-        if ( attributeType.getSyntax().isHumanReadable() )
-        {
-            if ( node.getValue().isHumanReadable() )
-            {
-                value = node.getValue();
-            }
-            else
-            {
-                value = new Value( attributeType, node.getValue().getString() );
-            }
-        }
-        else
-        {
-            value = node.getValue();
-        }
-
-        if ( attr.contains( value ) )
-        {
-            return true;
-        }
+        Value value = node.getValue();
 
         // check if the normalized value is present
         if ( attr.contains( value ) )
@@ -295,46 +262,6 @@ public class LeafEvaluator implements Evaluator
 
 
     /**
-     * Gets the comparator for equality matching.
-     *
-     * @param attributeType the attributeType
-     * @return the comparator for equality matching
-     * @throws LdapException if there is a failure
-     */
-    private LdapComparator<? super Object> getComparator( AttributeType attributeType
) throws LdapException
-    {
-        MatchingRule mrule = getMatchingRule( attributeType, EQUALITY_MATCH );
-
-        if ( mrule == null )
-        {
-            throw new LdapUnwillingToPerformException( "No EQUALITY MatchingRule for the
'" + attributeType + "' attributeType" );
-        }
-
-        return mrule.getLdapComparator();
-    }
-
-
-    /**
-     * Gets the normalizer for equality matching.
-     *
-     * @param attributeType the attributeType
-     * @return the normalizer for equality matching
-     * @throws LdapException if there is a failure
-     */
-    private Normalizer getNormalizer( AttributeType attributeType ) throws LdapException
-    {
-        MatchingRule mrule = getMatchingRule( attributeType, EQUALITY_MATCH );
-
-        if ( mrule == null )
-        {
-            throw new LdapUnwillingToPerformException( "No EQUALITY MatchingRule for the
'" + attributeType + "' attributeType" );
-        }
-        
-        return mrule.getNormalizer();
-    }
-
-
-    /**
      * Gets the matching rule for an attributeType.
      *
      * @param attributeType the attributeType
diff --git a/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
b/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
index 38b651c..eaa77db 100644
--- a/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
+++ b/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
@@ -143,7 +143,7 @@ public class KeyDerivationInterceptor extends BaseInterceptor
 
             // Get the entry's password. We will use the first one.
             Value userPassword = entry.get( userPasswordAT ).get();
-            String strUserPassword = userPassword.getString();
+            String strUserPassword = Strings.utf8ToString( userPassword.getBytes() );
 
             String principalName = entry.get( krb5PrincipalNameAT ).getString();
 
diff --git a/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
b/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
index 44d0304..034eb72 100644
--- a/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
+++ b/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
@@ -613,7 +613,7 @@ public class OperationalAttributeInterceptor extends BaseInterceptor
      * short name for an attributeType definition.
      * 
      * @param dn the normalized distinguished name
-     * @return the distinuished name denormalized
+     * @return the distinguished name denormalized
      * @throws Exception if there are problems denormalizing
      */
     private Dn denormalizeTypes( Dn dn ) throws LdapException
diff --git a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java
b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java
index 7b43655..352f8e9 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/LessEqEvaluator.java
@@ -29,7 +29,6 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapOtherException;
 import org.apache.directory.api.ldap.model.filter.LessEqNode;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
-import org.apache.directory.api.ldap.model.schema.LdapComparator;
 import org.apache.directory.api.ldap.model.schema.MatchingRule;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.server.core.api.partition.PartitionTxn;
@@ -219,7 +218,6 @@ public class LessEqEvaluator<T> extends LeafEvaluator<T>
     // wrapper or the raw normalized value
     private boolean evaluate( IndexEntry<Object, String> indexEntry, Attribute attribute
)
     {
-        LdapComparator ldapComparator = attribute.getAttributeType().getOrdering().getLdapComparator();
         /*
          * Cycle through the attribute values testing normalized version
          * obtained from using the ordering or equality matching rule's
@@ -228,7 +226,7 @@ public class LessEqEvaluator<T> extends LeafEvaluator<T>
          */
         for ( Value value : attribute )
         {
-            if ( ldapComparator.compare( value.getString(), node.getValue().getString() )
<= 0 )
+            if ( ldapComparator.compare( value.getNormalized(), node.getValue().getNormalized()
) <= 0 )
             {
                 if ( indexEntry != null )
                 {


Mime
View raw message