diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-11-23 17:45:11 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2024-11-28 10:17:21 +0100 |
| commit | 0e69c1fa5b8a4a1237933fa47113ea839a66f8a0 (patch) | |
| tree | d1ae180b2ef9f696d49fdc2ee3a2fb787fce6bb9 | |
| parent | c9530c4773a9d0b50c589098a03a47bcdfc75ea0 (diff) | |
Do not implode key file name vector for calling gpgv
Converting it to a comma-separated string and back loses precision.
| -rw-r--r-- | apt-pkg/contrib/gpgv.cc | 10 | ||||
| -rw-r--r-- | apt-pkg/contrib/gpgv.h | 2 | ||||
| -rw-r--r-- | methods/gpgv.cc | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc index aab7851a1..6def6d625 100644 --- a/apt-pkg/contrib/gpgv.cc +++ b/apt-pkg/contrib/gpgv.cc @@ -141,6 +141,13 @@ static void APT_PRINTF(5) apt_msg(std::string const &tag, std::ostream &outterm, void ExecGPGV(std::string const &File, std::string const &FileGPG, int const &statusfd, int fd[2], std::string const &key) { + auto const keyFiles = VectorizeString(key, ','); + ExecGPGV(File, FileGPG, statusfd, fd, keyFiles); +} + +void ExecGPGV(std::string const &File, std::string const &FileGPG, + int const &statusfd, int fd[2], std::vector<std::string> const &KeyFiles) +{ #define EINTERNAL 111 std::string const aptkey = _config->Find("Dir::Bin::apt-key", CMAKE_INSTALL_FULL_BINDIR "/apt-key"); @@ -160,8 +167,7 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG, Args.push_back(aptkey.c_str()); Args.push_back("--quiet"); Args.push_back("--readonly"); - auto const keysFileFpr = VectorizeString(key, ','); - for (auto const &k: keysFileFpr) + for (auto const &k : KeyFiles) { if (unlikely(k.empty())) continue; diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index 1f3ef26f9..62c92f271 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -40,6 +40,8 @@ class FileFd; * @param key is the specific one to be used instead of using all */ APT_PUBLIC void ExecGPGV(std::string const &File, std::string const &FileSig, + int const &statusfd, int fd[2], std::vector<std::string> const &KeyFiles) APT_NORETURN; +APT_PUBLIC void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd, int fd[2], std::string const &Key = "") APT_NORETURN; inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 4a0866555..9f2ccb174 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -201,9 +201,8 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, else if (pid == 0) { std::ostringstream keys; - implodeVector(keyFiles, keys, ","); setenv("APT_KEY_NO_LEGACY_KEYRING", "1", true); - ExecGPGV(outfile, file, 3, fd, keys.str()); + ExecGPGV(outfile, file, 3, fd, keyFiles); } close(fd[1]); |
