[Pkg-privacy-commits] [msva-perl] 04/15: blunder onward instead of failing hard if we cannot retrieve the port number

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:42:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to annotated tag msva-perl_debian/0.8.1-2
in repository msva-perl.

commit 25c297b811c31c1b37940c89dad37d39cdd45c97
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Fri Mar 16 02:12:37 2012 -0400

    blunder onward instead of failing hard if we cannot retrieve the port number
---
 Crypt/Monkeysphere/MSVA.pm | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/Crypt/Monkeysphere/MSVA.pm b/Crypt/Monkeysphere/MSVA.pm
index 6660ece..29d19ab 100755
--- a/Crypt/Monkeysphere/MSVA.pm
+++ b/Crypt/Monkeysphere/MSVA.pm
@@ -830,16 +830,20 @@
       $server->set_exit_status(10);
       $server->server_close();
     }
-    my $port = @{ $server->{server}->{sock} }[0]->sockport();
-    if ((! defined $port) || ($port < 1) || ($port >= 65536)) {
-      msvalog('error', "got nonsense port: %d.\n", $port);
-      $server->set_exit_status(11);
-      $server->server_close();
-    }
-    if ((exists $ENV{MSVA_PORT}) && (($ENV{MSVA_PORT} + 0) != $port)) {
-      msvalog('error', "Explicitly requested port %d, but got port: %d.", ($ENV{MSVA_PORT}+0), $port);
-      $server->set_exit_status(13);
-      $server->server_close();
+    if (!defined($self->port) || $self->port == 0) {
+      my $port = @{ $server->{server}->{sock} }[0]->sockport();
+      if (! defined($port)) {
+        msvalog('error', "got undefined port.\nRecording as 0.\n", $port);
+        $port = 0;
+      } elsif (($port < 1) || ($port >= 65536)) {
+        msvalog('error', "got nonsense port: %d.\nRecording as 0.\n", $port);
+        $port = 0;
+      } elsif ((exists $ENV{MSVA_PORT}) && (($ENV{MSVA_PORT} + 0) != $port)) {
+        msvalog('error', "Explicitly requested port %d, but got port: %d.", ($ENV{MSVA_PORT}+0), $port);
+        $server->set_exit_status(13);
+        $server->server_close();
+      }
+      $self->port($port);
     }
     $self->port($port);
     $self->{updatemonitor} = Crypt::Monkeysphere::MSVA::Monitor::->new($logger);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/msva-perl.git



More information about the Pkg-privacy-commits mailing list