[Pkg-privacy-commits] [msva-perl] 12/15: handle lack of keyserver line in gpg.conf cleanly

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


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

infinity0 pushed a commit to branch master
in repository msva-perl.

commit 87114f1bedbf28d47f6497e32417cda93e7fad10
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Mon Sep 9 01:55:29 2013 -0400

    handle lack of keyserver line in gpg.conf cleanly
---
 Crypt/Monkeysphere/Keyserver.pm | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/Crypt/Monkeysphere/Keyserver.pm b/Crypt/Monkeysphere/Keyserver.pm
index 83e4a24..5005570 100644
--- a/Crypt/Monkeysphere/Keyserver.pm
+++ b/Crypt/Monkeysphere/Keyserver.pm
@@ -82,15 +82,20 @@ sub _read_keyserver_from_gpg_conf() {
   if (-f $gpgconf) {
     if (-r $gpgconf) {
       my %gpgconfig = Config::General::ParseConfig($gpgconf);
-      if (ref($gpgconfig{keyserver}) eq 'ARRAY') {
-        # use the last keyserver entry if there is more than one.
-        $gpgconfig{keyserver} = pop(@{$gpgconfig{keyserver}});
-      }
-      if ($gpgconfig{keyserver} =~ /^(((hkps?|hkpms|finger|ldap):\/\/)?$RE{net}{domain})$/) {
-	$self->log('debug', "Using keyserver %s from the GnuPG configuration file (%s)\n", $1, $gpgconf);
-	return $1;
+      if (! defined $gpgconfig{keyserver}) {
+	$self->log('debug', "No keyserver line found in GnuPG configuration file (%s)\n", $gpgconf);
       } else {
-	$self->log('error', "Not a valid keyserver (from gpg config %s):\n  %s\n", $gpgconf, $gpgconfig{keyserver});
+        if (ref($gpgconfig{keyserver}) eq 'ARRAY') {
+          # use the last keyserver entry if there is more than one.
+          $self->log('debug', "more than one keyserver line found in GnuPG configuration file (%s), using last one found\n", $gpgconf);
+          $gpgconfig{keyserver} = pop(@{$gpgconfig{keyserver}});
+        }
+        if ($gpgconfig{keyserver} =~ /^(((hkps?|hkpms|finger|ldap):\/\/)?$RE{net}{domain})$/) {
+          $self->log('debug', "Using keyserver %s from the GnuPG configuration file (%s)\n", $1, $gpgconf);
+          return $1;
+        } else {
+          $self->log('error', "Not a valid keyserver (from gpg config %s):\n  %s\n", $gpgconf, $gpgconfig{keyserver});
+        }
       }
     } else {
       $self->log('error', "The GnuPG configuration file (%s) is not readable\n", $gpgconf);

-- 
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