directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject directory-kerby git commit: DIRKRB-717 - Allow semicolon as a comment character in krb5.conf files. Thanks to Kamil Krynicki for the patch
Date Thu, 31 May 2018 09:29:47 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk 63ba89311 -> 4990dc702


DIRKRB-717 - Allow semicolon as a comment character in krb5.conf files. Thanks to Kamil Krynicki
for the patch


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

Branch: refs/heads/trunk
Commit: 4990dc702052d297f01b7172920bc8eb72a86b01
Parents: 63ba893
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu May 31 10:29:00 2018 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu May 31 10:29:00 2018 +0100

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


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/4990dc70/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 504932a..13492fd 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
@@ -63,7 +63,7 @@ public class Krb5Parser {
         while (originLine != null) {
             String line = originLine.trim();
             /*parse through comments*/
-            if (line.startsWith("#") || line.length() == 0) {
+            if (line.isEmpty() || isComment(line)) {
                 originLine = br.readLine();
             } else if (line.startsWith("[")) {
                 insertSections(line, br, items);
@@ -155,7 +155,7 @@ public class Krb5Parser {
             if (line == null) {
                 break;
             }
-            while (line.startsWith("#")) {
+            while (!line.isEmpty() && isComment(line)) {
                 line = br.readLine();
                 if (line == null) {
                     break;
@@ -192,7 +192,7 @@ public class Krb5Parser {
             }
             return line;
         }
-        if (line.length() == 0 || line.startsWith("#")) {
+        if (line.isEmpty() || isComment(line)) {
             line = br.readLine();
             if (line != null) {
                 line = line.trim();
@@ -264,4 +264,8 @@ public class Krb5Parser {
             }
         }
     }
+
+    private boolean isComment(String line) {
+        return line.charAt(0) == '#' || line.charAt(0) == ';';
+    }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/4990dc70/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 43c62e2..a3b0d49 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.
 #
+; this is also a comment
 include /etc
 [libdefaults]
   default_realm = KRB.COM


Mime
View raw message