Changeset 868 for trunk/cgi-bin


Ignore:
Timestamp:
05/04/16 10:44:29 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Add the DNS location to all RPC action calls to make sure we're only
changing the DNS records we should be

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r867 r868  
    16191619      # Only try to update rDNS when the pool is flagged as "rDNS available"
    16201620      if ($pinfo->{revavail} || $pinfo->{revpartial}) {
    1621         _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user});
     1621        _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user},
     1622                location => $pinfo->{location});
    16221623      }
    16231624      return ('OK', $args{cidr});
     
    17871788    if (($pinfo->{revavail} || $pinfo->{revpartial}) && ($args{rdns} || $args{iprev})) {
    17881789      # the netblock/allocation...
    1789       _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user});
     1790      _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user},
     1791              location => $pinfo->{location});
    17901792      # ...and the per-IP set, if there is one.
    1791       _rpc('updateRevSet', %{$args{iprev}}, rpcuser => $args{user})
     1793      _rpc('updateRevSet', %{$args{iprev}}, rpcuser => $args{user}, location => $pinfo->{location})
    17921794         if keys (%{$args{iprev}});
    17931795    }
     
    21002102    # should be safe to call unconditionally.
    21012103    # Requires dnsadmin >= r678
    2102     _rpc('updateRevSet', %fbset, rpcuser => $args{user});
     2104    _rpc('updateRevSet', %fbset, rpcuser => $args{user}, location => $pinfo->{location});
    21032105
    21042106  } else {
    21052107    $binfo->{block} =~ s{/(?:32|128)$}{};
    21062108    # Only insert a record for IPv4, or actual single v6 IPs
    2107     _rpc('addOrUpdateRevRec', cidr => $binfo->{block}, name => $args{rdns}, rpcuser => $args{user})
     2109    _rpc('addOrUpdateRevRec', cidr => $binfo->{block}, name => $args{rdns}, rpcuser => $args{user},
     2110            location => $pinfo->{location})
    21082111        if !$cidr->{isv6} || ($cidr->{isv6} && $cidr->masklen == 128);
    21092112
    21102113    # and the per-IP set, if there is one.
    2111     _rpc('updateRevSet', cidr => $binfo->{block}, %{$args{iprev}}, rpcuser => $args{user}, location => $pinfo->{location})
     2114    _rpc('updateRevSet', cidr => $binfo->{block}, %{$args{iprev}}, rpcuser => $args{user},
     2115            location => $pinfo->{location})
    21122116        if keys (%{$args{iprev}});
    21132117
    21142118    # and fix up the template's CIDR if required
    2115     _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'', rpcuser => $args{user})
     2119    _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'',
     2120            rpcuser => $args{user}, location => $pinfo->{location})
    21162121        if $args{fbmerge};
    21172122  }
     
    23142319
    23152320  # Only try to update rDNS when the original block is flagged as "rDNS available"
    2316   _rpc('splitTemplate', cidr => $binfo->{block}, newmask => $args{newmask}, rpcuser => $args{user})
     2321  _rpc('splitTemplate', cidr => $binfo->{block}, newmask => $args{newmask}, rpcuser => $args{user},
     2322          location => $binfo->{location})
    23172323      if ($binfo->{revavail} || $binfo->{revpartial});
    23182324
     
    24222428
    24232429  # Only try to update rDNS when the original block is flagged as "rDNS available"
    2424   _rpc('resizeTemplate', oldcidr => $binfo->{block}, newcidr => $newblock->network, rpcuser => $user)
     2430  _rpc('resizeTemplate', oldcidr => $binfo->{block}, newcidr => $newblock->network, rpcuser => $user,
     2431          location => $binfo->{location})
    24252432      if ($binfo->{revavail} || $binfo->{revpartial});
    24262433
     
    27732780    if ($args{scope} eq 'keepall') {
    27742781      # Add new rDNS for new container
    2775       _rpc('addOrUpdateRevRec', cidr => $binfo->{block}, name => $binfo->{rdns}, rpcuser => $args{user});
     2782      _rpc('addOrUpdateRevRec', cidr => $binfo->{block}, name => $binfo->{rdns}, rpcuser => $args{user},
     2783              location => $binfo->{location});
    27762784
    27772785    } else {
    27782786      # Resize rDNS template for $prime
    2779       _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'', rpcuser => $args{user});
     2787      _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'',
     2788              rpcuser => $args{user}, location => $binfo->{location});
    27802789
    27812790      # Assemble a list of blocks to delete...
     
    27902799        $cidrlist =~ s/,$//;
    27912800        _rpc('delRevSet', cidrlist => $cidrlist, rpcuser => $args{user}, delforward => 'y', delsubs => 'n',
    2792             parpatt => $pinfo->{rdns});
     2801            parpatt => $pinfo->{rdns}, location => $binfo->{location});
    27932802
    27942803      } elsif ($args{scope} eq 'clearpeer') {
     
    27962805        $cidrlist =~ s/,$//;
    27972806        _rpc('delRevSet', cidrlist => $cidrlist, rpcuser => $args{user}, delforward => 'y', delsubs => 'y',
    2798             parpatt => $pinfo->{rdns})
     2807            parpatt => $pinfo->{rdns}, location => $binfo->{location});
    27992808
    28002809      } elsif ($args{scope} eq 'clearall') {
     
    28022811        $cidrlist .= $binfo->{block};
    28032812        _rpc('delRevSet', cidrlist => $cidrlist, rpcuser => $args{user}, delforward => 'y', delsubs => 'y',
    2804             parpatt => $pinfo->{rdns});
     2813            parpatt => $pinfo->{rdns}, location => $binfo->{location});
    28052814
    28062815      } # scope, second level
     
    28112820
    28122821    # Resize rDNS template for $prime
    2813     _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'', rpcuser => $args{user});
     2822    _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'',
     2823            rpcuser => $args{user}, location => $binfo->{location});
    28142824
    28152825    if ($args{scope} eq 'keepall' || $args{scope} eq 'mergepeer') {
     
    28292839      # And do the calls.
    28302840      _rpc('delRevSet', cidrlist => join(',', @dellist), rpcuser => $args{user}, delforward => 'y', delsubs => 'n',
    2831           parpatt => $pinfo->{rdns});
    2832       _rpc('templatesToRecords', templates => \@convlist, rpcuser => $args{user});
     2841          parpatt => $pinfo->{rdns}, location => $binfo->{location});
     2842      _rpc('templatesToRecords', templates => \@convlist, rpcuser => $args{user}, location => $binfo->{location});
    28332843
    28342844    } # scope eq 'keepall' || 'mergepeer'
     
    28602870        # We delete ALL EVARYTHING in peer blocks...
    28612871        _rpc('delRevSet', cidrlist => join(',', @fulldellist), rpcuser => $args{user}, delforward => 'y',
    2862             delsubs => 'y', parpatt => $pinfo->{rdns}) if @fulldellist;
     2872                delsubs => 'y', parpatt => $pinfo->{rdns}, location => $binfo->{location})
     2873            if @fulldellist;
    28632874        # ... and just the template for container or pool templates in $prime...
    28642875        _rpc('delRevSet', cidrlist => join(',', @dellist), rpcuser => $args{user}, delforward => 'y',
    2865             delsubs => 'n', parpatt => $pinfo->{rdns}) if @dellist;
     2876                delsubs => 'n', parpatt => $pinfo->{rdns}, location => $binfo->{location})
     2877            if @dellist;
    28662878        # ... and convert a few to record groups
    2867         _rpc('templatesToRecords', templates => \@convlist, rpcuser => $args{user}) if @convlist;
     2879        _rpc('templatesToRecords', templates => \@convlist, rpcuser => $args{user},
     2880                location => $binfo->{location})
     2881            if @convlist;
    28682882      }
    28692883      if ($args{scope} eq 'clearall') {
    28702884# consider just doing join(',',$newblock->split($newblock->masklen+1))?
    28712885        _rpc('delRevSet', cidrlist => join(',', @fulldellist, @dellist, @convlist, $binfo->{block}),
    2872             rpcuser => $args{user}, delforward => 'y', delsubs => 'y', parpatt => $pinfo->{rdns});
     2886                rpcuser => $args{user}, delforward => 'y', delsubs => 'y', parpatt => $pinfo->{rdns},
     2887                location => $binfo->{location});
    28732888      }
    28742889
     
    28792894
    28802895    # Resize rDNS template for $prime
    2881     _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'', rpcuser => $args{user});
     2896    _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'',
     2897           rpcuser => $args{user}, location => $binfo->{location});
    28822898
    28832899    # Assemble a list of blocks to delete...
     
    28892905    $cidrlist .= $binfo->{block};
    28902906    _rpc('delRevSet', cidrlist => $cidrlist, rpcuser => $args{user}, delforward => 'y', delsubs => 'y',
    2891         parpatt => $pinfo->{rdns});
     2907            parpatt => $pinfo->{rdns}, location => $binfo->{location});
    28922908
    28932909  } # type grouping for rDNS calls
Note: See TracChangeset for help on using the changeset viewer.