Index: /trunk/bind-import
===================================================================
--- /trunk/bind-import	(revision 819)
+++ /trunk/bind-import	(revision 820)
@@ -96,6 +96,8 @@
     open SKIP, "<$skipfile";
     while (<SKIP>) {
+      chomp;
       push @skipdefs, $_;
     }
+    close SKIP;
   } else {
     warn "skipfile $skipfile requested but it doesn't seem to exist.  Continuing.\n";
@@ -138,5 +140,5 @@
       $zname = DNSDB::_ZONE($zname, 'ZONE', 'r', '.').($zname->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
     }
-    $zid = $dnsdb->{dbh}->do("INSERT INTO revzones (revnet,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING rnds_id",
+    ($zid) = $dnsdb->{dbh}->selectrow_array("INSERT INTO revzones (revnet,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING rnds_id",
 	undef, ($zname, $group, $status, $location, $serial));
 
@@ -147,9 +149,8 @@
 #      die "zone $origzone already present, not merging records\n";
 print "dbg: skip add domain\n";
-    }
-else {
-    $zid = $dnsdb->{dbh}->do("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING domain_id",
+    } else {
+      ($zid) = $dnsdb->{dbh}->selectrow_array("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING domain_id",
 	undef, ($zname, $group, $status, $location, $serial));
-}
+    }
 
   }
@@ -184,11 +185,23 @@
 				# arguably should do some more targeted voodoo when parsing the SOA details
 
+##fixme:  would prefer to break the loop below *AND* next; the while starting above
+    # check skiplist.  do this early since it's (mostly) a simple string match against the raw record line
+    my $skipflag = 0;
+    foreach (@skipdefs) {
+#print "skipdbg: $_ =~ $rec\n" if $rec =~ /207/;
+      if ($rec =~ /\Q$_\E/) {
+        $skipflag = 1;
+#        print "skip: $rec\n";
+      }
+    }
+    next if $skipflag;
+
 ##fixme:  use external skiplist
-  # skip stale records that have no value
-  next if /^ip-192-168-1(12|20)-\d+/;
-  next if /ip.add.re.\d+\s*$/;
-
-  $i++;
-last if $i > 7;
+#  # skip stale records that have no value
+#  next if /^ip-192-168-1(12|20)-\d+/;
+#  next if /ip.add.re.\d+\s*$/;
+
+$i++;
+last if $i > 17;
 #print "line $i: ($rec)\n";
     if (my ($macro,$mdetail) = ($rec =~ /^\s*\$(TTL|ORIGIN|INCLUDE|GENERATE)\s+(.+)/) ) {
@@ -236,10 +249,10 @@
     if ($rec =~ /^\s/) {
       $curlabel = $prevlabel;
-print "  found empty label, using previous label\n";
+#print "  found empty label, using previous label\n";
     } else {
       ($curlabel) = ($rec =~ /^([\w\@_.-]+)\s/);
     }
 
-print "  found '$curlabel'\n";
+#print "  found '$curlabel'\n";
 
     # magic name!
@@ -250,5 +263,5 @@
       $curlabel .= ($origin eq '.' ? '.' : ".$origin");
     }
-print "  expanded '$curlabel'\n";
+#print "  expanded '$curlabel'\n";
 
 # hack pthbptt
@@ -476,4 +489,6 @@
 #Zfqdn:mname:rname:ser:ref:ret:exp:min:ttl:timestamp:lo
 #print "Z$zname:$ns:$adminmail:$soabits[0]:$soabits[1]:$soabits[2]:$soabits[3]:$soabits[4]:$ttl\n";
+      # skip insert at end of loop;  SOA records are not handled by DNSDB::addRec()
+      next;
     } # SOA
 
@@ -556,5 +571,5 @@
           $location, undef, undef, $distance, $weight, $port);
       }
-      print "$code: $msg\n";
+      print "$code: $msg\n" if $code ne 'OK';
     }
 #  $i++;
