Skip to content

Commit 4c29840

Browse files
committed
Revert "Print an error if a block/allow rule contains more than a pattern"
This reverts commit 6e8628f.
1 parent 69019b7 commit 4c29840

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

dnscrypt-proxy/plugin_allow_name.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@ func (plugin *PluginAllowName) Init(proxy *Proxy) error {
4343
parts := strings.Fields(line)
4444
timeRangeName := ""
4545
if len(parts) == 2 {
46-
if timeRangeParts := strings.Split(parts[1], "@"); len(timeRangeParts) == 2 {
47-
timeRangeName = strings.TrimSpace(timeRangeParts[1])
48-
} else {
49-
dlog.Errorf("Syntax error in allowed names at line %d", 1+lineNo)
50-
continue
51-
}
46+
line = strings.TrimSpace(parts[0])
47+
timeRangeName = strings.TrimSpace(parts[1])
5248
} else if len(parts) > 2 {
53-
dlog.Errorf("Syntax error in allowed names at line %d", 1+lineNo)
49+
dlog.Errorf("Syntax error in allowed names at line %d -- Unexpected @ character", 1+lineNo)
5450
continue
5551
}
5652
var weeklyRanges *WeeklyRanges

dnscrypt-proxy/plugin_block_name.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,13 @@ func (plugin *PluginBlockName) Init(proxy *Proxy) error {
9797
if len(line) == 0 {
9898
continue
9999
}
100-
parts := strings.Fields(line)
100+
parts := strings.Split(line, "@")
101101
timeRangeName := ""
102102
if len(parts) == 2 {
103-
if timeRangeParts := strings.Split(parts[1], "@"); len(timeRangeParts) == 2 {
104-
timeRangeName = strings.TrimSpace(timeRangeParts[1])
105-
} else {
106-
dlog.Errorf("Syntax error in block rules at line %d", 1+lineNo)
107-
continue
108-
}
103+
line = strings.TrimSpace(parts[0])
104+
timeRangeName = strings.TrimSpace(parts[1])
109105
} else if len(parts) > 2 {
110-
dlog.Errorf("Syntax error in block rules at line %d", 1+lineNo)
106+
dlog.Errorf("Syntax error in block rules at line %d -- Unexpected @ character", 1+lineNo)
111107
continue
112108
}
113109
var weeklyRanges *WeeklyRanges

0 commit comments

Comments
 (0)