Short of switching to another Security Manager implementation, the only resolution presently available is to build your own custom version of the shiro-core JAR with the fix applied and replace the jar distributed with GemFire (in the GemFire lib directory) with this modified JAR.
Custom shiro-core JAR
1. Clone the shiro repository from GitHub:
$ git clone https://github.com/apache/shiro.git
2. Change into the resulting shiro directory and checkout the appropriate version (e.g. v1.7.1 for GemFire 9.10.6, v1.6.0 for GemFire 9.10.5, etc.):
$ cd shiro
$ git checkout shiro-root-1.7.1
3. Make the fix to the
Ini.java and remove one test from
IniTest.groovy that validates the "bad" behavior. (A
.diff with the necessary changes is included at the bottom of this section):
$ patch -p1 < shiro-ini-fix.diff
4. Build the JAR:
$ mvn -am -pl :shiro-core package
5. Copy the resulting JAR over the one distributed with GemFire:
$ cp core/target/shiro-core-1.7.1.jar <PATH TO GEMFIRE LIB DIR>
6. Make sure your LDAP Security Manager is built against the correct version of Shiro.
Shiro-Ini-Fix.diff
diff --git a/config/core/src/main/java/org/apache/shiro/config/Ini.java b/config/core/src/main/java/org/apache/shiro/config/Ini.java
index 79936190..6e01fbe4 100644
--- a/config/core/src/main/java/org/apache/shiro/config/Ini.java
+++ b/config/core/src/main/java/org/apache/shiro/config/Ini.java
@@ -579,7 +579,7 @@ public class Ini implements Map<String, Ini.Section> {
char c = line.charAt(i);
if (buildingKey) {
- if (isKeyValueSeparatorChar(c) && !isCharEscaped(line, i)) {
+ if (isKeyValueSeparatorChar(c) && !isCharEscaped(line, i-1)) {
buildingKey = false;//now start building the value
} else if (!isCharEscaped(line, i)){
keyBuffer.append(c);
diff --git a/config/core/src/test/groovy/org/apache/shiro/config/IniTest.groovy b/config/core/src/test/groovy/org/apache/shiro/config/IniTest.groovy
index cf9ee12b..c0f9f686 100644
--- a/config/core/src/test/groovy/org/apache/shiro/config/IniTest.groovy
+++ b/config/core/src/test/groovy/org/apache/shiro/config/IniTest.groovy
@@ -161,17 +161,6 @@ public class IniTest {
assertEquals("\\ Beauty\\", kv[1]);
}
- /**
- * Tests if an escaped separator char will not be recognized as such.
- */
- @Test
- public void testSplitKeyValueEscapedEquals() {
- String test = "Truth\\=Beauty";
- String[] kv = Ini.Section.splitKeyValue(test);
- assertEquals("Truth", kv[0]);
- assertEquals("Beauty", kv[1]);
- }
-
@Test(expected = IllegalArgumentException.class)
public void testSplitKeyValueNoValue() {
String test = " Truth ";