Changeset 231


Ignore:
Timestamp:
02/09/12 15:29:12 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Add info comments in TXT and RP validation subs; TXT records are

freeform, RP are arguably obsolete and not shown for new records
anyway.

Fill out SRV validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r230 r231  
    345345# TXT record
    346346sub _validate_16 {
     347  # Could arguably put a WARN return here on very long (>512) records
    347348  return ('OK','OK');
    348349} # done TXT record
     
    350351# RP record
    351352sub _validate_17 {
     353  # Probably have to validate these some day
    352354  return ('OK','OK');
    353355} # done RP record
     
    377379# SRV record
    378380sub _validate_33 {
     381  my $dbh = shift;
     382
     383  my %args = @_;
     384
     385# Not absolutely true but WTF use is an SRV record for a reverse zone?
     386  return ('FAIL', 'Reverse zones cannot contain SRV records') if $args{revrec} eq 'y';
     387
     388  return ('FAIL', "Distance is required for SRV records") unless defined(${$args{dist}});
     389  ${$args{dist}} =~ s/\s*//g;
     390  return ('FAIL',"Distance is required, and must be numeric") unless ${$args{dist}} =~ /^\d+$/;
     391
     392  return ('FAIL',"SRV records must begin with _service._protocol [${$args{host}}]")
     393        unless ${$args{host}} =~ /^_[A-Za-z]+\._[A-Za-z]+\.[a-zA-Z0-9-]+/;
     394  return ('FAIL',"Port and weight are required for SRV records")
     395        unless defined(${$args{weight}}) && defined(${$args{port}});
     396  ${$args{weight}} =~ s/\s*//g;
     397  ${$args{port}} =~ s/\s*//g;
     398
     399  return ('FAIL',"Port and weight are required, and must be numeric")
     400        unless ${$args{weight}} =~ /^\d+$/ && ${$args{port}} =~ /^\d+$/;
     401
     402  ${$args{fields}} = "distance,weight,port,";
     403  push @{$args{vallist}}, (${$args{dist}}, ${$args{weight}}, ${$args{port}});
     404
     405  # Coerce all hostnames to end in ".DOMAIN" for group/default records,
     406  # or the intended parent domain for live records.
     407  my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : domainName($dbh,$args{id}));
     408  ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;
     409
    379410  return ('OK','OK');
    380411} # done SRV record
Note: See TracChangeset for help on using the changeset viewer.