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 + + * passphrase.c (agent_get_passphrase): Fixed detection of canceled + error state as send by current gpg-agents. + 2004-08-16 Werner Koch * 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;