Blob Blame History Raw
From b358a58ecfade3541694edcdffaf4068d96cf91e Mon Sep 17 00:00:00 2001
From: Dustin Wheeler <mdwheele@ncsu.edu>
Date: Mon, 6 Feb 2017 08:57:49 -0500
Subject: [PATCH] [krb5.aug] Support realms that start with numbers (#437)

Currently, the default kerberos configuration that ships with
Ubuntu has a realm that starts with a number (1TS.ORG). This
causes the parser to fail and prevents krb5.conf from being
available via augtool.

This patch allows numbers 0-9 as the first character of a
realm.
---
 lenses/krb5.aug            | 4 ++--
 lenses/tests/test_krb5.aug | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lenses/krb5.aug b/lenses/krb5.aug
index 8936f3a0..734ddde9 100644
--- a/lenses/krb5.aug
+++ b/lenses/krb5.aug
@@ -21,8 +21,8 @@ let closebr = del /[ \t]*\}/ "}"
    and realms in the [appdefaults] section.
 *)
 
-let realm_re = /[A-Z][.a-zA-Z0-9-]*/
-let realm_anycase_re = /[A-Za-z][.a-zA-Z0-9-]*/
+let realm_re = /[A-Z0-9][.a-zA-Z0-9-]*/
+let realm_anycase_re = /[A-Za-z0-9][.a-zA-Z0-9-]*/
 let app_re = /[a-z][a-zA-Z0-9_]*/
 let name_re = /[.a-zA-Z0-9_-]+/
 
diff --git a/lenses/tests/test_krb5.aug b/lenses/tests/test_krb5.aug
index 743bb375..f746543b 100644
--- a/lenses/tests/test_krb5.aug
+++ b/lenses/tests/test_krb5.aug
@@ -92,6 +92,10 @@ module Test_krb5 =
                         }
                 }
 	}
+    1TS.ORG = {
+        kdc = kerberos.1ts.org
+        admin_server = kerberos.1ts.org
+    }
         stanford.edu = {
                 kdc = krb5auth1.stanford.edu
                 kdc = krb5auth2.stanford.edu
@@ -367,6 +371,10 @@ test Krb5.lns get fermi_str =
         }
       }
     }
+    { "realm" = "1TS.ORG"
+      { "kdc" = "kerberos.1ts.org" }
+      { "admin_server" = "kerberos.1ts.org" }
+    }
     { "realm" = "stanford.edu"
       { "kdc" = "krb5auth1.stanford.edu" }
       { "kdc" = "krb5auth2.stanford.edu" }
-- 
2.24.1