Changeset 228
- Timestamp:
- 02/08/12 15:14:30 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r226 r228 132 132 ); 133 133 134 ## (Semi)private variables 135 # Hash of functions for validating record types. Filled in initGlobals() since 136 # it relies on visibility flags from the rectypes table in the DB 137 my %validators; 138 134 139 135 140 ## … … 228 233 # can't do nuttin' in forward zones 229 234 } # end _ipparent() 235 236 237 ## 238 ## Record validation subs. 239 ## 240 241 # A record 242 sub _validate_1 { 243 return ('OK','OK'); 244 } # done A record 245 246 # NS record 247 sub _validate_2 { 248 return ('OK','OK'); 249 } # done NS record 250 251 # CNAME record 252 sub _validate_5 { 253 return ('OK','OK'); 254 } # done CNAME record 255 256 # SOA record 257 sub _validate_6 { 258 return ('OK','OK'); 259 } # done SOA record 260 261 # PTR record 262 sub _validate_12 { 263 return ('OK','OK'); 264 } # done PTR record 265 266 # MX record 267 sub _validate_15 { 268 return ('OK','OK'); 269 } # done MX record 270 271 # TXT record 272 sub _validate_16 { 273 return ('OK','OK'); 274 } # done TXT record 275 276 # RP record 277 sub _validate_17 { 278 return ('OK','OK'); 279 } # done RP record 280 281 # AAAA record 282 sub _validate_28 { 283 return ('OK','OK'); 284 } # done AAAA record 285 286 # SRV record 287 sub _validate_33 { 288 return ('OK','OK'); 289 } # done SRV record 290 291 # Now the custom types 292 293 # A+PTR record 294 sub _validate_65280 { 295 return ('OK','OK'); 296 } # done A+PTR record 297 298 # AAAA+PTR record 299 sub _validate_65281 { 300 return ('OK','OK'); 301 } # done AAAA+PTR record 302 303 # PTR template record 304 sub _validate_65282 { 305 return ('OK','OK'); 306 } # done PTR template record 307 308 # A+PTR template record 309 sub _validate_65283 { 310 return ('OK','OK'); 311 } # done AAAA+PTR template record 312 313 # AAAA+PTR template record 314 sub _validate_65284 { 315 return ('OK','OK'); 316 } # done AAAA+PTR template record 317 318 230 319 231 320 ## … … 415 504 416 505 # load record types from database 417 my $sth = $dbh->prepare(" select val,name fromrectypes");506 my $sth = $dbh->prepare("SELECT val,name,stdflag FROM rectypes"); 418 507 $sth->execute; 419 while (my ($recval,$recname ) = $sth->fetchrow_array()) {508 while (my ($recval,$recname,$stdflag) = $sth->fetchrow_array()) { 420 509 $typemap{$recval} = $recname; 421 510 $reverse_typemap{$recname} = $recval; 511 # now we fill the record validation function hash 512 if ($stdflag < 5) { 513 my $fn = "_validate_$recval"; 514 $validators{$recval} = \&$fn; 515 } else { 516 my $fn = "sub { return ('FAIL','Type $recval ($recname) not supported'); }"; 517 $validators{$recval} = eval $fn; 518 } 422 519 } 423 520 } # end initGlobals
Note:
See TracChangeset
for help on using the changeset viewer.