diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java
index c39e9433c6..8ff24acca4 100644
--- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java
+++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java
@@ -21,8 +21,7 @@
package org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
@@ -62,7 +61,7 @@ public void setup()
public void testEqual()
{
int result = sorter.compare( null, valueA1, valueA2 );
- assertThat( result, equalTo( 0 ) );
+ assertEquals( 0, result );
}
@@ -70,7 +69,7 @@ public void testEqual()
public void testLeftIsSmaller()
{
int result = sorter.compare( null, valueA1, valueB );
- assertThat( result, equalTo( -1 ) );
+ assertEquals( -1, result );
}
@@ -78,7 +77,7 @@ public void testLeftIsSmaller()
public void testRightIsSmaller()
{
int result = sorter.compare( null, valueB, valueA2 );
- assertThat( result, equalTo( 1 ) );
+ assertEquals( 1, result );
}
@@ -86,7 +85,7 @@ public void testRightIsSmaller()
public void testLeftIsEmpty()
{
int result = sorter.compare( null, empytValue1, valueA2 );
- assertThat( result, equalTo( -1 ) );
+ assertEquals( -1, result );
}
@@ -94,7 +93,7 @@ public void testLeftIsEmpty()
public void testRightIsEmpty()
{
int result = sorter.compare( null, valueB, empytValue2 );
- assertThat( result, equalTo( 1 ) );
+ assertEquals( 1, result );
}
@@ -102,7 +101,7 @@ public void testRightIsEmpty()
public void testBothAreEmpty()
{
int result = sorter.compare( null, empytValue1, empytValue2 );
- assertThat( result, equalTo( 0 ) );
+ assertEquals( 0, result );
}
}
diff --git a/plugins/openldap.syncrepl/src/main/java/org/apache/directory/studio/openldap/syncrepl/SyncReplParser.java b/plugins/openldap.syncrepl/src/main/java/org/apache/directory/studio/openldap/syncrepl/SyncReplParser.java
index c6a74c1530..d05298dad0 100644
--- a/plugins/openldap.syncrepl/src/main/java/org/apache/directory/studio/openldap/syncrepl/SyncReplParser.java
+++ b/plugins/openldap.syncrepl/src/main/java/org/apache/directory/studio/openldap/syncrepl/SyncReplParser.java
@@ -364,22 +364,22 @@ else if ( Strings.areEquals( chars, pos.start, KEYWORD_TLS_KEY, false ) >= 0 )
parseTlsKey( chars, pos, syncRepl, parserException );
}
- // tls_cacert
- else if ( Strings.areEquals( chars, pos.start, KEYWORD_TLS_CACERT, false ) >= 0 )
+ // tls_cacertdir (must be checked before its prefix tls_cacert)
+ else if ( Strings.areEquals( chars, pos.start, KEYWORD_TLS_CACERTDIR, false ) >= 0 )
{
foundAtLeastOneProperty = true;
- pos.start += KEYWORD_TLS_CACERT.length();
+ pos.start += KEYWORD_TLS_CACERTDIR.length();
- parseTlsCacert( chars, pos, syncRepl, parserException );
+ parseTlsCacertDir( chars, pos, syncRepl, parserException );
}
- // tls_cacertdir
- else if ( Strings.areEquals( chars, pos.start, KEYWORD_TLS_CACERTDIR, false ) >= 0 )
+ // tls_cacert
+ else if ( Strings.areEquals( chars, pos.start, KEYWORD_TLS_CACERT, false ) >= 0 )
{
foundAtLeastOneProperty = true;
- pos.start += KEYWORD_TLS_CACERTDIR.length();
+ pos.start += KEYWORD_TLS_CACERT.length();
- parseTlsCacertDir( chars, pos, syncRepl, parserException );
+ parseTlsCacert( chars, pos, syncRepl, parserException );
}
// tls_reqcert
@@ -1054,6 +1054,13 @@ else if ( ( quoteChar == '\'' ) && ( Strings.areEquals( chars, pos.start, "\\'"
pos.start += 2;
continue;
}
+ // Any other backslash is part of the value: slapd passes it
+ // through unchanged in cn=config values (strtok_quote_ldif)
+ else
+ {
+ v[current++] = c;
+ pos.start++;
+ }
}
// Any other char is part of a value
else
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java
index ac99ff35a7..8bd3f0fae2 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java
@@ -27,6 +27,8 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.Timeout.ThreadMode;
/**
@@ -724,4 +726,51 @@ public void testSymasDoc3WithSpacesMultilinesAllNotQuoted() throws Exception
assertEquals( "cn=syncuser,dc=example,dc=com", syncRepl.getBindDn() );
assertEquals( "secret", syncRepl.getCredentials() );
}
+
+
+ @Test
+ @Timeout(value = 5, threadMode = ThreadMode.SEPARATE_THREAD)
+ public void testQuotedValueKeepsBackslashes() throws Exception
+ {
+ // cn=config values are split by slapd's strtok_quote_ldif(), which passes backslashes through unchanged
+ SyncReplParser parser = new SyncReplParser();
+ SyncRepl syncRepl = parser.parse( "rid=1 tls_cacert=\"C:\\certs\\ca.pem\"" );
+
+ assertNotNull( syncRepl );
+ assertEquals( "C:\\certs\\ca.pem", syncRepl.getTlsCacert() );
+ }
+
+
+ @Test
+ @Timeout(value = 5, threadMode = ThreadMode.SEPARATE_THREAD)
+ public void testFilterAndBindDnWithBackslashSurviveRoundTrip() throws Exception
+ {
+ SyncRepl syncRepl = new SyncRepl();
+ syncRepl.setRid( "1" );
+ syncRepl.setFilter( "(cn=a\\2ab)" );
+ syncRepl.setBindDn( "cn=Smith\\, John,dc=example,dc=com" );
+
+ String value = syncRepl.toString();
+
+ assertTrue( value.contains( "filter=\"(cn=a\\2ab)\"" ), value );
+ assertTrue( value.contains( "binddn=\"cn=Smith\\, John,dc=example,dc=com\"" ), value );
+
+ SyncRepl reparsed = new SyncReplParser().parse( value );
+
+ assertNotNull( reparsed );
+ assertEquals( "(cn=a\\2ab)", reparsed.getFilter() );
+ assertEquals( "cn=Smith\\, John,dc=example,dc=com", reparsed.getBindDn() );
+ }
+
+
+ @Test
+ public void testTlsCacertDir() throws Exception
+ {
+ SyncReplParser parser = new SyncReplParser();
+ SyncRepl syncRepl = parser.parse( "rid=1 tls_cacertdir=/etc/openldap/certs" );
+
+ assertNotNull( syncRepl );
+ assertEquals( "/etc/openldap/certs", syncRepl.getTlsCacertDir() );
+ assertNull( syncRepl.getTlsCacert() );
+ }
}
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 575f929705..1f14638dd0 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -161,12 +161,6 @@
${junit.jupiter.version}
test
-
- org.junit.platform
- junit-platform-runner
- ${junit.platform.version}
- test
-
org.junit.jupiter
junit-jupiter-params
diff --git a/pom.xml b/pom.xml
index 3aa4362523..0e88eefa6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,6 @@
2.7.7
2.7.7
- 1.10.2
5.10.2
1.2.17
1.2.17