Changeset 550
- Timestamp:
- 12/11/13 17:10:05 (11 years ago)
- Location:
- branches/stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/DNSDB.pm
r548 r550 3599 3599 # sort reverse zones on IP, correctly 3600 3600 # 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 3611 3601 # whee! multisort means just passing comma-separated fields in sortby! 3612 3602 my $newsort = ''; 3613 foreach my $sf (split /,/, $ order) {3603 foreach my $sf (split /,/, $args{sortby}) { 3614 3604 $sf = "r.$sf"; 3605 $sf =~ s/r\.val/CAST (r.val AS inet)/ 3606 if $args{revrec} eq 'y' && $args{defrec} eq 'n'; 3615 3607 $sf =~ s/r\.type/t.alphaorder/; 3616 3608 $newsort .= ",$sf"; … … 3629 3621 $sql .= " AND NOT r.type=$reverse_typemap{SOA}"; 3630 3622 $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}"; 3632 3624 # ensure consistent ordering by sorting on record_id too 3633 3625 $sql .= ", record_id $args{sortorder}"; … … 3706 3698 3707 3699 # 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') { 3711 3703 # 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+$//; 3714 3706 } 3715 3707 … … 3870 3862 3871 3863 # 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') { 3875 3867 # 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+$//; 3878 3870 } 3879 3871 … … 4677 4669 4678 4670 my $type = $rr->type; 4679 my $ttl = ($newttl ? $newttl : $rr->ttl); # allow force-override TTLs4680 4671 my $host = $rr->name; 4681 4672 my $ttl = ($args{newttl} ? $args{newttl} : $rr->ttl); # allow force-override TTLs -
branches/stable/textrecs.cgi
r548 r550 46 46 # shut up some warnings, in case we arrive somewhere we forgot to set this 47 47 $webvar{defrec} = 'n' if !$webvar{defrec}; # non-default records 48 #$webvar{revrec} = 'n' if !$webvar{revrec}; # non-reverse (domain) records48 $webvar{revrec} = 'n' if !$webvar{revrec}; # non-reverse (domain) records 49 49 50 50 my $dnsdb = new DNSDB; … … 70 70 print "Content-type: text/plain\n\n"; 71 71 print "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'; 72 print "Plaintext version of default ".($webvar{revrec} eq 'y' ? 'reverse ' : '')."records for $zone.\n" 73 if $webvar{defrec} eq 'y'; 73 74 print qq(Press the "Back" button to return to the standard record list.\n\n); 74 75
Note:
See TracChangeset
for help on using the changeset viewer.