It turns out that the problem is, in fact, in package qca2. 

When decrypting or signing a file, qca would invoke gpg with the
pinentry mode set to "loopback". This would normally cause gpg to ask
for a password on the console, but, of course, there isn't one in a GUI
application.

This patch sets the pinentry mode to "default" when we're decrypting or
signing, which should cause the normal pinentry dialog to be
displayed.

Tags: Patch provided

-- 
Ron Murray <r...@rjmx.net>
PGP Fingerprint: 4D99 70E3 2317 334B 141E 7B63 12F7 E865 B5E2 E761

When decrypting or signing a file, qca would invoke gpg with the
pinentry mode set to "loopback". This would normally cause gpg to ask
for a password on the console, but, of course, there isn't one.

This patch sets the pinentry mode to "default" when we're decrypting
or signing, which should cause the normal pinentry dialog to be
displayed.

--- qca2-2.3.4.orig/plugins/qca-gnupg/gpgaction.cpp
+++ qca2-2.3.4/plugins/qca-gnupg/gpgaction.cpp
@@ -329,6 +329,7 @@ void GpgAction::start()
         extra         = true;
         collectOutput = false;
         allowInput    = true;
+		proc.needPass = true;
         if (input.opt_ascii)
             writeText = true;
         break;
@@ -341,6 +342,7 @@ void GpgAction::start()
         extra         = true;
         collectOutput = false;
         allowInput    = true;
+		proc.needPass = true;
         if (input.opt_ascii)
             readText = true;
         signing = true;
@@ -361,6 +363,7 @@ void GpgAction::start()
         extra         = true;
         collectOutput = false;
         allowInput    = true;
+		proc.needPass = true;
         if (input.opt_ascii)
             readText = true;
         signing = true;
--- qca2-2.3.4.orig/plugins/qca-gnupg/gpgproc/gpgproc.cpp
+++ qca2-2.3.4/plugins/qca-gnupg/gpgproc/gpgproc.cpp
@@ -27,6 +27,8 @@ using namespace QCA;
 
 namespace gpgQCAPlugin {
 
+bool GPGProc::needPass;
+
 void releaseAndDeleteLater(QObject *owner, QObject *obj)
 {
     obj->disconnect(owner);
@@ -166,7 +168,12 @@ void GPGProc::Private::setupArguments()
     QStringList fullargs;
     fullargs += QStringLiteral("--no-tty");
     fullargs += QStringLiteral("--pinentry-mode");
-    fullargs += QStringLiteral("loopback");
+
+	// Change pinentry-mode if we need to get a passphrase from the user
+	if (needPass)
+		fullargs += QStringLiteral("default");
+	else
+		fullargs += QStringLiteral("loopback");
 
     if (mode == ExtendedMode) {
         fullargs += QStringLiteral("--enable-special-filenames");
@@ -459,6 +466,7 @@ GPGProc::GPGProc(QObject *parent)
     : QObject(parent)
 {
     d = new Private(this);
+	needPass = false;
 }
 
 GPGProc::~GPGProc()
--- qca2-2.3.4.orig/plugins/qca-gnupg/gpgproc/gpgproc.h
+++ qca2-2.3.4/plugins/qca-gnupg/gpgproc/gpgproc.h
@@ -64,6 +64,7 @@ public:
     void closeStdin();
     void closeAux();
     void closeCommand();
+	static bool needPass;
 
 Q_SIGNALS:
     void error(gpgQCAPlugin::GPGProc::Error error);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to