Changeset 91 for trunk/dns.cgi


Ignore:
Timestamp:
04/13/11 16:00:10 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

SQL tabledef update:

  • Tweak log table definition to cope with looooong entries (mainly from AXFR warnings)

DNSDB.pm:

  • Add domainID and getRecCount subs in DNSDB
  • Return more user-friendly error on attempting to add a domain with no name
  • Nitpick-tweak DB calls and SQL formatting in domainName()
  • Replace placeholderish OK message in importAXFR()

dns.cgi:

  • Trim some more direct SQL out in reclist
  • Uninitialized-variable cleanup in AXFR import
  • Add logging to AXFR import
  • Don't complain about uninitialized variables in record-display
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r90 r91  
    249249  $page->param(curpage => $webvar{page});
    250250
    251   my $sth = $dbh->prepare("SELECT count(*) FROM ".
    252         ($webvar{defrec} eq 'y' ? 'default_' : '')."records ".
    253         "WHERE ".($webvar{defrec} eq 'y' ? 'group' : 'domain')."_id=? ".
    254         "AND NOT type=$reverse_typemap{SOA}");
    255   $sth->execute($webvar{id});
    256   my ($count) = ($sth->fetchrow_array);
     251  my $count = getRecCount($dbh, $webvar{defrec}, $webvar{id});
    257252
    258253#  $sortby = 'host';
     
    919914  $page->param(importdoms => $webvar{importdoms}) if $webvar{importdoms};
    920915
    921 ##fixme: check group too?
     916  # shut up warning about uninitialized variable
     917  $webvar{doit} = '' if !defined($webvar{doit});
     918
    922919  if ($webvar{doit} eq 'y' && !$webvar{ifrom}) {
    923920    $page->param(errmsg => "Need to set host to import from");
    924921  } elsif ($webvar{doit} eq 'y' && !$webvar{importdoms}) {
    925922    $page->param(errmsg => "Need domains to import");
    926   } else {
     923  } elsif ($webvar{doit} eq 'y') {
    927924    my @domlist = split /\s+/, $webvar{importdoms};
    928925    my @results;
    929 my $rnum = 0;
    930926    foreach my $domain (@domlist) {
    931927      my %row;
    932928      my ($code,$msg) = importAXFR($dbh, $webvar{ifrom}, $domain, $webvar{group},
    933929        $webvar{domstatus}, $webvar{rwsoa}, $webvar{rwns});
    934 ##fixme: log
    935930      $row{domok} = $msg if $code eq 'OK';
    936931      if ($code eq 'WARN') {
     
    939934      }
    940935      if ($code eq 'FAIL') {
    941         $msg =~ s|\n|<br />|g;
     936        $msg =~ s|\n|<br />\n|g;
    942937        $row{domerr} = $msg;
    943938      }
    944       # do stuff!  DNSDB::importAXFR($webvar{ifrom}, $webvar{rwsoa}, $webvar{rwns}, $domain, <flags>)
     939      $msg = "<br />\n".$msg if $msg =~ m|<br />|;
     940      logaction(domainID($dbh, $domain), $session->param("username"), $webvar{group},
     941        "AXFR import $domain from $webvar{ifrom} ($code): $msg");
    945942      $row{domain} = $domain;
    946 #      $row{row} = $rnum++;
    947943      push @results, \%row;
    948944    }
     
    12241220sub fill_recdata {
    12251221  fill_rectypes($webvar{type});
     1222
     1223# le sigh.  we may get called with many empty %webvar keys
     1224  no warnings qw( uninitialized );
    12261225
    12271226  $page->param(name     => $webvar{name});
Note: See TracChangeset for help on using the changeset viewer.