| 1 | package Zonemaster::Test::Syntax v1.0.1; | ||
| 2 | |||
| 3 | use 5.14.2; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | use Zonemaster; | ||
| 8 | use Zonemaster::Util; | ||
| 9 | use Zonemaster::Recursor; | ||
| 10 | use Zonemaster::DNSName; | ||
| 11 | use Zonemaster::TestMethods; | ||
| 12 | use Zonemaster::Constants qw[:name]; | ||
| 13 | |||
| 14 | use Carp; | ||
| 15 | |||
| 16 | use List::MoreUtils qw[uniq none any]; | ||
| 17 | use Mail::RFC822::Address qw[valid]; | ||
| 18 | use Time::Local; | ||
| 19 | |||
| 20 | ### | ||
| 21 | ### Entry points | ||
| 22 | ### | ||
| 23 | |||
| 24 | sub all { | ||
| 25 | my ( $class, $zone ) = @_; | ||
| 26 | my @results; | ||
| 27 | |||
| 28 | push @results, $class->syntax01( $zone->name ) if Zonemaster->config->should_run('syntax01'); | ||
| 29 | push @results, $class->syntax02( $zone->name ) if Zonemaster->config->should_run('syntax02'); | ||
| 30 | push @results, $class->syntax03( $zone->name ) if Zonemaster->config->should_run('syntax03'); | ||
| 31 | |||
| 32 | if ( any { $_->tag eq q{ONLY_ALLOWED_CHARS} } @results ) { | ||
| 33 | |||
| 34 | foreach my $local_nsname ( uniq map { $_->string } @{ Zonemaster::TestMethods->method2( $zone ) }, | ||
| 35 | @{ Zonemaster::TestMethods->method3( $zone ) } ) | ||
| 36 | { | ||
| 37 | push @results, $class->syntax04( $local_nsname ) if Zonemaster->config->should_run('syntax04'); | ||
| 38 | } | ||
| 39 | |||
| 40 | push @results, $class->syntax05( $zone ) if Zonemaster->config->should_run('syntax05'); | ||
| 41 | |||
| 42 | if ( none { $_->tag eq q{NO_RESPONSE_SOA_QUERY} } @results ) { | ||
| 43 | push @results, $class->syntax06( $zone ) if Zonemaster->config->should_run('syntax06'); | ||
| 44 | push @results, $class->syntax07( $zone ) if Zonemaster->config->should_run('syntax07'); | ||
| 45 | } | ||
| 46 | |||
| 47 | push @results, $class->syntax08( $zone ) if Zonemaster->config->should_run('syntax08'); | ||
| 48 | |||
| 49 | } | ||
| 50 | |||
| 51 | return @results; | ||
| 52 | } ## end sub all | ||
| 53 | |||
| 54 | ### | ||
| 55 | ### Metadata Exposure | ||
| 56 | ### | ||
| 57 | |||
| 58 | sub metadata { | ||
| 59 | my ( $class ) = @_; | ||
| 60 | |||
| 61 | return { | ||
| 62 | syntax01 => [ | ||
| 63 | qw( | ||
| 64 | ONLY_ALLOWED_CHARS | ||
| 65 | NON_ALLOWED_CHARS | ||
| 66 | ) | ||
| 67 | ], | ||
| 68 | syntax02 => [ | ||
| 69 | qw( | ||
| 70 | INITIAL_HYPHEN | ||
| 71 | TERMINAL_HYPHEN | ||
| 72 | NO_ENDING_HYPHENS | ||
| 73 | ) | ||
| 74 | ], | ||
| 75 | syntax03 => [ | ||
| 76 | qw( | ||
| 77 | DISCOURAGED_DOUBLE_DASH | ||
| 78 | NO_DOUBLE_DASH | ||
| 79 | ) | ||
| 80 | ], | ||
| 81 | syntax04 => [ | ||
| 82 | qw( | ||
| 83 | NAMESERVER_DISCOURAGED_DOUBLE_DASH | ||
| 84 | NAMESERVER_NON_ALLOWED_CHARS | ||
| 85 | NAMESERVER_NUMERIC_TLD | ||
| 86 | NAMESERVER_SYNTAX_OK | ||
| 87 | ) | ||
| 88 | ], | ||
| 89 | syntax05 => [ | ||
| 90 | qw( | ||
| 91 | RNAME_MISUSED_AT_SIGN | ||
| 92 | RNAME_NO_AT_SIGN | ||
| 93 | NO_RESPONSE_SOA_QUERY | ||
| 94 | ) | ||
| 95 | ], | ||
| 96 | syntax06 => [ | ||
| 97 | qw( | ||
| 98 | RNAME_RFC822_INVALID | ||
| 99 | NO_RESPONSE_SOA_QUERY | ||
| 100 | ) | ||
| 101 | ], | ||
| 102 | syntax07 => [ | ||
| 103 | qw( | ||
| 104 | MNAME_DISCOURAGED_DOUBLE_DASH | ||
| 105 | MNAME_NON_ALLOWED_CHARS | ||
| 106 | MNAME_NUMERIC_TLD | ||
| 107 | MNAME_SYNTAX_OK | ||
| 108 | NO_RESPONSE_SOA_QUERY | ||
| 109 | ) | ||
| 110 | ], | ||
| 111 | syntax08 => [ | ||
| 112 | qw( | ||
| 113 | MX_DISCOURAGED_DOUBLE_DASH | ||
| 114 | MX_NON_ALLOWED_CHARS | ||
| 115 | MX_NUMERIC_TLD | ||
| 116 | MX_SYNTAX_OK | ||
| 117 | NO_RESPONSE_MX_QUERY | ||
| 118 | ) | ||
| 119 | ], | ||
| 120 | }; | ||
| 121 | } ## end sub metadata | ||
| 122 | |||
| 123 | sub translation { | ||
| 124 | return { | ||
| 125 | 'NAMESERVER_DISCOURAGED_DOUBLE_DASH' => | ||
| 126 | 'Nameserver ({name}) has a label ({label}) with a double hyphen (\'--\') in position 3 and 4 (with a prefix which is not \'xn--\').', | ||
| 127 | 'NAMESERVER_NON_ALLOWED_CHARS' => 'Found illegal characters in the nameserver ({name}).', | ||
| 128 | 'NAMESERVER_NUMERIC_TLD' => 'Nameserver ({name}) within a \'numeric only\' TLD ({tld}).', | ||
| 129 | 'NAMESERVER_SYNTAX_OK' => 'Nameserver ({name}) syntax is valid.', | ||
| 130 | 'MNAME_DISCOURAGED_DOUBLE_DASH' => | ||
| 131 | 'SOA MNAME ({name}) has a label ({label}) with a double hyphen (\'--\') in position 3 and 4 (with a prefix which is not \'xn--\').', | ||
| 132 | 'MNAME_NON_ALLOWED_CHARS' => 'Found illegal characters in SOA MNAME ({name}).', | ||
| 133 | 'MNAME_NUMERIC_TLD' => 'SOA MNAME ({name}) within a \'numeric only\' TLD ({tld}).', | ||
| 134 | 'MNAME_SYNTAX_OK' => 'SOA MNAME ({name}) syntax is valid.', | ||
| 135 | 'MX_DISCOURAGED_DOUBLE_DASH' => | ||
| 136 | 'Domain name MX ({name}) has a label ({label}) with a double hyphen (\'--\') in position 3 and 4 (with a prefix which is not \'xn--\').', | ||
| 137 | 'MX_NON_ALLOWED_CHARS' => 'Found illegal characters in MX ({name}).', | ||
| 138 | 'MX_NUMERIC_TLD' => 'Domain name MX ({name}) within a \'numeric only\' TLD ({tld}).', | ||
| 139 | 'MX_SYNTAX_OK' => 'Domain name MX ({name}) syntax is valid.', | ||
| 140 | 'DISCOURAGED_DOUBLE_DASH' => | ||
| 141 | 'Domain name ({name}) has a label ({label}) with a double hyphen (\'--\') in position 3 and 4 (with a prefix which is not \'xn--\').', | ||
| 142 | 'INITIAL_HYPHEN' => 'Domain name ({name}) has a label ({label}) starting with an hyphen (\'-\').', | ||
| 143 | 'TERMINAL_HYPHEN' => 'Domain name ({name}) has a label ({label}) ending with an hyphen (\'-\').', | ||
| 144 | 'NON_ALLOWED_CHARS' => 'Found illegal characters in the domain name ({name}).', | ||
| 145 | 'ONLY_ALLOWED_CHARS' => 'No illegal characters in the domain name ({name}).', | ||
| 146 | 'RNAME_MISUSED_AT_SIGN' => 'There must be no misused \'@\' character in the SOA RNAME field ({rname}).', | ||
| 147 | 'RNAME_RFC822_INVALID' => 'There must be no illegal characters in the SOA RNAME field ({rname}).', | ||
| 148 | 'RNAME_RFC822_VALID' => 'The SOA RNAME field ({rname}) is compliant with RFC2822.', | ||
| 149 | 'NO_ENDING_HYPHENS' => 'Both ends of all labels of the domain name ({name}) have no hyphens.', | ||
| 150 | 'NO_DOUBLE_DASH' => | ||
| 151 | 'Domain name ({name}) has no label with a double hyphen (\'--\') in position 3 and 4 (with a prefix which is not \'xn--\').', | ||
| 152 | 'RNAME_NO_AT_SIGN' => 'There is no misused \'@\' character in the SOA RNAME field ({rname}).', | ||
| 153 | 'NO_RESPONSE_SOA_QUERY' => 'No response from nameserver(s) on SOA queries.', | ||
| 154 | 'NO_RESPONSE_MX_QUERY' => 'No response from nameserver(s) on MX queries.', | ||
| 155 | }; | ||
| 156 | } ## end sub translation | ||
| 157 | |||
| 158 | sub version { | ||
| 159 | return "$Zonemaster::Test::Syntax::VERSION"; | ||
| 160 | } | ||
| 161 | |||
| 162 | ### | ||
| 163 | ### Tests | ||
| 164 | ### | ||
| 165 | |||
| 166 | sub syntax01 { | ||
| 167 | my ( $class, $item ) = @_; | ||
| 168 | my @results; | ||
| 169 | |||
| 170 | my $name = get_name( $item ); | ||
| 171 | |||
| 172 | if ( _name_has_only_legal_characters( $name ) ) { | ||
| 173 | push @results, | ||
| 174 | info( | ||
| 175 | ONLY_ALLOWED_CHARS => { | ||
| 176 | name => $name, | ||
| 177 | } | ||
| 178 | ); | ||
| 179 | } | ||
| 180 | else { | ||
| 181 | push @results, | ||
| 182 | info( | ||
| 183 | NON_ALLOWED_CHARS => { | ||
| 184 | name => $name, | ||
| 185 | } | ||
| 186 | ); | ||
| 187 | } | ||
| 188 | |||
| 189 | return @results; | ||
| 190 | } ## end sub syntax01 | ||
| 191 | |||
| 192 | sub syntax02 { | ||
| 193 | my ( $class, $item ) = @_; | ||
| 194 | my @results; | ||
| 195 | |||
| 196 | my $name = get_name( $item ); | ||
| 197 | |||
| 198 | foreach my $local_label ( @{ $name->labels } ) { | ||
| 199 | if ( _label_starts_with_hyphen( $local_label ) ) { | ||
| 200 | push @results, | ||
| 201 | info( | ||
| 202 | INITIAL_HYPHEN => { | ||
| 203 | label => $local_label, | ||
| 204 | name => $name, | ||
| 205 | } | ||
| 206 | ); | ||
| 207 | } | ||
| 208 | if ( _label_ends_with_hyphen( $local_label ) ) { | ||
| 209 | push @results, | ||
| 210 | info( | ||
| 211 | TERMINAL_HYPHEN => { | ||
| 212 | label => $local_label, | ||
| 213 | name => $name, | ||
| 214 | } | ||
| 215 | ); | ||
| 216 | } | ||
| 217 | } ## end foreach my $local_label ( @...) | ||
| 218 | |||
| 219 | if ( scalar @{ $name->labels } and not scalar @results ) { | ||
| 220 | push @results, | ||
| 221 | info( | ||
| 222 | NO_ENDING_HYPHENS => { | ||
| 223 | name => $name, | ||
| 224 | } | ||
| 225 | ); | ||
| 226 | } | ||
| 227 | |||
| 228 | return @results; | ||
| 229 | } ## end sub syntax02 | ||
| 230 | |||
| 231 | sub syntax03 { | ||
| 232 | my ( $class, $item ) = @_; | ||
| 233 | my @results; | ||
| 234 | |||
| 235 | my $name = get_name( $item ); | ||
| 236 | |||
| 237 | foreach my $local_label ( @{ $name->labels } ) { | ||
| 238 | if ( _label_not_ace_has_double_hyphen_in_position_3_and_4( $local_label ) ) { | ||
| 239 | push @results, | ||
| 240 | info( | ||
| 241 | DISCOURAGED_DOUBLE_DASH => { | ||
| 242 | label => $local_label, | ||
| 243 | name => $name, | ||
| 244 | } | ||
| 245 | ); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | |||
| 249 | if ( scalar @{ $name->labels } and not scalar @results ) { | ||
| 250 | push @results, | ||
| 251 | info( | ||
| 252 | NO_DOUBLE_DASH => { | ||
| 253 | name => $name, | ||
| 254 | } | ||
| 255 | ); | ||
| 256 | } | ||
| 257 | |||
| 258 | return @results; | ||
| 259 | } ## end sub syntax03 | ||
| 260 | |||
| 261 | sub syntax04 { | ||
| 262 | my ( $class, $item ) = @_; | ||
| 263 | my @results; | ||
| 264 | |||
| 265 | my $name = get_name( $item ); | ||
| 266 | |||
| 267 | push @results, check_name_syntax( q{NAMESERVER}, $name ); | ||
| 268 | |||
| 269 | return @results; | ||
| 270 | } | ||
| 271 | |||
| 272 | sub syntax05 { | ||
| 273 | my ( $class, $zone ) = @_; | ||
| 274 | my @results; | ||
| 275 | |||
| 276 | my $p = $zone->query_one( $zone->name, q{SOA} ); | ||
| 277 | |||
| 278 | if ( $p and my ( $soa ) = $p->get_records( q{SOA}, q{answer} ) ) { | ||
| 279 | my $rname = $soa->rname; | ||
| 280 | $rname =~ s/\\./\./smgx; | ||
| 281 | if ( index( $rname, q{@} ) != -1 ) { | ||
| 282 | push @results, | ||
| 283 | info( | ||
| 284 | RNAME_MISUSED_AT_SIGN => { | ||
| 285 | rname => $soa->rname, | ||
| 286 | } | ||
| 287 | ); | ||
| 288 | } | ||
| 289 | else { | ||
| 290 | push @results, | ||
| 291 | info( | ||
| 292 | RNAME_NO_AT_SIGN => { | ||
| 293 | rname => $soa->rname, | ||
| 294 | } | ||
| 295 | ); | ||
| 296 | } | ||
| 297 | } ## end if ( $p and my ( $soa ...)) | ||
| 298 | else { | ||
| 299 | push @results, info( NO_RESPONSE_SOA_QUERY => {} ); | ||
| 300 | } | ||
| 301 | |||
| 302 | return @results; | ||
| 303 | } ## end sub syntax05 | ||
| 304 | |||
| 305 | sub syntax06 { | ||
| 306 | my ( $class, $zone ) = @_; | ||
| 307 | my @results; | ||
| 308 | |||
| 309 | my $p = $zone->query_one( $zone->name, q{SOA} ); | ||
| 310 | |||
| 311 | if ( $p and my ( $soa ) = $p->get_records( q{SOA}, q{answer} ) ) { | ||
| 312 | my $rname = $soa->rname; | ||
| 313 | $rname =~ s/([^\\])[.]/$1@/smx; # Replace first non-escaped dot with an at-sign | ||
| 314 | $rname =~ s/[\\][.]/./smgx; # Un-escape dots | ||
| 315 | $rname =~ s/[.]\z//smgx; # Validator does not like final dots | ||
| 316 | if ( not valid( $rname ) ) { | ||
| 317 | push @results, | ||
| 318 | info( | ||
| 319 | RNAME_RFC822_INVALID => { | ||
| 320 | rname => $rname, | ||
| 321 | } | ||
| 322 | ); | ||
| 323 | } | ||
| 324 | else { | ||
| 325 | push @results, | ||
| 326 | info( | ||
| 327 | RNAME_RFC822_VALID => { | ||
| 328 | rname => $rname, | ||
| 329 | } | ||
| 330 | ); | ||
| 331 | } | ||
| 332 | } ## end if ( $p and my ( $soa ...)) | ||
| 333 | else { | ||
| 334 | push @results, info( NO_RESPONSE_SOA_QUERY => {} ); | ||
| 335 | } | ||
| 336 | return @results; | ||
| 337 | } ## end sub syntax06 | ||
| 338 | |||
| 339 | sub syntax07 { | ||
| 340 | my ( $class, $zone ) = @_; | ||
| 341 | my @results; | ||
| 342 | |||
| 343 | my $p = $zone->query_one( $zone->name, q{SOA} ); | ||
| 344 | |||
| 345 | if ( $p and my ( $soa ) = $p->get_records( q{SOA}, q{answer} ) ) { | ||
| 346 | my $mname = $soa->mname; | ||
| 347 | |||
| 348 | push @results, check_name_syntax( q{MNAME}, $mname ); | ||
| 349 | } | ||
| 350 | else { | ||
| 351 | push @results, info( NO_RESPONSE_SOA_QUERY => {} ); | ||
| 352 | } | ||
| 353 | |||
| 354 | return @results; | ||
| 355 | } | ||
| 356 | |||
| 357 | sub syntax08 { | ||
| 358 | my ( $class, $zone ) = @_; | ||
| 359 | my @results; | ||
| 360 | |||
| 361 | my $p = $zone->query_one( $zone->name, q{MX} ); | ||
| 362 | |||
| 363 | if ( $p ) { | ||
| 364 | foreach my $mx ( sort keys %{ { map { $_->exchange => 1 } $p->get_records( q{MX}, q{answer} ) } } ) { | ||
| 365 | push @results, check_name_syntax( q{MX}, $mx ); | ||
| 366 | } | ||
| 367 | } | ||
| 368 | else { | ||
| 369 | push @results, info( NO_RESPONSE_MX_QUERY => {} ); | ||
| 370 | } | ||
| 371 | |||
| 372 | return @results; | ||
| 373 | } | ||
| 374 | |||
| 375 | ### | ||
| 376 | ### Internal Tests with Boolean (0|1) return value. | ||
| 377 | ### | ||
| 378 | |||
| 379 | sub _name_has_only_legal_characters { | ||
| 380 | my ( $name ) = @_; | ||
| 381 | |||
| 382 | if ( List::MoreUtils::all { m/\A[-A-Za-z0-9]+\z/smx } @{ $name->labels } ) { | ||
| 383 | return 1; | ||
| 384 | } | ||
| 385 | else { | ||
| 386 | return 0; | ||
| 387 | } | ||
| 388 | } | ||
| 389 | |||
| 390 | sub _label_starts_with_hyphen { | ||
| 391 | my ( $label ) = @_; | ||
| 392 | |||
| 393 | return 0 if not $label; | ||
| 394 | |||
| 395 | if ( $label =~ /\A-/smgx ) { | ||
| 396 | return 1; | ||
| 397 | } | ||
| 398 | else { | ||
| 399 | return 0; | ||
| 400 | } | ||
| 401 | } | ||
| 402 | |||
| 403 | sub _label_ends_with_hyphen { | ||
| 404 | my ( $label ) = @_; | ||
| 405 | |||
| 406 | return 0 if not $label; | ||
| 407 | |||
| 408 | if ( $label =~ /-\z/smgx ) { | ||
| 409 | return 1; | ||
| 410 | } | ||
| 411 | else { | ||
| 412 | return 0; | ||
| 413 | } | ||
| 414 | } | ||
| 415 | |||
| 416 | sub _label_not_ace_has_double_hyphen_in_position_3_and_4 { | ||
| 417 | my ( $label ) = @_; | ||
| 418 | |||
| 419 | return 0 if not $label; | ||
| 420 | |||
| 421 | if ( $label =~ /\A..--/smx and $label !~ /\Axn/ismx ) { | ||
| 422 | return 1; | ||
| 423 | } | ||
| 424 | else { | ||
| 425 | return 0; | ||
| 426 | } | ||
| 427 | } | ||
| 428 | |||
| 429 | ### | ||
| 430 | ### Common part for syntax04, syntax07 and syntax08 | ||
| 431 | ### | ||
| 432 | |||
| 433 | sub get_name { | ||
| 434 | my ( $item ) = @_; | ||
| 435 | my $name; | ||
| 436 | |||
| 437 | if ( not ref $item ) { | ||
| 438 | $name = name( $item ); | ||
| 439 | } | ||
| 440 | elsif ( ref( $item ) eq q{Zonemaster::Zone} ) { | ||
| 441 | $name = $item->name; | ||
| 442 | } | ||
| 443 | elsif ( ref( $item ) eq q{Zonemaster::DNSName} ) { | ||
| 444 | $name = $item; | ||
| 445 | } | ||
| 446 | |||
| 447 | return $name; | ||
| 448 | } | ||
| 449 | |||
| 450 | sub check_name_syntax { | ||
| 451 | my ( $info_label_prefix, $name ) = @_; | ||
| 452 | my @results; | ||
| 453 | |||
| 454 | $name = get_name( $name ); | ||
| 455 | |||
| 456 | if ( not _name_has_only_legal_characters( $name ) ) { | ||
| 457 | push @results, | ||
| 458 | info( | ||
| 459 | $info_label_prefix | ||
| 460 | . q{_NON_ALLOWED_CHARS} => { | ||
| 461 | name => $name, | ||
| 462 | } | ||
| 463 | ); | ||
| 464 | } | ||
| 465 | |||
| 466 | foreach my $local_label ( @{ $name->labels } ) { | ||
| 467 | if ( _label_not_ace_has_double_hyphen_in_position_3_and_4( $local_label ) ) { | ||
| 468 | push @results, | ||
| 469 | info( | ||
| 470 | $info_label_prefix | ||
| 471 | . q{_DISCOURAGED_DOUBLE_DASH} => { | ||
| 472 | label => $local_label, | ||
| 473 | name => "$name", | ||
| 474 | } | ||
| 475 | ); | ||
| 476 | } | ||
| 477 | } | ||
| 478 | |||
| 479 | my $tld = @{ $name->labels }[-1]; | ||
| 480 | if ( $tld =~ /\A\d+\z/smgx ) { | ||
| 481 | push @results, | ||
| 482 | info( | ||
| 483 | $info_label_prefix | ||
| 484 | . q{_NUMERIC_TLD} => { | ||
| 485 | name => "$name", | ||
| 486 | tld => $tld, | ||
| 487 | } | ||
| 488 | ); | ||
| 489 | } | ||
| 490 | |||
| 491 | if ( not scalar @results ) { | ||
| 492 | push @results, | ||
| 493 | info( | ||
| 494 | $info_label_prefix | ||
| 495 | . q{_SYNTAX_OK} => { | ||
| 496 | name => "$name", | ||
| 497 | } | ||
| 498 | ); | ||
| 499 | } | ||
| 500 | |||
| 501 | return @results; | ||
| 502 | } ## end sub check_name_syntax | ||
| 503 | |||
| 504 | 1; | ||
| 505 | |||
| 506 | =head1 NAME | ||
| 507 | |||
| 508 | Zonemaster::Test::Syntax - test validating the syntax of host names and other data | ||
| 509 | |||
| 510 | =head1 SYNOPSIS | ||
| 511 | |||
| 512 | my @results = Zonemaster::Test::Syntax->all($zone); | ||
| 513 | |||
| 514 | =head1 METHODS | ||
| 515 | |||
| 516 | =over | ||
| 517 | |||
| 518 | =item all($zone) | ||
| 519 | |||
| 520 | Runs the default set of tests and returns a list of log entries made by the tests. | ||
| 521 | |||
| 522 | =item translation() | ||
| 523 | |||
| 524 | Returns a refernce to a hash with translation data. Used by the builtin translation system. | ||
| 525 | |||
| 526 | =item metadata() | ||
| 527 | |||
| 528 | Returns a reference to a hash, the keys of which are the names of all test methods in the module, and the corresponding values are references to | ||
| 529 | lists with all the tags that the method can use in log entries. | ||
| 530 | |||
| 531 | =item version() | ||
| 532 | |||
| 533 | Returns a version string for the module. | ||
| 534 | |||
| 535 | =back | ||
| 536 | |||
| 537 | =head1 TESTS | ||
| 538 | |||
| 539 | =over | ||
| 540 | |||
| 541 | =item syntax01($name) | ||
| 542 | |||
| 543 | Verifies that the name (Zonemaster::DNSName) given contains only allowed characters. | ||
| 544 | |||
| 545 | =item syntax02($name) | ||
| 546 | |||
| 547 | Verifies that the name (Zonemaster::DNSName) given does not start or end with a hyphen ('-'). | ||
| 548 | |||
| 549 | =item syntax03($name) | ||
| 550 | |||
| 551 | Verifies that the name (Zonemaster::DNSName) given does not contain a hyphen in 3rd and 4th position (in the exception of 'xn--'). | ||
| 552 | |||
| 553 | =item syntax04($name) | ||
| 554 | |||
| 555 | Verify that a nameserver (Zonemaster::DNSName) given is conform to previous syntax rules. It also verify name total length as well as labels. | ||
| 556 | |||
| 557 | =item syntax05($zone) | ||
| 558 | |||
| 559 | Verify that a SOA rname (Zonemaster::DNSName) given has a conform usage of at sign (@). | ||
| 560 | |||
| 561 | =item syntax06($zone) | ||
| 562 | |||
| 563 | Verify that a SOA rname (Zonemaster::DNSName) given is RFC822 compliant. | ||
| 564 | |||
| 565 | =item syntax07($zone) | ||
| 566 | |||
| 567 | Verify that SOA mname of zone given is conform to previous syntax rules (syntax01, syntax02, syntax03). It also verify name total length as well as labels. | ||
| 568 | |||
| 569 | =item syntax08(@mx_names) | ||
| 570 | |||
| 571 | Verify that MX name (Zonemaster::DNSName) given is conform to previous syntax rules (syntax01, syntax02, syntax03). It also verify name total length as well as labels. | ||
| 572 | |||
| 573 | =back | ||
| 574 | |||
| 575 | =head1 INTERNAL METHODS | ||
| 576 | |||
| 577 | =over | ||
| 578 | |||
| 579 | =item get_name($item) | ||
| 580 | |||
| 581 | Converts argument to a L<Zonemaster::DNSName> object. | ||
| 582 | |||
| 583 | =item check_name_syntax | ||
| 584 | |||
| 585 | Implementation of some tests that are used on several kinds of input. | ||
| 586 | |||
| 587 | =back | ||
| 588 | |||
| 589 | =cut |