Changeset 288
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r287 r288 2515 2515 (id => $id, type => ($revrec eq 'n' ? 'domain' : 'revzone'), revrec => $revrec) ) 2516 2516 if $defrec eq 'n'; 2517 $logdata{entry} = "Added ".($defrec eq 'y' ? 'default record' : 'record')." '$$host $typemap{$$rectype} ";2517 $logdata{entry} = "Added ".($defrec eq 'y' ? 'default record' : 'record')." '$$host $typemap{$$rectype} $$val"; 2518 2518 $logdata{entry} .= " [distance $dist]" if $typemap{$$rectype} eq 'MX'; 2519 2519 $logdata{entry} .= " [priority $dist] [weight $weight] [port $port]" 2520 2520 if $typemap{$$rectype} eq 'SRV'; 2521 $logdata{entry} .= " $$val', TTL $ttl";2521 $logdata{entry} .= "', TTL $ttl"; 2522 2522 2523 2523 # Allow transactions, and raise an exception on errors so we can catch it later. … … 2584 2584 2585 2585 # only MX and SRV will use these 2586 my $dist = 0;2587 my $weight = 0;2588 my $port = 0;2586 my $dist = shift || 0; 2587 my $weight = shift || 0; 2588 my $port = shift || 0; 2589 2589 2590 2590 my $fields; … … 2631 2631 $fields .= "=?"; 2632 2632 2633 # Put together the success log entry. Horrible kludge from addRec() copied as-is since 2634 # we don't know whether the passed arguments or retrieved values for domain_id and rdns_id 2635 # will be maintained (due to "not-in-zone" validation changes) 2636 my %logdata; 2637 my @ftmp = split /,/, $fields; 2638 for (my $i=0; $i <= $#vallist; $i++) { 2639 $logdata{domain_id} = $vallist[$i] if $ftmp[$i] eq 'domain_id'; 2640 $logdata{rdns_id} = $vallist[$i] if $ftmp[$i] eq 'rdns_id'; 2641 } 2642 $logdata{group_id} = $parid if $defrec eq 'y'; 2643 $logdata{group_id} = parentID($dbh, 2644 (id => $parid, type => ($revrec eq 'n' ? 'domain' : 'revzone'), revrec => $revrec) ) 2645 if $defrec eq 'n'; 2646 $logdata{entry} = "Updated ".($defrec eq 'y' ? 'default record' : 'record')." from\n". 2647 "'$oldrec->{host} $typemap{$oldrec->{type}} $oldrec->{val}"; 2648 $logdata{entry} .= " [distance $oldrec->{distance}]" if $typemap{$oldrec->{type}} eq 'MX'; 2649 $logdata{entry} .= " [priority $oldrec->{distance}] [weight $oldrec->{weight}] [port $oldrec->{port}]" 2650 if $typemap{$oldrec->{type}} eq 'SRV'; 2651 $logdata{entry} .= "', TTL $oldrec->{ttl}\nto\n'$$host $typemap{$$rectype} $$val"; 2652 $logdata{entry} .= " [distance $dist]" if $typemap{$$rectype} eq 'MX'; 2653 $logdata{entry} .= " [priority $dist] [weight $weight] [port $port]" if $typemap{$$rectype} eq 'SRV'; 2654 $logdata{entry} .= "', TTL $ttl"; 2655 2633 2656 local $dbh->{AutoCommit} = 0; 2634 2657 local $dbh->{RaiseError} = 1; … … 2636 2659 eval { 2637 2660 $dbh->do("UPDATE "._rectable($defrec,$revrec)." SET $fields WHERE record_id=?", undef, (@vallist, $id) ); 2661 _log($dbh, %logdata); 2638 2662 $dbh->commit; 2639 2663 }; 2640 2664 if ($@) { 2641 2665 my $msg = $@; 2642 $dbh->rollback;2666 eval { $dbh->rollback; }; 2643 2667 return ('FAIL', $msg); 2644 2668 } 2645 2669 2670 $resultstr = $logdata{entry}; 2646 2671 return ($retcode, $retmsg); 2647 2672 } # end updateRec() -
trunk/dns.cgi
r287 r288 738 738 739 739 if ($code eq 'OK' || $code eq 'WARN') { 740 my $restr; 741 if ($webvar{defrec} eq 'y') { 742 $restr = "Updated default record from '$oldrec->{host} $typemap{$oldrec->{type}} $oldrec->{val}', TTL $oldrec->{ttl}\n". 743 "to '$webvar{name} $typemap{$webvar{type}} $webvar{address}', TTL $webvar{ttl}"; 744 logaction(0, $session->param("username"), $webvar{parentid}, $restr); 745 } else { 746 $restr = "Updated record from '$oldrec->{host} $typemap{$oldrec->{type}} $oldrec->{val}', TTL $oldrec->{ttl}\n". 747 "to '$webvar{name} $typemap{$webvar{type}} $webvar{address}', TTL $webvar{ttl}"; 748 logaction($webvar{parentid}, $session->param("username"), 749 parentID($dbh, (id => $webvar{id}, type => 'record', defrec => $webvar{defrec}, 750 revrec => $webvar{revrec}, partype => 'group')), 751 $restr); 752 } 753 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, 754 revrec => $webvar{revrec}, resultmsg => $restr, warnmsg => ($code ne 'OK' ? $msg : '')); 740 my %pageparams = (page => "reclist", id => $webvar{parentid}, 741 defrec => $webvar{defrec}, revrec => $webvar{revrec}); 742 $pageparams{warnmsg} = $msg."<br><br>\n".$DNSDB::resultstr if $code eq 'WARN'; 743 $pageparams{resultmsg} = $DNSDB::resultstr if $code eq 'OK'; 744 changepage(%pageparams); 755 745 } else { 756 746 $page->param(failed => 1);
Note:
See TracChangeset
for help on using the changeset viewer.