From 9d864ebef7608faa69a314ad220c270bffd43834 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Wed, 18 Aug 2004 00:03:07 +0000 Subject: [PATCH] 2004-08-18 Marcus Brinkmann * passphrase.c (agent_get_passphrase): --- g10/ChangeLog | 5 +++++ g10/passphrase.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 7a8ccd5c0..e472a626f 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,8 @@ +2004-08-18 Marcus Brinkmann + + * passphrase.c (agent_get_passphrase): Fix detection of gpg-agent + cancellation. + 2004-07-01 Werner Koch * card-util.c (change_login): Kludge to allow reading data from a diff --git a/g10/passphrase.c b/g10/passphrase.c index 986070a16..30149908e 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -862,9 +862,11 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text, xfree (orig_codeset); return pw; } - else if (nread > 7 && !memcmp (pw, "ERR 111", 7) - && (pw[7] == ' ' || pw[7] == '\n') ) - { + else if (nread > 4 && !memcmp (pw, "ERR ", 4) + && (0xffff & strtoul (&pw[4], NULL, 0)) == 99) + { + /* 99 is GPG_ERR_CANCELED. FIXME: Check tail and overflow, + and use gpg-error. */ log_info (_("cancelled by user\n") ); if (canceled) *canceled = 1;