From 8e6fb9432151fd9eb49efe6937034e27c30a6545 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 01 Apr 2016 10:32:18 +0000
Subject: [PATCH] OPENDJ-2777 Invalid attribute syntax not caught with ldapmodify for badly shaped aci

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
index b1c3a27..8fb6048 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
@@ -16,6 +16,7 @@
  */
 package org.opends.server.backends.pluggable;
 
+import static org.forgerock.opendj.ldap.SearchScope.*;
 import static org.opends.messages.BackendMessages.*;
 import static org.opends.server.backends.pluggable.DnKeyFormat.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -518,7 +519,7 @@
           }
         }
       }
-      catch (DirectoryException e)
+      catch (LocalizedIllegalArgumentException | DirectoryException e)
       {
         logger.traceException(e);
         // Return the non-LDAP URI as is.
@@ -621,7 +622,7 @@
       {
         // We have found a subordinate referral.
         // Make sure the referral is within scope.
-        if (searchOp.getScope() == SearchScope.SINGLE_LEVEL
+        if (searchOp.getScope() == SINGLE_LEVEL
             && DnKeyFormat.findDNKeyParent(cursor.getKey()) != baseDN.length())
         {
           success = cursor.next();
@@ -670,7 +671,6 @@
       try
       {
         LDAPURL ldapurl = LDAPURL.decode(uri, false);
-
         if ("ldap".equalsIgnoreCase(ldapurl.getScheme()))
         {
           if (ldapurl.getBaseDN().isRootDN())
@@ -678,19 +678,12 @@
             ldapurl.setBaseDN(dn);
           }
           ldapurl.getAttributes().clear();
-          if (scope == SearchScope.SINGLE_LEVEL)
-          {
-            ldapurl.setScope(SearchScope.BASE_OBJECT);
-          }
-          else
-          {
-            ldapurl.setScope(SearchScope.WHOLE_SUBTREE);
-          }
+          ldapurl.setScope(scope == SINGLE_LEVEL ? BASE_OBJECT : WHOLE_SUBTREE);
           ldapurl.setFilter(null);
           uri = ldapurl.toString();
         }
       }
-      catch (DirectoryException e)
+      catch (LocalizedIllegalArgumentException | DirectoryException e)
       {
         logger.traceException(e);
         // Return the non-LDAP URI as is.

--
Gitblit v1.10.0