Changeset 687 for trunk


Ignore:
Timestamp:
08/19/15 17:42:17 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Roll up a couple of typofixes and missing-argument handling reviewing
dns-rpc.cgi for documentation and testing:

  • Fail early in DNSDB::delZone() if we didn't get a zone ID passed in
  • Use the right argument name in dns-rpc.cgi:addDomain() for the domain's default location
  • Fail early in dns-rpc.cgi:delZone() if we didn't get a zone ID
  • Fix letterswap typo in dns-rpc.cgi:delRec() on revrec argument
  • Add a bit more safety net in dns-rpc.cgi:delByCIDR() so that the caller must explicitly request removal of paired A records when deleting A+PTR or other paired types
  • Fix dns-rpc.cgi:zoneStatus() which somehow lost the forward/reverse flag required by DNSDB::zoneStatus()
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r685 r687  
    24252425  local $dbh->{AutoCommit} = 0;
    24262426  local $dbh->{RaiseError} = 1;
     2427
     2428  return ('FAIL', 'Need a zone identifier to look up') if !$zoneid;
    24272429
    24282430  my $msg = '';
  • trunk/dns-rpc.cgi

    r686 r687  
    198198  _commoncheck(\%args, 'y');
    199199
    200   my ($code, $msg) = $dnsdb->addDomain($args{domain}, $args{group}, $args{state}, $args{location});
     200  my ($code, $msg) = $dnsdb->addDomain($args{domain}, $args{group}, $args{state}, $args{defloc});
    201201  die "$msg\n" if $code eq 'FAIL';
    202202  return $msg;  # domain ID
     
    208208  _commoncheck(\%args, 'y');
    209209  die "Need forward/reverse zone flag\n" if !$args{revrec};
     210  die "Need zone identifier\n" if !$args{zone};
    210211
    211212  my ($code,$msg);
     
    222223  die "$msg\n" if $code eq 'FAIL';
    223224  return $msg;
    224 }
     225} # delZone()
    225226
    226227#sub domainName {}
     
    246247  my ($code, $msg) = $dnsdb->addRDNS($args{revzone}, $args{revpatt}, $args{group}, $args{state}, $args{defloc});
    247248  die "$msg\n" if $code eq 'FAIL';
    248   return $msg;  # domain ID
     249  return $msg;  # zone ID
    249250}
    250251
     
    469470}
    470471
     472# The core sub uses references for some arguments to allow limited modification for
     473# normalization or type+zone matching/mapping/availability.
    471474sub rpc_addRec {
    472475  my %args = @_;
     
    835838  _reccheck(\%args);
    836839
    837   my ($code, $msg) = $dnsdb->delRec($args{defrec}, $args{recrev}, $args{id});
     840  my ($code, $msg) = $dnsdb->delRec($args{defrec}, $args{revrec}, $args{id});
    838841
    839842  die "$msg\n" if $code eq 'FAIL';
     
    849852  # unless the caller explicitly requested 'yes'
    850853  $args{delsubs} = 0 if $args{delsubs} ne 'y';
     854
     855  # Don't delete the A component of an A+PTR by default
     856  $args{delforward} = 0 if !$args{delforward};
    851857
    852858  # much like addOrUpdateRevRec()
     
    10151021  _commoncheck(\%args, 'y');
    10161022
    1017   my @arglist = ($args{zoneid});
     1023  $args{reverse} = 'n' if !$args{reverse} || $args{reverse} ne 'y';
     1024  my @arglist = ($args{zoneid}, $args{reverse});
    10181025  push @arglist, $args{status} if defined($args{status});
    10191026
Note: See TracChangeset for help on using the changeset viewer.