Changeset 341 for trunk


Ignore:
Timestamp:
Aug 30, 2018, 2:38:02 PM (6 years ago)
Author:
g7moreau
Message:
  • Unique DNS domain in check
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ddt/ddt

    r340 r341  
    2121use strict;
    2222#use warnings;
    23 use version; our $VERSION = version->declare('0.10.4');
     23use version; our $VERSION = version->declare('0.10.5');
    2424
    2525use Getopt::Long qw(GetOptions);
     
    26572657      }
    26582658
    2659    LOOP_ON_DNS:
    2660    my @dns_domain_list = map $computer_db->{'dset'}{$_}{'dns_extension'},
    2661       grep exists($computer_db->{'dset'}{$_}{'dns_extension'}), keys $computer_db->{'dset'};
    2662    for my $dns (@dns_domain_list) {
    2663       last LOOP_ON_DNS if not $opt_reverse;     # No DNS to DDT check
    2664       LOOP_ON_IP:
    2665       for (shell_command("host -t A -l $dns")) {
    2666          # smtp2.legi.grenoble-inp.fr has address 194.254.67.37
    2667          next if not m/has address/;
    2668          next if not m/^(\w[\w-_\.]+\w)\s+has\saddress\s+(\d[\d\.]+\d)$/;
    2669          my ($hostname_fq, $ip) = ($1, $2);
    2670          control_syntax_ip($ip) or next LOOP_ON_IP;
    2671          if (control_exist_ip($computer_db, $ip) == 1) {
    2672             printf "Unkown IP: %015s / %s\n", $ip, $hostname_fq;
    2673             next LOOP_ON_IP;
     2659   if ($opt_reverse) {  # No DNS to DDT check
     2660      my %saw; # count for unique member
     2661      my @dns_domain_list = sort grep !$saw{$_}++,
     2662         map $computer_db->{'dset'}{$_}{'dns_extension'},
     2663         grep exists($computer_db->{'dset'}{$_}{'dns_extension'}),
     2664         keys $computer_db->{'dset'};
     2665      LOOP_ON_DNS:
     2666      for my $dns (@dns_domain_list) {
     2667         LOOP_ON_IP:
     2668         for (shell_command("host -t A -l $dns")) {
     2669            # smtp2.legi.grenoble-inp.fr has address 194.254.67.37
     2670            next if not m/has address/;
     2671            next if not m/^(\w[\w-_\.]+\w)\s+has\saddress\s+(\d[\d\.]+\d)$/;
     2672            my ($hostname_fq, $ip) = ($1, $2);
     2673            control_syntax_ip($ip) or next LOOP_ON_IP;
     2674            if (control_exist_ip($computer_db, $ip) == 1) {
     2675               printf "Unkown IP: %015s / %s\n", $ip, $hostname_fq;
     2676               next LOOP_ON_IP;
     2677               }
    26742678            }
    26752679         }
Note: See TracChangeset for help on using the changeset viewer.