directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: DIRKRB-613 Tests fails on systems with includedir in /etc/krb5.conf.
Date Fri, 24 Feb 2017 08:21:16 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk 7ae2cf77d -> e34b1ef8f


DIRKRB-613 Tests fails on systems with includedir in /etc/krb5.conf.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/e34b1ef8
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/e34b1ef8
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/e34b1ef8

Branch: refs/heads/trunk
Commit: e34b1ef8fec64e89780aec37aac903d4608e215f
Parents: 7ae2cf7
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Fri Feb 24 16:27:17 2017 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Fri Feb 24 16:27:17 2017 +0800

----------------------------------------------------------------------
 .../apache/kerby/kerberos/kerb/common/Krb5Parser.java  | 13 ++++++++++++-
 .../org/apache/kerby/kerberos/kerb/Krb5ParserTest.java |  4 +++-
 kerby-kerb/kerb-common/src/test/resources/krb5.conf    |  1 +
 3 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e34b1ef8/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
index 9f4196c..2a72add 100644
--- a/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
+++ b/kerby-kerb/kerb-common/src/main/java/org/apache/kerby/kerberos/kerb/common/Krb5Parser.java
@@ -68,7 +68,15 @@ public class Krb5Parser {
             }   else if (line.startsWith("[")) {
                 insertSections(line, br, items);
                 originLine = br.readLine();
-            }   else {
+            } else if (line.startsWith("include")) {
+                String[] splited = line.trim().split("\\s+");
+                if (splited.length == 2) {
+                    items.put(splited[0], splited[1]);
+                } else {
+                    throw new RuntimeException("Unable to parse:" + originLine);
+                }
+                originLine = br.readLine();
+            } else {
                 throw new RuntimeException("Unable to parse:" + originLine);
             }
         }
@@ -105,6 +113,9 @@ public class Krb5Parser {
         for (Map.Entry<String, Object> item : items.entrySet()) {
             if (item.getKey().equals(sectionName)) {
                 value = item.getValue();
+                if (keys.length == 0) {
+                    return value;
+                }
                 Map<String, Object> map = (Map) item.getValue();
                 for (Map.Entry<String, Object> entry : map.entrySet()) {
                     if (entry.getKey().equals(keys[0])) {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e34b1ef8/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
b/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
index fb09722..89e5fab 100644
--- a/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
+++ b/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
@@ -42,8 +42,10 @@ public class Krb5ParserTest {
         Krb5Parser k = new Krb5Parser(new File(url.getFile()));
         k.load();
 
-        assertThat(k.getSections().size()).isEqualTo(4);
+        assertThat(k.getSections().size()).isEqualTo(5);
         assertThat(k.getSections().contains("libdefaults")).isTrue();
+        assertThat(k.getSections().contains("include")).isTrue();
+        assertThat(k.getSection("include")).isEqualTo("/etc");
 
         assertThat(k.getSection("libdefaults", "dns_lookup_kdc")).isEqualTo("false");
         assertThat(k.getSection("realms", "ATHENA.MIT.EDU") instanceof Map).isTrue();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/e34b1ef8/kerby-kerb/kerb-common/src/test/resources/krb5.conf
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/test/resources/krb5.conf b/kerby-kerb/kerb-common/src/test/resources/krb5.conf
index 1a5b35e..43c62e2 100644
--- a/kerby-kerb/kerb-common/src/test/resources/krb5.conf
+++ b/kerby-kerb/kerb-common/src/test/resources/krb5.conf
@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+include /etc
 [libdefaults]
   default_realm = KRB.COM
   kdc_host = kdc-server.example.com


Mime
View raw message