INN commit: trunk/frontends (pullnews.in)

INN Commit rra at isc.org
Wed Mar 18 20:46:21 UTC 2015


    Date: Wednesday, March 18, 2015 @ 13:46:20
  Author: iulius
Revision: 9796

pullnews:  when giving a port along with a server name, check there is only one ":"

Otherwise, it is very likely that the given server name is an IPv6 address,
and therefore its end should not be interpreted as a port.

Modified:
  trunk/frontends/pullnews.in

-------------+
 pullnews.in |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Modified: pullnews.in
===================================================================
--- pullnews.in	2015-03-18 20:31:16 UTC (rev 9795)
+++ pullnews.in	2015-03-18 20:46:20 UTC (rev 9796)
@@ -272,7 +272,12 @@
 my $pathSteps           = $opt_P if defined $opt_P;
 my $path_limit;
 
-$localPort = $1 if not defined $opt_p and $localServer =~ s/:(\d+)$//;
+# Find a possible port at the end of the news server name.
+# Count the number of ":" to check that it is not an IPv6 address.
+if (not defined $opt_p) {
+    my @colons = split(/:/, $localServer);
+    $localPort = $1 if ((scalar(@colons) == 2) and ($localServer =~ s/:(\d+)$//));
+}
 
 die "can\'t have both ``-s'' and ``-r''\n"  if $opt_s && $opt_r;
 



More information about the inn-committers mailing list