- Timestamp:
- 04/24/14 14:48:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r616 r617 1118 1118 return ('OK','OK'); 1119 1119 } 1120 1121 # Subs not specific to a particular record type 1122 1123 # Convert $$host and/or $$val to lowercase as appropriate. 1124 # Should only be called if $self->{lowercase} is true. 1125 # $rectype is also a reference for caller convenience 1126 sub _caseclean { 1127 my ($rectype, $host, $val, $defrec, $revrec) = @_; 1128 1129 # Can't case-squash default records, due to DOMAIN, ZONE, and ADMINDOMAIN templating 1130 return if $defrec eq 'y'; 1131 1132 if ($typemap{$$rectype} eq 'TXT' || $typemap{$$rectype} eq 'SPF') { 1133 # TXT records should preserve user entry in the string. 1134 # SPF records are a duplicate of TXT with a new record type value (99) 1135 $$host = lc($$host) if $revrec eq 'n'; # only lowercase $$host on live forward TXT; preserve TXT content 1136 $$val = lc($$val) if $revrec eq 'y'; # only lowercase $$val on live reverse TXT; preserve TXT content 1137 } else { 1138 # Non-TXT, live records, are fully case-insensitive 1139 $$host = lc($$host); 1140 $$val = lc($$val); 1141 } # $typemap{$$rectype} else 1142 1143 } # _caseclean() 1120 1144 1121 1145 … … 1985 2009 $host =~ s/DOMAIN/$domain/g; 1986 2010 $val =~ s/DOMAIN/$domain/g; 2011 _caseclean(\$type, \$host, \$val, 'n', 'n') if $self->{lowercase}; 1987 2012 $sth_in->execute($host, $type, $val, $dist, $weight, $port, $ttl, $defloc); 1988 2013 if ($typemap{$type} eq 'SOA') { … … 2289 2314 } 2290 2315 } 2316 2317 _caseclean(\$type, \$host, \$val, 'n', 'y') if $self->{lowercase}; 2291 2318 2292 2319 $sth_in->execute($domid,$host,$type,$val,$ttl,$defloc); … … 3884 3911 } 3885 3912 3886 if ($self->{lowercase}) { 3887 if ($typemap{$$rectype} ne 'TXT') { 3888 $$host = lc($$host); 3889 $$val = lc($$val); 3890 } else { 3891 # TXT records should preserve user entry in the string. 3892 if ($revrec eq 'n') { 3893 $$host = lc($$host); 3894 } else { 3895 $$val = lc($$val); 3896 } 3897 } 3898 } 3913 _caseclean($rectype, $host, $val, $defrec, $revrec) if $self->{lowercase}; 3899 3914 3900 3915 # prep for validation … … 4045 4060 } 4046 4061 4047 if ($self->{lowercase}) { 4048 if ($typemap{$$rectype} ne 'TXT') { 4049 $$host = lc($$host); 4050 $$val = lc($$val); 4051 } else { 4052 # TXT records should preserve user entry in the string. 4053 if ($revrec eq 'n') { 4054 $$host = lc($$host); 4055 } else { 4056 $$val = lc($$val); 4057 } 4058 } 4059 } 4062 _caseclean($rectype, $host, $val, $defrec, $revrec) if $self->{lowercase}; 4060 4063 4061 4064 # prep for validation
Note:
See TracChangeset
for help on using the changeset viewer.