aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2004-08-18 10:12:39 +0000
committerWerner Koch <[email protected]>2004-08-18 10:12:39 +0000
commit26390338902fd0aa1fde886d2e8742288be7265d (patch)
treee0f84e009c2cc7e65b2f1281efc47a6b7a273a18
parentRemoved stray semicolon. (diff)
downloadgnupg-26390338902fd0aa1fde886d2e8742288be7265d.tar.gz
gnupg-26390338902fd0aa1fde886d2e8742288be7265d.zip
(agent_get_passphrase): Fixed detection of canceled
error state as send by current gpg-agents.
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/passphrase.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index e859ab776..c21692b2d 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-18 Werner Koch <[email protected]>
+
+ * passphrase.c (agent_get_passphrase): Fixed detection of canceled
+ error state as send by current gpg-agents.
+
2004-08-16 Werner Koch <[email protected]>
* gpgv.c: Removed stray semicolon.
diff --git a/g10/passphrase.c b/g10/passphrase.c
index a04874fe8..546394832 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -867,9 +867,15 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
m_free (orig_codeset);
return pw;
}
- else if (nread > 7 && !memcmp (pw, "ERR 111", 7)
- && (pw[7] == ' ' || pw[7] == '\n') )
+ else if ((nread > 7 && !memcmp (pw, "ERR 111", 7)
+ && (pw[7] == ' ' || pw[7] == '\n'))
+ || ((nread > 4 && !memcmp (pw, "ERR ", 4)
+ && (strtoul (pw+4, NULL, 0) & 0xffff) == 99)) )
{
+ /* 111 is the old Assuan code for canceled which might still
+ be in use by old installations. 99 is GPG_ERR_CANCELED as
+ used by modern gpg-agents; 0xfff is used to mask out the
+ error source. */
log_info (_("cancelled by user\n") );
if (canceled)
*canceled = 1;