assuan_read_from_server() and return value

Marcus Brinkmann marcus.brinkmann at
Thu Jan 10 22:57:52 CET 2008

At Sat, 5 Jan 2008 14:01:03 -0500,
Ben Kibbey <bjk at> wrote:
> If there is no error source set (which pinentry doesn't do)
> _assuan_error() will return the unmasked error code, and for the
> application (which uses gpg-error), it is impossible to determine if the
> error is an ASSUAN_ or GPG_ERR error code. So the problem (in my case)
> is with pinentry not setting an error source.

I just checked into pinentry:

2008-01-10  Marcus Brinkmann  <marcus at>

        * assuan-handler.c (dispatch_command): Use Syntax_Error instead of
        * assuan.h (assuan_error_t): Change all error codes to gpg-error

If you want, why not check it out and see if that works for you?  I
did some tests here and it seems to work as a drop in replacement for
older pinentries.

> I have an app that uses gpg-error codes. The app connects to pinentry
> via assuan_pipe_connect(). I call assuan_transact() to send the GETPIN
> command to pinentry. If I cancel the pinentry by selecting the Cancel
> button, assuan_transact() returns ASSUAN_Canceled (111). But for an app
> that uses gpg-error, the error is seen as GPG_ERR_INV_CARD (111). So in
> my app I have to test for both GPG_ERR_ASS_CANCELED and ASSUAN_Canceled.

gpg-agent maps GPG_ERR_ASS_CANCELED to GPG_ERR_CANCELED, because
internall ASSUAN_Canceled is mapped to the latter.  However, the above
change makes pinentry return GPG_ERR_CANCELED in case it is canceled,
for your convenience.

More information about the Gnupg-devel mailing list