Changeset 550 for branches


Ignore:
Timestamp:
12/11/13 17:10:05 (10 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge reverse DNS and other updates, cleanup.

Crosscheck and clean up a few dangling bits that didn't get merged
correctly due to conflicts.

Location:
branches/stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/DNSDB.pm

    r548 r550  
    35993599  # sort reverse zones on IP, correctly
    36003600  # do other fiddling with $args{sortby} while we're at it.
    3601   $args{sortby} = "r.$args{sortby}";
    3602   $args{sortby} = 'CAST (r.val AS inet)'
    3603         if $args{revrec} eq 'y' && $args{defrec} eq 'n' && $args{sortby} eq 'r.val';
    3604   $args{sortby} = 't.alphaorder' if $args{sortby} eq 'r.type';
    3605 
    3606   my $sql = "SELECT r.record_id,r.host,r.type,r.val,r.ttl";
    3607   $sql .= ",l.description AS locname" if $args{defrec} eq 'n';
    3608   $sql .= ",r.distance,r.weight,r.port" if $args{revrec} eq 'n';
    3609   $sql .= " FROM "._rectable($args{defrec},$args{revrec})." r ";
    3610 
    36113601  # whee!  multisort means just passing comma-separated fields in sortby!
    36123602  my $newsort = '';
    3613   foreach my $sf (split /,/, $order) {
     3603  foreach my $sf (split /,/, $args{sortby}) {
    36143604    $sf = "r.$sf";
     3605    $sf =~ s/r\.val/CAST (r.val AS inet)/
     3606        if $args{revrec} eq 'y' && $args{defrec} eq 'n';
    36153607    $sf =~ s/r\.type/t.alphaorder/;
    36163608    $newsort .= ",$sf";
     
    36293621  $sql .= " AND NOT r.type=$reverse_typemap{SOA}";
    36303622  $sql .= " AND (r.host ~* ? OR r.val ~* ?)" if $args{filter};
    3631   $sql .= " ORDER BY $args{sortby} $args{sortorder}";
     3623  $sql .= " ORDER BY $newsort $args{sortorder}";
    36323624  # ensure consistent ordering by sorting on record_id too
    36333625  $sql .= ", record_id $args{sortorder}";
     
    37063698
    37073699  # Spaces are evil.
    3708   $host =~ s/^\s+//;
    3709   $host =~ s/\s+$//;
    3710   if ($typemap{$rectype} ne 'TXT') {
     3700  $$host =~ s/^\s+//;
     3701  $$host =~ s/\s+$//;
     3702  if ($typemap{$$rectype} ne 'TXT') {
    37113703    # Leading or trailng spaces could be legit in TXT records.
    3712     $val =~ s/^\s+//;
    3713     $val =~ s/\s+$//;
     3704    $$val =~ s/^\s+//;
     3705    $$val =~ s/\s+$//;
    37143706  }
    37153707
     
    38703862
    38713863  # Spaces are evil.
    3872   $host =~ s/^\s+//;
    3873   $host =~ s/\s+$//;
    3874   if ($typemap{$type} ne 'TXT') {
     3864  $$host =~ s/^\s+//;
     3865  $$host =~ s/\s+$//;
     3866  if ($typemap{$$rectype} ne 'TXT') {
    38753867    # Leading or trailng spaces could be legit in TXT records.
    3876     $val =~ s/^\s+//;
    3877     $val =~ s/\s+$//;
     3868    $$val =~ s/^\s+//;
     3869    $$val =~ s/\s+$//;
    38783870  }
    38793871
     
    46774669
    46784670      my $type = $rr->type;
    4679       my $ttl = ($newttl ? $newttl : $rr->ttl); # allow force-override TTLs
    46804671      my $host = $rr->name;
    46814672      my $ttl = ($args{newttl} ? $args{newttl} : $rr->ttl);     # allow force-override TTLs
  • branches/stable/textrecs.cgi

    r548 r550  
    4646# shut up some warnings, in case we arrive somewhere we forgot to set this
    4747$webvar{defrec} = 'n' if !$webvar{defrec};      # non-default records
    48 #$webvar{revrec} = 'n' if !$webvar{revrec};     # non-reverse (domain) records
     48$webvar{revrec} = 'n' if !$webvar{revrec};      # non-reverse (domain) records
    4949
    5050my $dnsdb = new DNSDB;
     
    7070print "Content-type: text/plain\n\n";
    7171print "Plaintext version of records for $zone.\n" if $webvar{defrec} eq 'n';
    72 print "Plaintext version of default records for $zone.\n" if $webvar{defrec} eq 'y';
     72print "Plaintext version of default ".($webvar{revrec} eq 'y' ? 'reverse ' : '')."records for $zone.\n"
     73        if $webvar{defrec} eq 'y';
    7374print qq(Press the "Back" button to return to the standard record list.\n\n);
    7475
Note: See TracChangeset for help on using the changeset viewer.