Index: trunk/DNSDB.pm
===================================================================
--- trunk/DNSDB.pm	(revision 775)
+++ trunk/DNSDB.pm	(revision 776)
@@ -6510,8 +6510,8 @@
     # host contains pri-ns:responsible
     # val is abused to contain refresh:retry:expire:minttl
-##fixme:  "manual" serial vs tinydns-autoserial
     # let's be explicit about abusing $host and $val
     my ($email, $primary) = (split /:/, $host)[0,1];
     my ($refresh, $retry, $expire, $min_ttl) = (split /:/, $val)[0,1,2,3];
+    my $serial = 0;
     if ($revrec eq 'y') {
 ##fixme:  have to publish SOA records for each v4 /24 in sub-/16, and each /16 in sub-/8
@@ -6519,4 +6519,6 @@
 # -> only need SOA for local chunks offset from reverse delegation boundaries, so v6 is fine
 # anyone who says they need sub-nibble v6 delegations, at this time, needs their head examined.
+##fixme?:  alternate SOA serial schemes?
+      ($serial) = $self->{dbh}->selectrow_array("SELECT zserial FROM revzones WHERE revnet=?", undef, $zone);
       $zone = NetAddr::IP->new($zone);
       # handle split-n-multiply SOA for off-octet (8 < mask < 16) or (16 < mask < 24) v4 zones
@@ -6524,5 +6526,5 @@
         foreach my $szone ($zone->split($zone->masklen + (8 - $zone->masklen % 8))) {
           $szone = _ZONE($szone, 'ZONE.in-addr.arpa', 'r', '.');
-          print $datafile "Z$szone:$primary:$email"."::$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
+          print $datafile "Z$szone:$primary:$email:$serial:$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
             or die $!;
         }
@@ -6530,6 +6532,11 @@
       }
       $zone = _ZONE($zone, 'ZONE', 'r', '.').($zone->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
-    }
-    print $datafile "Z$zone:$primary:$email"."::$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
+    } else {
+      # just snarfing the right SOA serial for the zone type
+##fixme?:  alternate SOA serial schemes?
+      ($serial) = $self->{dbh}->selectrow_array("SELECT zserial FROM domains WHERE domain=?", undef, $zone);
+    } # revrec <> 'y'
+    $serial = '' if !$serial; # suppress a "uninitialized value" warning.  empty serial isn't an error, just falls back to tinydns' autoser$
+    print $datafile "Z$zone:$primary:$email:$serial:$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n"
       or die $!;
   } # SOA
