From bbfbcae21aee6eb7d6924d3f40f0f4b551b485ca Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Tue, 29 Oct 2024 12:27:04 +0300 Subject: [PATCH] Immediate children should only have one RDN separator past the parent length without NORMALIZED_ESC_BYTE+NORMALIZED_RDN_SEPARATOR --- .../server/backends/pluggable/DnKeyFormat.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DnKeyFormat.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DnKeyFormat.java index cf681fbd1d..cbd950314b 100644 --- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DnKeyFormat.java +++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DnKeyFormat.java @@ -120,18 +120,27 @@ static ByteStringBuilder afterLastChildOf(final ByteSequence key) static boolean isChild(ByteSequence parent, ByteSequence child) { if (child.length() <= parent.length() - || child.byteAt(parent.length()) != NORMALIZED_RDN_SEPARATOR - || !child.startsWith(parent)) + || child.byteAt(parent.length()) != NORMALIZED_RDN_SEPARATOR + || !child.startsWith(parent)) { return false; } + // Immediate children should only have one RDN separator past the parent length + boolean childSeparatorDetected = false; for (int i = parent.length() ; i < child.length(); i++) { if (child.byteAt(i) == NORMALIZED_RDN_SEPARATOR) { - return true; + if (childSeparatorDetected) + { + if (child.byteAt(i-1)==NORMALIZED_ESC_BYTE) { + continue; + } + return false; + } + childSeparatorDetected = true; } } - return false; + return childSeparatorDetected; } }