Commit ec485a74 authored by Silas Baronda's avatar Silas Baronda Committed by Miek Gieben

Nil SOA causes panic if we compare it to incoming SOA (#291)

parent 15297c8e
......@@ -88,6 +88,9 @@ Transfer:
if serial == -1 {
return false, Err
}
if z.Apex.SOA == nil {
return true, Err
}
return less(z.Apex.SOA.Serial, uint32(serial)), Err
}
......
......@@ -84,9 +84,17 @@ func TestShouldTransfer(t *testing.T) {
z.origin = testZone
z.TransferFrom = []string{addrstr}
// when we have a nil SOA (initial state)
should, err := z.shouldTransfer()
if err != nil {
t.Fatalf("unable to run shouldTransfer: %v", err)
}
if !should {
t.Fatalf("shouldTransfer should return true for serial: %d", soa.serial)
}
// Serial smaller
z.Apex.SOA = test.SOA(fmt.Sprintf("%s IN SOA bla. bla. %d 0 0 0 0 ", testZone, soa.serial-1))
should, err := z.shouldTransfer()
should, err = z.shouldTransfer()
if err != nil {
t.Fatalf("unable to run shouldTransfer: %v", err)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment