Changeset 832 for trunk/dns-rpc.cgi


Ignore:
Timestamp:
03/30/22 14:48:23 (3 years ago)
Author:
Kris Deugau
Message:

/trunk

Replace the hack in r829 with a proper solution:

  • Have getRecList() and getRecCount() accept most of the Postgres CIDR operators in the filter argument
  • Have dns-rpc.cgi prefix the CIDR to remove with the <<= operator when calling getRecList()

This commit only applies the second part to the "delete everything"
branch of the RPC delByCIDR() sub with known failure cases.

See #77.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns-rpc.cgi

    r829 r832  
    16311631        # Delete ALL EVARYTHING!!one11!! in $args{cidr}
    16321632
    1633         # Use offset => 'all' to make sure we actually find all the records we need to remove,
    1634         # otherwise the record(s) that need to be deleted may be more than 75 records down the
    1635         # list and won't get caught.  We also do a crude filter based on the /24 of $args{cidr}
    1636         # to reduce the remote's cost for the operation - if the revzone is large, it'll iterate
    1637         # over a Very Large Number(TM) of records, just to delete a small handful.  Bad juju.
    1638         my $filt = $args{cidr};
    1639         $filt =~ s,\.\d+(?:/\d+)?$,,;
     1633        # Deleting a small $args{cidr} from a large reverse zone will sometimes
     1634        # silently fail by not finding the appropriate record(s).  Prepend a
     1635        # Postgres CIDR operator to assist in filtering
     1636        my $filt = "<<= $args{cidr}";
     1637
    16401638        my $reclist = $dnsdb->getRecList(rpc => 1, defrec => 'n', revrec => 'y', id => $zonelist->[0]->{rdns_id},
    16411639            filter => $filt, offset => 'all');
Note: See TracChangeset for help on using the changeset viewer.