瀏覽代碼

resolves #44

Jonathan Turner 8 年之前
父節點
當前提交
6c3a064e9a
共有 2 個文件被更改,包括 6 次插入5 次删除
  1. 5 5
      config/krb5conf.go
  2. 1 0
      config/krb5conf_test.go

+ 5 - 5
config/krb5conf.go

@@ -472,25 +472,25 @@ func NewConfigFromScanner(scanner *bufio.Scanner) (*Config, error) {
 	var lines []string
 	for scanner.Scan() {
 		// Skip comments and blank lines
-		if matched, _ := regexp.MatchString(`\s*(#|;|\n)`, scanner.Text()); matched {
+		if matched, _ := regexp.MatchString(`^\s*(#|;|\n)`, scanner.Text()); matched {
 			continue
 		}
-		if matched, _ := regexp.MatchString(`\s*\[libdefaults\]\s*`, scanner.Text()); matched {
+		if matched, _ := regexp.MatchString(`^\s*\[libdefaults\]\s*`, scanner.Text()); matched {
 			sections[len(lines)] = "libdefaults"
 			sectionLineNum = append(sectionLineNum, len(lines))
 			continue
 		}
-		if matched, _ := regexp.MatchString(`\s*\[realms\]\s*`, scanner.Text()); matched {
+		if matched, _ := regexp.MatchString(`^\s*\[realms\]\s*`, scanner.Text()); matched {
 			sections[len(lines)] = "realms"
 			sectionLineNum = append(sectionLineNum, len(lines))
 			continue
 		}
-		if matched, _ := regexp.MatchString(`\s*\[domain_realm\]\s*`, scanner.Text()); matched {
+		if matched, _ := regexp.MatchString(`^\s*\[domain_realm\]\s*`, scanner.Text()); matched {
 			sections[len(lines)] = "domain_realm"
 			sectionLineNum = append(sectionLineNum, len(lines))
 			continue
 		}
-		if matched, _ := regexp.MatchString(`\s*\[.*\]\s*`, scanner.Text()); matched {
+		if matched, _ := regexp.MatchString(`^\s*\[.*\]\s*`, scanner.Text()); matched {
 			sections[len(lines)] = "unknown_section"
 			sectionLineNum = append(sectionLineNum, len(lines))
 			continue

+ 1 - 0
config/krb5conf_test.go

@@ -48,6 +48,7 @@ const (
         kdc = kerberos.example.com
         kdc = kerberos-1.example.com
         admin_server = kerberos.example.com
+        auth_to_local = RULE:[1:$1@$0](.*@EXAMPLE.COM)s/.*//
  }