summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/gpgv.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2015-08-18 11:57:35 +0200
committerMichael Vogt <mvo@debian.org>2015-08-18 11:57:35 +0200
commitb53c9cea2902572822bbbece5bac236c1bbf846e (patch)
tree6c6b0524e0971c0623ccbff71383523ee0b2a5cc /apt-pkg/contrib/gpgv.cc
parent21248c0f00ee71412dbadc6ebf84011cf974346d (diff)
parent2a22cd60f04c4291ea9b9b72e15b6d2ec378b001 (diff)
Merge remote-tracking branch 'upstream/debian/experimental' into feature/srv-records
Diffstat (limited to 'apt-pkg/contrib/gpgv.cc')
-rw-r--r--apt-pkg/contrib/gpgv.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc
index 9d798cca9..ef84da0d8 100644
--- a/apt-pkg/contrib/gpgv.cc
+++ b/apt-pkg/contrib/gpgv.cc
@@ -16,6 +16,8 @@
#include <sys/wait.h>
#include <unistd.h>
#include <stddef.h>
+
+#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
@@ -42,7 +44,7 @@ static char * GenerateTemporaryFileTemplate(const char *basename) /*{{{*/
of the lifting in regards to merging keyrings. Fun for the whole family.
*/
void ExecGPGV(std::string const &File, std::string const &FileGPG,
- int const &statusfd, int fd[2])
+ int const &statusfd, int fd[2], std::string const &key)
{
#define EINTERNAL 111
std::string const aptkey = _config->FindFile("Dir::Bin::apt-key", "/usr/bin/apt-key");
@@ -55,6 +57,19 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG,
Args.push_back(aptkey.c_str());
Args.push_back("--quiet");
Args.push_back("--readonly");
+ if (key.empty() == false)
+ {
+ if (key[0] == '/')
+ {
+ Args.push_back("--keyring");
+ Args.push_back(key.c_str());
+ }
+ else
+ {
+ Args.push_back("--keyid");
+ Args.push_back(key.c_str());
+ }
+ }
Args.push_back("verify");
char statusfdstr[10];
@@ -296,6 +311,8 @@ bool SplitClearSignedFile(std::string const &InFile, FileFd * const ContentFile,
// all the rest is whitespace, unsigned garbage or additional message blocks we ignore
}
fclose(in);
+ if (buf != NULL)
+ free(buf);
if (found_signature == true)
return _error->Error("Signature in file %s wasn't closed", InFile.c_str());