summaryrefslogtreecommitdiffstats
path: root/common/simple-pwquery.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2004-08-18 16:37:22 +0200
committerWerner Koch <wk@gnupg.org>2004-08-18 16:37:22 +0200
commit33310977ac6984a49085f12f0f5ff83c9a9f8d8a (patch)
tree68ac27b18f89db441dd04b92bae3a0422037e23a /common/simple-pwquery.c
parent(print_sanitized_utf8_string): Actually implement (diff)
downloadgnupg2-33310977ac6984a49085f12f0f5ff83c9a9f8d8a.tar.xz
gnupg2-33310977ac6984a49085f12f0f5ff83c9a9f8d8a.zip
(simple_pwquery): Handle gpg-error style return
code for canceled.
Diffstat (limited to '')
-rw-r--r--common/simple-pwquery.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/simple-pwquery.c b/common/simple-pwquery.c
index 36244b120..0bc8128e1 100644
--- a/common/simple-pwquery.c
+++ b/common/simple-pwquery.c
@@ -466,9 +466,15 @@ simple_pwquery (const char *cacheid,
result = pw;
pw = NULL;
}
- 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; 0xffff is used to mask out the
+ error source. */
#ifdef SPWQ_USE_LOGGING
log_info (_("canceled by user\n") );
#endif