summaryrefslogtreecommitdiff
path: root/apt-pkg/indexcopy.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-15 09:53:38 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-15 09:53:38 +0200
commit6db194289ece36e62cb8dab0aa178209b46c59f2 (patch)
tree6e1970919929dd3d2d03d343e4ec40ccad22ad66 /apt-pkg/indexcopy.cc
parent35555c1826da5df9f2c06a74f2e91be843ad8142 (diff)
parent1d08f27046533e36849a63c084f51809be484d8c (diff)
merged from http://bzr.debian.org/bzr/apt/apt/debian-sid
Diffstat (limited to 'apt-pkg/indexcopy.cc')
-rw-r--r--apt-pkg/indexcopy.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 064fb007c..31c577705 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -664,6 +664,21 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG,
int const &statusfd, int fd[2])
{
+ if (File == FileGPG)
+ {
+ #define SIGMSG "-----BEGIN PGP SIGNED MESSAGE-----\n"
+ char buffer[sizeof(SIGMSG)];
+ FILE* gpg = fopen(File.c_str(), "r");
+ if (gpg == NULL)
+ return _error->Errno("RunGPGV", _("Could not open file %s"), File.c_str());
+ char const * const test = fgets(buffer, sizeof(buffer), gpg);
+ fclose(gpg);
+ if (test == NULL || strcmp(buffer, SIGMSG) != 0)
+ return _error->Error(_("File %s doesn't start with a clearsigned message"), File.c_str());
+ #undef SIGMSG
+ }
+
+
string const gpgvpath = _config->Find("Dir::Bin::gpg", "/usr/bin/gpgv");
// FIXME: remove support for deprecated APT::GPGV setting
string const trustedFile = _config->Find("APT::GPGV::TrustedKeyring", _config->FindFile("Dir::Etc::Trusted"));
@@ -688,7 +703,11 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG,
Args.reserve(30);
if (keyrings.empty() == true)
- return false;
+ {
+ // TRANSLATOR: %s is the trusted keyring parts directory
+ return _error->Error(_("No keyring installed in %s."),
+ _config->FindDir("Dir::Etc::TrustedParts").c_str());
+ }
Args.push_back(gpgvpath.c_str());
Args.push_back("--ignore-time-conflict");