Changeset 768


Ignore:
Timestamp:
08/16/17 12:57:11 (7 years ago)
Author:
Kris Deugau
Message:

/trunk

Tighten some validation of numeric fields

  • TTL on all records
  • Distance, weight, and port for SRV, including a blurb about which field may have a bad character pasted
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r767 r768  
    983983  ${$args{weight}} =~ s/\s*//g;
    984984  ${$args{port}} =~ s/\s*//g;
    985   return ('FAIL',"Distance, port and weight are required, and must be numeric")
    986         unless ${$args{weight}} =~ /^\d+$/ && ${$args{port}} =~ /^\d+$/;
     985  my @ferr;
     986  push @ferr, "distance" unless ${$args{dist}} =~ /^\d+$/;
     987  push @ferr, "weight" unless ${$args{weight}} =~ /^\d+$/;
     988  push @ferr, "port" unless ${$args{port}} =~ /^\d+$/;
     989  return ('FAIL',"Distance, port and weight are required, and must be numeric (check ".join(",", @ferr).")")
     990        unless ${$args{dist}} =~ /^\d+$/ && ${$args{weight}} =~ /^\d+$/ && ${$args{port}} =~ /^\d+$/;
    987991
    988992  ${$args{fields}} = "distance,weight,port,";
     
    45084512
    45094513  # do simple validation first
     4514  $ttl = '' if !$ttl;
     4515  $ttl =~ s/\s*//g;
    45104516  return ('FAIL', "TTL must be numeric") unless $ttl =~ /^-?\d+$/;
    45114517
     
    46584664
    46594665  # do simple validation first
     4666  $ttl = '' if !$ttl;
     4667  $ttl =~ s/\s*//g;
    46604668  return ('FAIL', "TTL must be numeric") unless $ttl =~ /^-?\d+$/;
    46614669
Note: See TracChangeset for help on using the changeset viewer.