You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2024/08/21 15:31:45 UTC

(directory-server) branch master updated: Partial fix to DIRSERVER_1728: interceptor-referral

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 0e730170fe Partial fix to DIRSERVER_1728: interceptor-referral
     new 8b78726806 Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server
0e730170fe is described below

commit 0e730170fe55302facc6e982b13329f0c2463ba9
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Wed Aug 21 14:59:40 2024 +0200

    Partial fix to DIRSERVER_1728: interceptor-referral
---
 .../org/apache/directory/server/i18n/I18n.java     | 23 +++++++++++---------
 .../apache/directory/server/i18n/errors.properties | 25 +++++++++++-----------
 .../core/normalization/ExpandingVisitor.java       |  4 ++--
 .../OperationalAttributeInterceptor.java           | 10 ++++-----
 .../server/core/referral/ReferralInterceptor.java  | 14 ++++++------
 5 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java b/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
index f34c4345db..09098ea214 100644
--- a/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
+++ b/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
@@ -343,14 +343,27 @@ public enum I18n
     // No error
 
     // apacheds-interceptors-normalization errors    23000 - 23999
+    ERR_23000_FAILED_TO_EXPAND_NODE("ERR_23000_FAILED_TO_EXPAND_NODE"),
+    
     // apacheds-interceptors-number errors           24000 - 24999
     // No error
 
     // apacheds-interceptors-operational errors      25000 - 25999
+    ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE("ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE"),
+    ERR_25001_CANNOT_MODIFY__MODIFIERS_NAME("ERR_25001_CANNOT_MODIFY__MODIFIERS_NAME"),
+    
     // apacheds-interceptors-ppolicy errors          26000 - 26999
     // No error
 
     // apacheds-interceptors-referral errors         27000 - 27999
+    ERR_27000_LDAPURL_CONTAINS_SCOPE("ERR_27000_LDAPURL_CONTAINS_SCOPE"),
+    ERR_27001_LDAPURL_CONTAINS_FILTERS("ERR_27001_LDAPURL_CONTAINS_FILTERS"),
+    ERR_27002_LDAPURL_CONTAINS_DESCRIPTION_ATTRIBUTE_LIST("ERR_27002_LDAPURL_CONTAINS_DESCRIPTION_ATTRIBUTE_LIST"),
+    ERR_27003_LDAPURL_CONTAINS_EXTENSION("ERR_27003_LDAPURL_CONTAINS_EXTENSION"),
+    ERR_27004_LDAPURL_CONTAINS_CRITICL_EXTENSION("ERR_27004_LDAPURL_CONTAINS_CRITICL_EXTENSION"),
+    ERR_27005_LDAPURL_DOES_NOT_CONTAIN_NON_EMPTY_DN("ERR_27005_LDAPURL_DOES_NOT_CONTAIN_NON_EMPTY_DN"),
+    ERR_27006_REFERAL_ENTRY_WITHOUT_REF_ATTRIBUTE("ERR_27006_REFERAL_ENTRY_WITHOUT_REF_ATTRIBUTE"),
+
     // apacheds-interceptors-schema errors           28000 - 28999
     ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY("ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY"),
 
@@ -518,16 +531,7 @@ public enum I18n
 
     ERR_1("ERR_1"),
     ERR_7("ERR_7"),
-    ERR_30("ERR_30"),
-    ERR_31("ERR_31"),
     ERR_32("ERR_32"),
-    ERR_36("ERR_36"),
-    ERR_37("ERR_37"),
-    ERR_38("ERR_38"),
-    ERR_39("ERR_39"),
-    ERR_40("ERR_40"),
-    ERR_41("ERR_41"),
-    ERR_42("ERR_42"),
     ERR_43("ERR_43"),
     ERR_44("ERR_44"),
     ERR_47("ERR_47"),
@@ -626,7 +630,6 @@ public enum I18n
     ERR_249("ERR_249"),
     ERR_254_ADD_EXISTING_VALUE("ERR_254_ADD_EXISTING_VALUE"),
     ERR_259("ERR_259"),
-    ERR_261("ERR_261"),
     ERR_262("ERR_262"),
     ERR_269("ERR_269"),
     ERR_270("ERR_270"),
diff --git a/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties b/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
index 9c1a0e17a4..dd2af03bb5 100644
--- a/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
+++ b/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
@@ -306,13 +306,11 @@ ERR_16002_CHANGLE_LOG_STORE_CANNOT_BE_SEARCHED=The underlying changelog store do
 ERR_16003_REVISION_TOO_HIGH=revision must be less than or equal to the current revision
 ERR_16004_FILE_CANNOT_BE_DELETED=Can''t delete file {0}
 
-
 # apacheds-interceptors-collective errors       17000 - 17999
 ERR_17000_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY=Collective attributes cannot be stored in non-collectiveAttributeSubentries
 ERR_17001_CANNOT_OPERATE_ON_COLLECTIVE_ATTRIBUTE=Cannot operate on collective attributes in non-collectiveAttributeSubentries
 ERR_17002_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT=A CollectiveAttribute Subentry must have at least one collective Attribute
 
-
 # apacheds-interceptors-event errors            18000 - 18999
 # --- no error ---
 
@@ -333,14 +331,27 @@ ERR_19004_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_MOVE=Can not allow the move of the sub
 # --- no error ---
 
 # apacheds-interceptors-normalization errors    23000 - 23999
+ERR_23000_FAILED_TO_EXPAND_NODE=Failed to expand node
+
 # apacheds-interceptors-number errors           24000 - 24999
 # --- no error ---
 
 # apacheds-interceptors-operational errors      25000 - 25999
+ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE=The {0} operational attribute cannot be modified by a user
+ERR_25001_CANNOT_MODIFY__MODIFIERS_NAME=The ModifiersName operational attribute cannot be modified by a user
+
 # apacheds-interceptors-ppolicy errors          26000 - 26999
 # --- no error ---
 
 # apacheds-interceptors-referral errors         27000 - 27999
+ERR_27000_LDAPURL_CONTAINS_SCOPE=An LDAPURL should not contains a scope
+ERR_27001_LDAPURL_CONTAINS_FILTERS=An LDAPURL should not contains filters
+ERR_27002_LDAPURL_CONTAINS_DESCRIPTION_ATTRIBUTE_LIST=An LDAPURL should not contains any description attribute list
+ERR_27003_LDAPURL_CONTAINS_EXTENSION=An LDAPURL should not contains any extension
+ERR_27004_LDAPURL_CONTAINS_CRITICL_EXTENSION=An LDAPURL should not contains any critical extension
+ERR_27005_LDAPURL_DOES_NOT_CONTAIN_NON_EMPTY_DN=An LDAPURL should contains a non-empty DN
+ERR_27006_REFERAL_ENTRY_WITHOUT_REF_ATTRIBUTE=An entry with a ''referral'' ObjectClass must contains a ''ref'' Attribute
+
 # apacheds-interceptors-schema errors           28000 - 28999
 ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY={0} not found within the attributeType registry
 
@@ -508,16 +519,7 @@ ERR_49045_SCOPE_NODE_NOT_IN_SUBTREE_SCOPE=ScopeNode is not of subtree scope.
 
 ERR_1=Failed to identify OID for: {0}
 ERR_7=Cannot create a digested password for algorithm ''{0}''
-ERR_30=The {0} operational attribute cannot be modified by a user
-ERR_31=The ModifiersName operational attribute cannot be modified by a user
 ERR_32=The ModifyTimestamp operational attribute cannot be modified by a user
-ERR_36=An LDAPURL should not contains a scope
-ERR_37=An LDAPURL should not contains filters
-ERR_38=An LDAPURL should not contains any description attribute list
-ERR_39=An LDAPURL should not contains any extension
-ERR_40=An LDAPURL should not contains any critical extension
-ERR_41=An LDAPURL should contains a non-empty DN
-ERR_42=An entry with a ''referral'' ObjectClass must contains a ''ref'' Attribute
 ERR_43=The id {0} does not have any OID. It should be a wrong AttributeType.
 ERR_44=Wrong AttributeType, does not have an associated OID : {0}
 # ERR_45=
@@ -641,7 +643,6 @@ ERR_226=[33] aliasProblem - the alias when dereferenced would not name a known o
 ERR_249=The global schema subentry cannot be added since it exists by default.
 ERR_254_ADD_EXISTING_VALUE=Trying to add existing value ''{0}'' to attribute {1}
 ERR_259=Attempt to search under non-existant entry\:  
-ERR_261=Failed to expand node
 ERR_262=System partition has wrong name: should be ''system'' not ''{0}''.
 ERR_269=userRoot() in org.apache.directory.server.prefs.ServerPreferencesFactory not implemented!
 ERR_270=Failed to set up node.
diff --git a/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java b/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
index ad29e95fd4..8170f00831 100644
--- a/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
+++ b/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
@@ -187,8 +187,8 @@ public class ExpandingVisitor implements FilterVisitor
                 }
                 catch ( LdapException e )
                 {
-                    // log something here and throw a runtime excpetion
-                    throw new RuntimeException( I18n.err( I18n.ERR_261 ) );
+                    // log something here and throw a runtime exception
+                    throw new RuntimeException( I18n.err( I18n.ERR_23000_FAILED_TO_EXPAND_NODE ) );
                 }
             }
             else
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 aa89d08c3b..f10bcf3265 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
@@ -247,7 +247,7 @@ public class OperationalAttributeInterceptor extends BaseInterceptor
             if ( !isAdmin )
             {
                 // Wrong !
-                String message = I18n.err( I18n.ERR_30, attribute );
+                String message = I18n.err( I18n.ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE, attribute );
                 LOG.error( message );
                 throw new LdapNoPermissionException( message );
             }
@@ -383,7 +383,7 @@ public class OperationalAttributeInterceptor extends BaseInterceptor
             {
                 if ( !isAdmin )
                 {
-                    String message = I18n.err( I18n.ERR_31 );
+                    String message = I18n.err( I18n.ERR_25001_CANNOT_MODIFY__MODIFIERS_NAME );
                     LOG.error( message );
                     throw new LdapNoPermissionException( message );
                 }
@@ -397,7 +397,7 @@ public class OperationalAttributeInterceptor extends BaseInterceptor
             {
                 if ( !isAdmin )
                 {
-                    String message = I18n.err( I18n.ERR_30, attributeType );
+                    String message = I18n.err( I18n.ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE, attributeType );
                     LOG.error( message );
                     throw new LdapNoPermissionException( message );
                 }
@@ -411,7 +411,7 @@ public class OperationalAttributeInterceptor extends BaseInterceptor
             {
                 if ( !isAdmin )
                 {
-                    String message = I18n.err( I18n.ERR_30, attributeType );
+                    String message = I18n.err( I18n.ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE, attributeType );
                     LOG.error( message );
                     throw new LdapNoPermissionException( message );
                 }
@@ -423,7 +423,7 @@ public class OperationalAttributeInterceptor extends BaseInterceptor
 
             if ( PWD_POLICY_STATE_ATTRIBUTE_TYPES.contains( attributeType ) && !isAdmin )
             {
-                String message = I18n.err( I18n.ERR_30, attributeType );
+                String message = I18n.err( I18n.ERR_25000_CANNOT_MODIFY_OPERATIONAL_ATTRIBUTE, attributeType );
                 LOG.error( message );
                 throw new LdapNoPermissionException( message );
             }
diff --git a/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java b/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
index 8b23ee7a27..c1b8da416a 100644
--- a/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
+++ b/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
@@ -98,35 +98,35 @@ public class ReferralInterceptor extends BaseInterceptor
             // This is the default value if we don't have any scope
             // Let's assume that it's incorrect if we get something
             // else in the LdapURL
-            String message = I18n.err( I18n.ERR_36 );
+            String message = I18n.err( I18n.ERR_27000_LDAPURL_CONTAINS_SCOPE );
             LOG.error( message );
             throw new LdapException( message );
         }
 
         if ( !Strings.isEmpty( ldapUrl.getFilter() ) )
         {
-            String message = I18n.err( I18n.ERR_37 );
+            String message = I18n.err( I18n.ERR_27001_LDAPURL_CONTAINS_FILTERS );
             LOG.error( message );
             throw new LdapException( message );
         }
 
         if ( ( ldapUrl.getAttributes() != null ) && !ldapUrl.getAttributes().isEmpty() )
         {
-            String message = I18n.err( I18n.ERR_38 );
+            String message = I18n.err( I18n.ERR_27002_LDAPURL_CONTAINS_DESCRIPTION_ATTRIBUTE_LIST );
             LOG.error( message );
             throw new LdapException( message );
         }
 
         if ( ( ldapUrl.getExtensions() != null ) && !ldapUrl.getExtensions().isEmpty() )
         {
-            String message = I18n.err( I18n.ERR_39 );
+            String message = I18n.err( I18n.ERR_27003_LDAPURL_CONTAINS_EXTENSION );
             LOG.error( message );
             throw new LdapException( message );
         }
 
         if ( ( ldapUrl.getExtensions() != null ) && !ldapUrl.getExtensions().isEmpty() )
         {
-            String message = I18n.err( I18n.ERR_40 );
+            String message = I18n.err( I18n.ERR_27004_LDAPURL_CONTAINS_CRITICL_EXTENSION );
             LOG.error( message );
             throw new LdapException( message );
         }
@@ -135,7 +135,7 @@ public class ReferralInterceptor extends BaseInterceptor
 
         if ( ( dn == null ) || dn.isEmpty() )
         {
-            String message = I18n.err( I18n.ERR_41 );
+            String message = I18n.err( I18n.ERR_27005_LDAPURL_DOES_NOT_CONTAIN_NON_EMPTY_DN );
             LOG.error( message );
             throw new LdapException( message );
         }
@@ -169,7 +169,7 @@ public class ReferralInterceptor extends BaseInterceptor
             if ( refAttr == null )
             {
                 // very unlikely, as we have already checked the entry in SchemaInterceptor
-                String message = I18n.err( I18n.ERR_42 );
+                String message = I18n.err( I18n.ERR_27006_REFERAL_ENTRY_WITHOUT_REF_ATTRIBUTE );
                 LOG.error( message );
                 throw new LdapException( message );
             }