qt: Start dirmngr with gpgconf to avoid multiple instances

* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use "gpgconf
--launch dirmngr" to start dirmngr.
--

Using gpgconf to start dirmngr prevents multiple instances to be started
by the concurrently running keyserver lookup and WKD lookup.

GnuPG-bug-id: 6833
This commit is contained in:
Ingo Klöcker 2023-11-23 16:13:39 +01:00
parent 618fea9e20
commit 1bbe2d4b70
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9

View File

@ -64,22 +64,22 @@ static GpgME::Error startDirmngr(Context *assuanCtx)
if (err) { if (err) {
qCDebug(QGPGME_LOG) << "Error: Failed to get context for spawn engine (" << err.asString() << ")"; qCDebug(QGPGME_LOG) << "Error: Failed to get context for spawn engine (" << err.asString() << ")";
} }
const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name");
const auto dirmngrProgram = GpgME::dirInfo("dirmngr-name");
const auto homedir = GpgME::dirInfo("homedir"); const auto homedir = GpgME::dirInfo("homedir");
const char *argv[] = { const char *argv[] = {
dirmngrProgram, gpgconfProgram,
"--homedir", "--homedir",
homedir, homedir,
"--daemon", "--launch",
"dirmngr",
NULL NULL
}; };
auto ignoreIO = Data{Data::null}; auto ignoreIO = Data{Data::null};
if (!err) { if (!err) {
qCDebug(QGPGME_LOG) << "Starting dirmngr ..."; qCDebug(QGPGME_LOG) << "Starting dirmngr ...";
err = spawnCtx->spawnAsync(dirmngrProgram, argv, err = spawnCtx->spawn(gpgconfProgram, argv,
ignoreIO, ignoreIO, ignoreIO, ignoreIO, ignoreIO, ignoreIO,
Context::SpawnDetached); Context::SpawnDetached);
} }
if (!err) { if (!err) {