You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2021/04/14 16:28:20 UTC
[shiro] branch 1.7.x updated: [SHIRO-812] Key value separator in
config is broken with escape char
This is an automated email from the ASF dual-hosted git repository.
fpapon pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/1.7.x by this push:
new 6439f97 [SHIRO-812] Key value separator in config is broken with escape char
6439f97 is described below
commit 6439f97469ceb75958439ef9029ec7332a5d1d19
Author: Francois Papon <fp...@apache.org>
AuthorDate: Sat Mar 13 08:37:02 2021 +0100
[SHIRO-812] Key value separator in config is broken with escape char
---
config/core/src/main/java/org/apache/shiro/config/Ini.java | 2 +-
config/core/src/test/groovy/org/apache/shiro/config/IniTest.groovy | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
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 7993619..27e65e5 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) && !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 cf9ee12..bfd6882 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
@@ -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])
}
/**