You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
1.2 KiB

diff -up ./plugins-scripts/check_ntp.pl.fix_ipv6 ./plugins-scripts/check_ntp.pl
--- ./plugins-scripts/check_ntp.pl.fix_ipv6 2019-08-29 21:07:13.497504795 +0000
+++ ./plugins-scripts/check_ntp.pl 2019-08-29 21:11:48.626816686 +0000
@@ -112,13 +112,23 @@ if (defined $opt_j || defined $opt_k ) {
}
$opt_H = shift unless ($opt_H);
-my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/);
+
+## From https://bugzilla.redhat.com/show_bug.cgi?id=1731468
+my $host = $opt_H if ($opt_H &&
+ ($opt_H =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ || # IPv4
+ $opt_H =~ m/^([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})$/i || # IPv6 without ::
+ $opt_H =~ m/^:(:[0-9a-f]{1,4})+$/i || # IPv6 with leading ::
+ $opt_H =~ m/^([0-9a-f]{1,4}:)+:$/i || # IPv6 with trailing ::
+ $opt_H =~ m/^([0-9a-f]{1,4}:)+(:[0-9a-f]{1,4})+$/i || # IPv6 with middle ::
+ $opt_H =~ m/^[a-z0-9][-a-z0-9]*(\.[a-z0-9][-a-z0-9]*)*$/)); # hostnames
+
unless ($host) {
print "No target host specified\n";
print_usage();
exit $ERRORS{'UNKNOWN'};
}
+
my ($timeout, $owarn, $ocrit, $jwarn, $jcrit);
$timeout = $TIMEOUT;