summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2024-11-23 19:50:44 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-11-28 19:01:36 +0100
commit0496bc63a3ad1dcbc41d20225c6a0d50fbcf101d (patch)
tree0c44545650d0694d6170903bc9f5790a07ba4582 /apt-pkg
parent325b0c89358dae042ebfe0ba6dcbcc43253927a6 (diff)
gpgv: Add direct support for --assert-pubkey-algo
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/gpgv.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc
index dd4d5cfb6..611f4bfa7 100644
--- a/apt-pkg/contrib/gpgv.cc
+++ b/apt-pkg/contrib/gpgv.cc
@@ -301,6 +301,29 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG,
Args.push_back(statusfdstr);
}
+ if (auto assertPubkeyAlgo = _config->Find("Apt::Key::assert-pubkey-algo"); not assertPubkeyAlgo.empty())
+ {
+ FileFd dumpOptions;
+ pid_t child;
+ if (Debug)
+ std::clog << "Calling " << gpgv << " --dump-options" << std::endl;
+ const char* argv[] = {gpgv.c_str(), "--dump-options", nullptr};
+ if (not Popen(argv, dumpOptions, child, FileFd::ReadOnly) && Debug)
+ std::clog << "Failed to call " << gpgv << " --dump-options" << std::endl;
+ for (std::string line; dumpOptions.ReadLine(line); )
+ {
+ if (Debug)
+ std::clog << "Read line: " << line << std::endl;
+ if (APT::String::Strip(line) == "--assert-pubkey-algo")
+ {
+ Args.push_back("--assert-pubkey-algo=" + assertPubkeyAlgo);
+ break;
+ }
+ }
+ dumpOptions.Close();
+ waitpid(child, NULL, 0);
+ }
+
Configuration::Item const *Opts;
Opts = _config->Tree("Acquire::gpgv::Options");
if (Opts != 0)