mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Fix parsing of transfer lines
This commit is contained in:
@@ -99,27 +99,24 @@ func parseTransfer(c *Controller) (tos, froms []string, err error) {
|
||||
value := c.Val()
|
||||
switch what {
|
||||
case "transfer":
|
||||
if !c.NextArg() {
|
||||
return nil, nil, c.ArgErr()
|
||||
}
|
||||
if value == "to" {
|
||||
tos := c.RemainingArgs()
|
||||
tos = c.RemainingArgs()
|
||||
for i, _ := range tos {
|
||||
if x := net.ParseIP(tos[i]); x == nil {
|
||||
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", tos[i])
|
||||
}
|
||||
if tos[i] != "*" {
|
||||
if x := net.ParseIP(tos[i]); x == nil {
|
||||
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", tos[i])
|
||||
}
|
||||
tos[i] = middleware.Addr(tos[i]).Normalize()
|
||||
}
|
||||
}
|
||||
}
|
||||
if value == "from" {
|
||||
froms := c.RemainingArgs()
|
||||
froms = c.RemainingArgs()
|
||||
for i, _ := range froms {
|
||||
if x := net.ParseIP(froms[i]); x == nil {
|
||||
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", froms[i])
|
||||
}
|
||||
if froms[i] != "*" {
|
||||
if x := net.ParseIP(froms[i]); x == nil {
|
||||
return nil, nil, fmt.Errorf("must specify an IP addres: `%s'", froms[i])
|
||||
}
|
||||
froms[i] = middleware.Addr(froms[i]).Normalize()
|
||||
} else {
|
||||
return nil, nil, fmt.Errorf("can't use '*' in transfer from")
|
||||
|
||||
@@ -41,7 +41,8 @@ Transfer:
|
||||
for _, rr := range env.RR {
|
||||
if err := z1.Insert(rr); err != nil {
|
||||
log.Printf("[ERROR] Failed to parse transfer `%s': %v", z.origin, err)
|
||||
return err
|
||||
Err = err
|
||||
continue Transfer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user