Skip to content

Commit

Permalink
Merge pull request #286 from fpapon/SHIRO-812
Browse files Browse the repository at this point in the history
[SHIRO-812] Key value separator in config is broken with escape char
  • Loading branch information
fpapon committed Apr 14, 2021
2 parents 7058994 + 00591e4 commit d1d6f3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/core/src/main/java/org/apache/shiro/config/Ini.java
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ protected static String[] splitKeyValue(String keyValueLine) {
char c = line.charAt(i);

if (buildingKey) {
if (isKeyValueSeparatorChar(c) && !isCharEscaped(line, i)) {
if (isKeyValueSeparatorChar(c) && !isCharEscaped(line, i) && !isCharEscaped(line, i-1)) {
buildingKey = false;//now start building the value
} else if (!isCharEscaped(line, i)){
keyBuffer.append(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public class IniTest {
kv = Ini.Section.splitKeyValue(test);
assertEquals("Truth", kv[0]);
assertEquals("\\ Beauty\\", kv[1]);

test = "cn\\=TheSpecial_GroupName,ou\\=groups,dc\\=example,dc\\=com = *:*"
kv = Ini.Section.splitKeyValue(test)
assertEquals("cn=TheSpecial_GroupName,ou=groups,dc=example,dc=com", kv[0])
assertEquals("*:*", kv[1])
}

/**
Expand Down

0 comments on commit d1d6f3e

Please sign in to comment.