fix: custom key database feature not working
Some checks are pending
Build & Package Qt5 / build (ubuntu-20.04) (push) Waiting to run
Build & Package Qt5 / build (windows-2019) (push) Waiting to run
Build & Package / build (macos-12) (push) Waiting to run
Build & Package / build (macos-13) (push) Waiting to run
Build & Package / build (macos-14) (push) Waiting to run
Build & Package / build (ubuntu-20.04) (push) Waiting to run
Build & Package / build (windows-2019) (push) Waiting to run
Some checks are pending
Build & Package Qt5 / build (ubuntu-20.04) (push) Waiting to run
Build & Package Qt5 / build (windows-2019) (push) Waiting to run
Build & Package / build (macos-12) (push) Waiting to run
Build & Package / build (macos-13) (push) Waiting to run
Build & Package / build (macos-14) (push) Waiting to run
Build & Package / build (ubuntu-20.04) (push) Waiting to run
Build & Package / build (windows-2019) (push) Waiting to run
This commit is contained in:
parent
512c219850
commit
d4e2335bfd
@ -304,9 +304,6 @@ void InitGpgFrontendCore(CoreInitArgs args) {
|
|||||||
auto custom_key_database_path =
|
auto custom_key_database_path =
|
||||||
settings.value("gnupg/custom_key_database_path", QString{}).toString();
|
settings.value("gnupg/custom_key_database_path", QString{}).toString();
|
||||||
|
|
||||||
auto custom_gnupg_install_path =
|
|
||||||
settings.value("gnupg/custom_gnupg_install_path", QString{}).toString();
|
|
||||||
|
|
||||||
auto use_pinentry_as_password_input_dialog =
|
auto use_pinentry_as_password_input_dialog =
|
||||||
settings
|
settings
|
||||||
.value("gnupg/use_pinentry_as_password_input_dialog",
|
.value("gnupg/use_pinentry_as_password_input_dialog",
|
||||||
@ -327,10 +324,14 @@ void InitGpgFrontendCore(CoreInitArgs args) {
|
|||||||
!custom_key_database_path.isEmpty()) {
|
!custom_key_database_path.isEmpty()) {
|
||||||
if (VerifyKeyDatabasePath(QFileInfo(custom_key_database_path))) {
|
if (VerifyKeyDatabasePath(QFileInfo(custom_key_database_path))) {
|
||||||
key_database_fs_path =
|
key_database_fs_path =
|
||||||
QFileInfo(custom_gnupg_install_path).absoluteFilePath();
|
QFileInfo(custom_key_database_path).absoluteFilePath();
|
||||||
|
LOG_D() << "use custom gpg key database: " << key_database_fs_path
|
||||||
|
<< "raw:" << custom_key_database_path;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LOG_W() << "custom gpg key database path is not suitable: "
|
LOG_W() << "custom gpg key database path is not suitable: "
|
||||||
<< key_database_fs_path;
|
<< key_database_fs_path
|
||||||
|
<< "raw:" << custom_key_database_path;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -354,8 +355,7 @@ void InitGpgFrontendCore(CoreInitArgs args) {
|
|||||||
|
|
||||||
// set custom gnupg path
|
// set custom gnupg path
|
||||||
if (!gnupg_install_fs_path.isEmpty()) {
|
if (!gnupg_install_fs_path.isEmpty()) {
|
||||||
args.custom_gpgconf = true;
|
args.gpgconf_path = gnupg_install_fs_path;
|
||||||
args.custom_gpgconf_path = gnupg_install_fs_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
args.offline_mode = forbid_all_gnupg_connection;
|
args.offline_mode = forbid_all_gnupg_connection;
|
||||||
|
@ -236,11 +236,10 @@ class GpgContext::Impl {
|
|||||||
const GpgContextInitArgs &args) -> bool {
|
const GpgContextInitArgs &args) -> bool {
|
||||||
assert(ctx != nullptr);
|
assert(ctx != nullptr);
|
||||||
|
|
||||||
if (args.custom_gpgconf && !args.custom_gpgconf_path.isEmpty()) {
|
if (!args.gpgconf_path.isEmpty()) {
|
||||||
LOG_D() << "set custom gpgconf path: " << args.custom_gpgconf_path;
|
LOG_D() << "set custom gpgconf path: " << args.gpgconf_path;
|
||||||
auto err =
|
auto err = gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_GPGCONF,
|
||||||
gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_GPGCONF,
|
args.gpgconf_path.toUtf8(), nullptr);
|
||||||
args.custom_gpgconf_path.toUtf8(), nullptr);
|
|
||||||
|
|
||||||
if (CheckGpgError(err) != GPG_ERR_NO_ERROR) {
|
if (CheckGpgError(err) != GPG_ERR_NO_ERROR) {
|
||||||
LOG_W() << "set gpg context engine info error: "
|
LOG_W() << "set gpg context engine info error: "
|
||||||
@ -284,6 +283,7 @@ class GpgContext::Impl {
|
|||||||
|
|
||||||
// set custom gpg key db path
|
// set custom gpg key db path
|
||||||
if (!args_.db_path.isEmpty()) {
|
if (!args_.db_path.isEmpty()) {
|
||||||
|
LOG_D() << "set context database path to" << args_.db_path;
|
||||||
Module::UpsertRTValue("core", "gpgme.ctx.database_path", args_.db_path);
|
Module::UpsertRTValue("core", "gpgme.ctx.database_path", args_.db_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,7 @@ struct GpgContextInitArgs {
|
|||||||
bool offline_mode = false; ///<
|
bool offline_mode = false; ///<
|
||||||
bool auto_import_missing_key = false; ///<
|
bool auto_import_missing_key = false; ///<
|
||||||
|
|
||||||
bool custom_gpgconf = false; ///<
|
QString gpgconf_path; ///<
|
||||||
QString custom_gpgconf_path; ///<
|
|
||||||
|
|
||||||
bool use_pinentry = false; ///<
|
bool use_pinentry = false; ///<
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user