From 1163f3a7f418f249af64890f4636575e687e9de7 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 28 Dec 2020 14:03:41 -0800 Subject: [PATCH] Always use IPv6 if a v6 address was given https://github.com/webmin/webmin/issues/1420 --- miniserv.pl | 5 +++-- status/ping-monitor.pl | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/miniserv.pl b/miniserv.pl index f8f97bdba..23cad440f 100755 --- a/miniserv.pl +++ b/miniserv.pl @@ -2603,8 +2603,9 @@ if (&get_type($full) eq "internal/cgi" && $validated != 4) { if ($on_windows) { # Run the CGI program, and feed it input chdir($ENV{"PWD"}); - local $qqueryargs = join(" ", map { "\"$_\"" } - split(/\s+/, $queryargs)); + local $qqueryargs = join(" ", + map { s/([<>|&"^])/^$1/g; "\"$_\"" } + split(/\s+/, $queryargs)); if ($first =~ /(perl|perl.exe)$/i) { # On Windows, run with Perl open(CGIOUTr, "$perl_path \"$full\" $qqueryargs <$infile |"); diff --git a/status/ping-monitor.pl b/status/ping-monitor.pl index 1e6f05830..665085281 100755 --- a/status/ping-monitor.pl +++ b/status/ping-monitor.pl @@ -10,7 +10,8 @@ local $wait = defined($_[0]->{'wait'}) ? $_[0]->{'wait'} : 5; local $ip = &to_ipaddress($_[0]->{'host'}) || &to_ip6address($_[0]->{'host'}); return { 'up' => 0 } if (!$ip); -local $ipv6 = &to_ip6address($_[0]->{'host'}) && +local $ipv6 = &check_ip6address($_[0]->{'host'}) || + &to_ip6address($_[0]->{'host'}) && !&to_ipaddress($_[0]->{'host'}); if ($config{'pinger'} || $ipv6) { # Call a ping command if configured, or if using IPv6 since the built-