Changeset 195 for trunk/dns.cgi
- Timestamp:
- 12/12/11 17:52:55 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r193 r195 350 350 changepage(page => "reclist", id => $msg); 351 351 } else { 352 logaction(0, $session->param("username"), $webvar{group}, "Failed adding domain $webvar{domain} ($msg)"); 352 logaction(0, $session->param("username"), $webvar{group}, "Failed adding domain $webvar{domain} ($msg)") 353 if $config{log_failures}; 353 354 $session->param('add_failed', 1); 354 355 ##fixme: domain a security risk for XSS? … … 383 384 changepage(page => "domlist", resultmsg => "Deleted domain $dom"); 384 385 } else { 385 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom ($msg)"); 386 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom ($msg)") 387 if $config{log_failures}; 386 388 changepage(page => "domlist", errmsg => "Error deleting domain $dom: $msg"); 387 389 } … … 520 522 if ($webvar{defrec} eq 'y') { 521 523 my $restr = "Added default record '$webvar{name} $typemap{$webvar{type}}"; 522 $restr .= " [distance $dist]" if $typemap{$webvar{type}} eq 'MX'; 523 $restr .= " [priority $dist] [weight $weight] [port $port]" if $typemap{$webvar{type}} eq 'SRV'; 524 $restr .= " [distance $webvar{distance}]" if $typemap{$webvar{type}} eq 'MX'; 525 $restr .= " [priority $webvar{distance}] [weight $webvar{weight}] [port $webvar{port}]" 526 if $typemap{$webvar{type}} eq 'SRV'; 524 527 $restr .= " $webvar{address}', TTL $webvar{ttl}"; 525 528 logaction(0, $session->param("username"), $webvar{parentid}, $restr); 526 529 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, resultmsg => $restr); 527 530 } else { 528 my $restr = "Added record '$webvar{name} $typemap{$webvar{type}}". 529 $restr .= " [distance $dist]" if $typemap{$webvar{type}} eq 'MX'; 530 $restr .= " [priority $dist] [weight $weight] [port $port]" if $typemap{$webvar{type}} eq 'SRV'; 531 my $restr = "Added record '$webvar{name} $typemap{$webvar{type}}"; 532 $restr .= " [distance $webvar{dist}]" if $typemap{$webvar{type}} eq 'MX'; 533 $restr .= " [priority $webvar{dist}] [weight $webvar{weight}] [port $webvar{port}]" 534 if $typemap{$webvar{type}} eq 'SRV'; 531 535 $restr .= " $webvar{address}', TTL $webvar{ttl}"; 532 536 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'), $restr); … … 543 547 $page->param(id => $webvar{id}); 544 548 fill_recdata(); # populate the form... er, mostly. 545 if ($webvar{defrec} eq 'y') { 546 logaction(0, $session->param("username"), $webvar{parentid}, 549 if ($config{log_failures}) { 550 if ($webvar{defrec} eq 'y') { 551 logaction(0, $session->param("username"), $webvar{parentid}, 547 552 "Failed adding default record '$webvar{name} $typemap{$webvar{type}} $webvar{address}', TTL $webvar{ttl} ($msg)"); 548 549 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'),553 } else { 554 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'), 550 555 "Failed adding record '$webvar{name} $typemap{$webvar{type}} $webvar{address}', TTL $webvar{ttl} ($msg)"); 556 } 551 557 } 552 558 } … … 610 616 $page->param(id => $webvar{id}); 611 617 fill_recdata(); 612 if ($webvar{defrec} eq 'y') { 613 logaction(0, $session->param("username"), $webvar{parentid}, 618 if ($config{log_failures}) { 619 if ($webvar{defrec} eq 'y') { 620 logaction(0, $session->param("username"), $webvar{parentid}, 614 621 "Failed updating default record '$typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl} ($msg)"); 615 616 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'),622 } else { 623 logaction($webvar{parentid}, $session->param("username"), parentID($webvar{parentid}, 'dom', 'group'), 617 624 "Failed updating record '$typemap{$webvar{type}} $webvar{name} $webvar{address}', TTL $webvar{ttl} ($msg)"); 625 } 618 626 } 619 627 } … … 669 677 } else { 670 678 ## need to find failure mode 671 if ($webvar{defrec} eq 'y') { 672 logaction(0, $session->param("username"), $rec->{parid}, 679 if ($config{log_failures}) { 680 if ($webvar{defrec} eq 'y') { 681 logaction(0, $session->param("username"), $rec->{parid}, 673 682 "Failed deleting default record '$rec->{host} $typemap{$rec->{type}} $rec->{val}',". 674 683 " TTL $rec->{ttl} ($msg)"); 675 676 logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'),684 } else { 685 logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'), 677 686 "Failed deleting record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl} ($msg)"); 687 } 678 688 } 679 689 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, … … 740 750 $page->param(msg => $DBI::errstr); 741 751 fillsoa($webvar{defrec},$webvar{id}); 752 ##fixme: faillog 742 753 } else { 743 754 … … 820 831 } 821 832 } # fallthrough else 822 logaction(0, $session->param("username"), $webvar{pargroup}, "Failed to add group $webvar{newgroup}: $msg"); 833 logaction(0, $session->param("username"), $webvar{pargroup}, "Failed to add group $webvar{newgroup}: $msg") 834 if $config{log_failures}; 823 835 # no point in doing extra work 824 836 fill_permissions($page, \%newperms); … … 864 876 } else { 865 877 # need to find failure mode 866 logaction(0, $session->param("username"), $delparent, "Failed to delete group $deleteme: $msg"); 878 logaction(0, $session->param("username"), $delparent, "Failed to delete group $deleteme: $msg") 879 if $config{log_failures}; 867 880 changepage(page => "grpman", errmsg => "Error deleting group $deleteme: $msg"); 868 881 } … … 913 926 } # fallthrough else 914 927 logaction(0, $session->param("username"), $webvar{gid}, "Failed to update default permissions in group ". 915 groupName($dbh, $webvar{gid}).": $msg"); 928 groupName($dbh, $webvar{gid}).": $msg") 929 if $config{log_failures}; 916 930 # no point in doing extra work 917 931 fill_permissions($page, \%chperms); … … 1002 1016 } else { 1003 1017 logaction($webvar{$_}, $session->param("username"), parentID($webvar{$_}, 'dom', 'group'), 1004 "Failed to move domain ".domainName($dbh, $webvar{$_})." to group $newgname: $msg"); 1018 "Failed to move domain ".domainName($dbh, $webvar{$_})." to group $newgname: $msg") 1019 if $config{log_failures}; 1005 1020 } 1006 1021 $row{domerr} = $msg; … … 1059 1074 $row{domok} = ($code eq 'OK'); 1060 1075 } else { 1061 logaction($webvar{$_}, $session->param("username"), $pargroup, "Failed to delete domain $dom: $msg"); 1076 logaction($webvar{$_}, $session->param("username"), $pargroup, "Failed to delete domain $dom: $msg") 1077 if $config{log_failures}; 1062 1078 } 1063 1079 $row{domerr} = $msg; … … 1251 1267 fill_clonemelist(); 1252 1268 logaction(0, $session->param("username"), $curgroup, "Failed to $webvar{action} user ". 1253 "$webvar{uname}: $msg"); 1269 "$webvar{uname}: $msg") 1270 if $config{log_failures}; 1254 1271 } 1255 1272 … … 1330 1347 list_users($curgroup); 1331 1348 logaction(0, $session->param("username"), $curgroup, "Failed to delete user ". 1332 "$webvar{id}/".$userref->{username}.": $msg"); 1349 "$webvar{id}/".$userref->{username}.": $msg") 1350 if $config{log_failures}; 1333 1351 } 1334 1352 } else {
Note:
See TracChangeset
for help on using the changeset viewer.