summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/gpgv.cc24
-rw-r--r--methods/rred.cc9
2 files changed, 25 insertions, 8 deletions
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index f2ef6b76e..d073c733e 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -258,16 +258,32 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
if (std::find(ValidSigners.begin(), ValidSigners.end(), k) == ValidSigners.end())
continue;
// we look for GOODSIG here as well as an expired sig is a valid sig as well (but not a good one)
+ std::string const goodfingerprint = "GOODSIG " + k;
std::string const goodlongkeyid = "GOODSIG " + k.substr(24, 16);
- foundGood = std::find(GoodSigners.begin(), GoodSigners.end(), goodlongkeyid) != GoodSigners.end();
+ foundGood = std::find(GoodSigners.begin(), GoodSigners.end(), goodfingerprint) != GoodSigners.end();
if (Debug == true)
- std::clog << "Key " << k << " is valid sig, is " << goodlongkeyid << " also a good one? " << (foundGood ? "yes" : "no") << std::endl;
+ std::clog << "Key " << k << " is valid sig, is " << goodfingerprint << " also a good one? " << (foundGood ? "yes" : "no") << std::endl;
+ std::string goodsig;
+ if (foundGood == false)
+ {
+ foundGood = std::find(GoodSigners.begin(), GoodSigners.end(), goodlongkeyid) != GoodSigners.end();
+ if (Debug == true)
+ std::clog << "Key " << k << " is valid sig, is " << goodlongkeyid << " also a good one? " << (foundGood ? "yes" : "no") << std::endl;
+ goodsig = goodlongkeyid;
+ }
+ else
+ goodsig = goodfingerprint;
if (foundGood == false)
continue;
std::copy(GoodSigners.begin(), GoodSigners.end(), std::back_insert_iterator<std::vector<std::string> >(NoPubKeySigners));
GoodSigners.clear();
- GoodSigners.push_back(goodlongkeyid);
- NoPubKeySigners.erase(std::remove(NoPubKeySigners.begin(), NoPubKeySigners.end(), goodlongkeyid), NoPubKeySigners.end());
+ GoodSigners.push_back(goodsig);
+ NoPubKeySigners.erase(
+ std::remove(NoPubKeySigners.begin(),
+ std::remove(NoPubKeySigners.begin(), NoPubKeySigners.end(), goodfingerprint),
+ goodlongkeyid),
+ NoPubKeySigners.end()
+ );
break;
}
if (foundGood == false)
diff --git a/methods/rred.cc b/methods/rred.cc
index 0c641ad82..958933a07 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -335,7 +335,7 @@ class Patch {
FileChanges filechanges;
MemBlock add_text;
- static bool retry_fwrite(char *b, size_t l, FileFd &f, Hashes * const start_hash, Hashes * const end_hash = nullptr)
+ static bool retry_fwrite(char *b, size_t l, FileFd &f, Hashes * const start_hash, Hashes * const end_hash = nullptr) APT_NONNULL(1)
{
if (f.Write(b, l) == false)
return false;
@@ -385,8 +385,8 @@ class Patch {
}
}
- static void dump_mem(FileFd &o, char *p, size_t s, Hashes *hash) {
- retry_fwrite(p, s, o, hash);
+ static void dump_mem(FileFd &o, char *p, size_t s, Hashes *hash) APT_NONNULL(2) {
+ retry_fwrite(p, s, o, nullptr, hash);
}
public:
@@ -538,7 +538,8 @@ class Patch {
for (ch = filechanges.begin(); ch != filechanges.end(); ++ch) {
dump_lines(out, in, ch->offset, start_hash, end_hash);
skip_lines(in, ch->del_cnt, start_hash);
- dump_mem(out, ch->add, ch->add_len, end_hash);
+ if (ch->add_len != 0)
+ dump_mem(out, ch->add, ch->add_len, end_hash);
}
dump_rest(out, in, start_hash, end_hash);
out.Flush();