[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeutils/kgpg [POSSIBLY UNSAFE]
From: Jean-Baptiste Mardelle <bj () altern ! org>
Date: 2003-04-18 17:36:54
[Download RAW message or body]
CVS commit by mardelle:
added support for gpg-agent [10 lines of code :-) ] Feedback welcome
M +32 -2 kgpginterface.cpp 1.42 [POSSIBLY UNSAFE: popen]
--- kdeutils/kgpg/kgpginterface.cpp #1.41:1.42
@@ -16,4 +16,5 @@
***************************************************************************/
+#include <stdio.h>
#include <qdialog.h>
@@ -463,4 +464,17 @@ QString KgpgInterface::KgpgDecryptText(Q
QCString password;
+if (getenv("GPG_AGENT_INFO"))
+{
+ gpgcmd="echo ";
+ gpgcmd+=KShellProcess::quote(text);
+ gpgcmd+=" | gpg --no-secmem-warning --no-tty -d";
+
+ fp = popen(QFile::encodeName(gpgcmd), "r");
+ while ( fgets( buffer, sizeof(buffer), fp))
+ encResult+=buffer;
+ pclose(fp);
+}
+else
+{
while ((counter<3) && (encResult.isEmpty())) {
/// pipe for passphrase
@@ -493,5 +507,8 @@ QString KgpgInterface::KgpgDecryptText(Q
pclose(fp);
}
- if (encResult!="")
+ }
+
+
+ if (!encResult.isEmpty())
return encResult;
else
@@ -508,4 +525,16 @@ QString KgpgInterface::KgpgDecryptFileTo
QCString password;
+if (getenv("GPG_AGENT_INFO"))
+{
+ gpgcmd+="gpg --no-secmem-warning --no-tty -o - -d '";
+ gpgcmd+=srcUrl.path()+"'";
+
+ fp = popen(QFile::encodeName(gpgcmd), "r");
+ while ( fgets( buffer, sizeof(buffer), fp))
+ encResult+=buffer;
+ pclose(fp);
+}
+else
+{
while ((counter<3) && (encResult.isEmpty())) {
/// pipe for passphrase
@@ -537,5 +566,6 @@ QString KgpgInterface::KgpgDecryptFileTo
pclose(fp);
}
- if (encResult!="")
+ }
+ if (!encResult.isEmpty())
return encResult;
else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic