Changeset 667 for trunk


Ignore:
Timestamp:
10/09/14 13:43:07 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix subtle logging bug deleting a record; the log entry didn't get
associated with the right group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r666 r667  
    45444544## DNSDB::delRec()
    45454545# Delete a record. 
     4546# Takes a default/live flag, forward/reverse flag, and the ID of the record to delete.
    45464547sub delRec {
    45474548  $errstr = '';
     
    45644565  $logdata{rdns_id} = $oldrec->{rdns_id};
    45654566  $logdata{group_id} = $oldrec->{group_id} if $defrec eq 'y';
    4566   $logdata{group_id} = $self->parentID(id => $oldrec->{domain_id}, type => ($revrec eq 'n' ? 'domain' : 'revzone'),
    4567         revrec => $revrec)
     4567  $logdata{group_id} = $self->parentID(id => ($revrec eq 'n' ? $oldrec->{domain_id} : $oldrec->{rdns_id}),
     4568        type => 'domain', revrec => $revrec)
    45684569        if $defrec eq 'n';
    45694570  $logdata{entry} = "Deleted ".($defrec eq 'y' ? 'default record ' : 'record ').
     
    47654766  my %args = @_;
    47664767
    4767   # clean up the parent-type.  Set it to group if not set;  coerce revzone to domain for simpler logic
    4768   $args{partype} = 'group' if !$args{partype};
    4769   $args{partype} = 'domain' if $args{partype} eq 'revzone';
    4770 
    47714768  # clean up defrec and revrec.  default to live record, forward zone
    47724769  $args{defrec} = 'n' if !$args{defrec};
    47734770  $args{revrec} = 'n' if !$args{revrec};
    47744771
    4775   if ($par_type{$args{partype}} eq 'domain') {
     4772  # clean up the parent-type.  Set it to group if not set
     4773  $args{partype} = 'group' if !$args{partype};
     4774
     4775  # allow callers to be lazy with type
     4776  $args{type} = 'revzone' if $args{type} eq 'domain' && $args{revrec} eq 'y';
     4777
     4778  if ($par_type{$args{partype}} eq 'domain' || $par_type{$args{partype}} eq 'revzone') {
    47764779    # only live records can have a domain/zone parent
    47774780    return unless ($args{type} eq 'record' && $args{defrec} eq 'n');
Note: See TracChangeset for help on using the changeset viewer.