From ae82fbad45614a0cea85117907e7c5a8c7c5a513 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 28 Apr 2011 17:30:54 +0200 Subject: [PATCH] Add support for names with spaces in them and automatically pull keys first. --- bin/gsign | 2 +- bin/gverify | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/gsign b/bin/gsign index dd6887c..ee023d8 100755 --- a/bin/gsign +++ b/bin/gsign @@ -74,4 +74,4 @@ FileUtils.mkdir_p(destination) release_path = File.join(destination, release, signer) FileUtils.mkdir_p(release_path) FileUtils.cp(result_path, release_path) -system!("gpg --detach-sign -u #{signer} -o #{release_path}/signature.pgp #{result_path}") +system!("gpg --detach-sign -u \"#{signer}\" -o \"#{release_path}/signature.pgp\" #{result_path}") diff --git a/bin/gverify b/bin/gverify index a0ae613..c59222e 100755 --- a/bin/gverify +++ b/bin/gverify @@ -17,7 +17,7 @@ def sanitize(str, where) end def sanitize_path(str, where) - raise "unsanitary string in #{where}" if (str =~ /[^@\w\/.-]/) + raise "unsanitary string in #{where}" if (str =~ /[^@\w\/. -]/) str end @@ -77,7 +77,8 @@ Dir.foreach(release_path) do |signer_dir| next if !File.directory?(signer_path) result_path = sanitize_path(File.join(signer_path, result_file), "result path") result = YAML.load_file(result_path) - if !system("gpg --quiet --batch --verify #{File.join(signer_path, 'signature.pgp')} #{result_path}") + system("gpg --keyserver pgp.mit.edu --recv-keys `gpg --quiet --batch --verify \"#{File.join(signer_path, 'signature.pgp')}\" \"#{result_path}\" 2>&1 | head -n1 | grep \"key ID\" | awk '{ print $15 }'` > /dev/null 2>&1") + if !system("gpg --quiet --batch --verify \"#{File.join(signer_path, 'signature.pgp')}\" \"#{result_path}\"") puts "#{signer_dir}: BAD SIGNATURE" did_fail = true elsif current_manifest and result['out_manifest'] != current_manifest