| 1 |
From d6b046d0c1b2e92d3db2f1847214ef3d0132d758 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Stephen Paul Weber <[email protected]> |
| 3 |
Date: Sun, 24 Apr 2011 16:40:57 -0500 |
| 4 |
Subject: [PATCH 18/18] Option to use gpg-agent |
| 5 |
|
| 6 |
--- |
| 7 |
src/core/tools.c | 10 ++++++++-- |
| 8 |
src/core/xmpp-servers.c | 1 + |
| 9 |
2 files changed, 9 insertions(+), 2 deletions(-) |
| 10 |
|
| 11 |
--- a/src/core/tools.c |
| 12 |
+++ b/src/core/tools.c |
| 13 |
@@ -43,7 +43,8 @@ |
| 14 |
char buf[100], buf2[100] = ""; |
| 15 |
const char *keyid = settings_get_str("xmpp_pgp"); |
| 16 |
|
| 17 |
- if(keyid) { /* If no keyID, then we don't need a password */ |
| 18 |
+ /* If no keyID, then we don't need a password */ |
| 19 |
+ if(keyid && !settings_get_str("xmpp_pgp_agent")) { |
| 20 |
if(pipe(pipefd)) goto pgp_error; |
| 21 |
if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); |
| 22 |
if(!pgp_passwd) goto pgp_error; |
| 23 |
@@ -66,7 +67,12 @@ |
| 24 |
+strlen(switches)+8+ \ |
| 25 |
(tmp2_path ? strlen(tmp2_path) : 0)); |
| 26 |
if(keyid) { |
| 27 |
- sprintf(cmd, "gpg -u '%s' --passphrase-fd '%d' ", keyid, pipefd[0]); |
| 28 |
+ strcpy(cmd, "gpg -u '"); |
| 29 |
+ strcat(cmd, keyid); |
| 30 |
+ strcat(cmd, "' "); |
| 31 |
+ if(!settings_get_str("xmpp_pgp_agent")) { |
| 32 |
+ sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pipefd[0]); |
| 33 |
+ } |
| 34 |
} else { |
| 35 |
strcpy(cmd, "gpg "); |
| 36 |
} |
| 37 |
--- a/src/core/xmpp-servers.c |
| 38 |
+++ b/src/core/xmpp-servers.c |
| 39 |
@@ -630,6 +630,7 @@ |
| 40 |
settings_add_int("xmpp", "xmpp_priority", 0); |
| 41 |
settings_add_int("xmpp", "xmpp_priority_away", -1); |
| 42 |
settings_add_str("xmpp", "xmpp_pgp", NULL); |
| 43 |
+ settings_add_str("xmpp", "xmpp_pgp_agent", NULL); |
| 44 |
settings_add_bool("xmpp_lookandfeel", "xmpp_set_nick_as_username", |
| 45 |
FALSE); |
| 46 |
settings_add_bool("xmpp_proxy", "xmpp_use_proxy", FALSE); |