Skip to content

Commit abe7977

Browse files
committed
feat(gpg): support user-defined pinentry path
* Allow users to specify a custom pinentry program path via application property. * Validate user input and log a warning if the path is invalid. * Log the final pinentry program path for debugging purposes. This improves flexibility for users who require custom pinentry setups.
1 parent f4d2dbd commit abe7977

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/core/function/gpg/GpgContext.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,23 @@ class GpgAgentProcess {
7575

7676
args.append({"--daemon", "--enable-ssh-support"});
7777

78+
// auto decide pinentry program path
7879
auto pinentry = DecidePinentry();
80+
81+
// GFPinentryProgramPath
82+
auto user_pinentry = qApp->property("GFPinentryProgramPath").toString();
83+
if (!user_pinentry.isEmpty()) {
84+
QFileInfo pinentry_info(user_pinentry);
85+
if (pinentry_info.exists() && pinentry_info.isFile()) {
86+
pinentry = pinentry_info.absoluteFilePath();
87+
} else {
88+
LOG_W() << "the user defined pinentry program path is illegal: "
89+
<< user_pinentry;
90+
}
91+
}
92+
93+
LOG_D() << "decided pinentry program path: " << pinentry;
94+
7995
if (!pinentry.trimmed().isEmpty()) {
8096
args.append({"--pinentry-program", pinentry});
8197
}

0 commit comments

Comments
 (0)