Skip to content

Commit

Permalink
resolves #44
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmturner committed Nov 7, 2017
1 parent e16a942 commit 6c3a064
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config/krb5conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/krb5conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/.*//
}
Expand Down

0 comments on commit 6c3a064

Please sign in to comment.