Changeset 107 for trunk


Ignore:
Timestamp:
07/19/11 16:50:08 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix mishandling of record data retrieved before deleting said record.
Tweak logging on record deletion - probably failing due to

mishandling the retrieval.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r105 r107  
    10331033  delete $ret->{longrec_id};    # remove these since they shouldn't be exposed - the caller
    10341034  delete $ret->{recdata};       # should not care about "long records" vs normal ones.
     1035  $ret->{parid} = (($def eq 'def' or $def eq 'y') ? $ret->{group_id} : $ret->{domain_id});
    10351036
    10361037  return $ret;
  • trunk/dns.cgi

    r101 r107  
    449449  if (!defined($webvar{del})) {
    450450    $page->param(del_getconf => 1);
    451     my %rec = getRecLine($dbh,$webvar{defrec},$webvar{id});
    452     $page->param(host => $rec{host});
    453     $page->param(ftype => $typemap{$rec{type}});
    454     $page->param(recval => $rec{val});
     451    my $rec = getRecLine($dbh,$webvar{defrec},$webvar{id});
     452    $page->param(host => $rec->{host});
     453    $page->param(ftype => $typemap{$rec->{type}});
     454    $page->param(recval => $rec->{val});
    455455  } elsif ($webvar{del} eq 'ok') {
    456456# get rec data before we try to delete it
    457     my %rec = getRecLine($dbh,$webvar{defrec},$webvar{id});
     457    my $rec = getRecLine($dbh,$webvar{defrec},$webvar{id});
    458458    my ($code,$msg) = delRec($dbh,$webvar{defrec},$webvar{id});
    459459    if ($code ne 'OK') {
    460460## need to find failure mode
    461461      if ($webvar{defrec} eq 'y') {
    462         logaction(0, $session->param("username"), $rec{parid},
    463                 "Failed deleting default record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl} ($msg)");
     462        logaction(0, $session->param("username"), $rec->{parid},
     463                "Failed deleting default record '$rec->{host} $typemap{$rec->{type}} $rec->{val}',".
     464                " TTL $rec->{ttl} ($msg)");
    464465      } else {
    465         logaction($rec{parid}, $session->param("username"), parentID($rec{parid}, 'dom', 'group'),
    466                 "Failed deleting record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl} ($msg)");
     466        logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'),
     467                "Failed deleting record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl} ($msg)");
    467468      }
    468469      changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec},
     
    473474    } else {
    474475      if ($webvar{defrec} eq 'y') {
    475         logaction(0, $session->param("username"), $rec{parid},
    476                 "Deleted default record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl}");
     476        logaction(0, $session->param("username"), $rec->{parid},
     477                "Deleted default record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}");
    477478      } else {
    478         logaction($rec{parid}, $session->param("username"), parentID($rec{parid}, 'dom', 'group'),
    479                 "Deleted record '$rec{host} $typemap{$rec{type}} $rec{val}', TTL $rec{ttl}");
     479        logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'),
     480                "Deleted record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}");
    480481      }
    481482      changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec});
     
    16881689
    16891690  $sth = $dbh->prepare("INSERT INTO log (domain_id,user_id,group_id,email,name,entry) ".
    1690         "VALUES (?,?,?,?,?,?)");
    1691   $sth->execute($domid,$user_id,$groupid,$username,$fullname,$entry);
     1691        "VALUES (?,?,?,?,?,?)") or warn $dbh->errstr;
     1692  $sth->execute($domid,$user_id,$groupid,$username,$fullname,$entry) or warn $sth->errstr;
    16921693} # end logaction()
    16931694
Note: See TracChangeset for help on using the changeset viewer.