From 07fe5e3e81ef1bf8daa0acaebe5b3ebab1542a0a Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 7 Feb 2010 17:09:05 -0500 Subject: [PATCH] Show the error string when importing and pinentry fails. Return GPG_ERR_ASSUAN_SERVER_FAULT instead of GPG_ERR_CANCELED when DISPLAY and TERM are unavailable. --- src/pinentry.c | 4 ++-- src/pwmd.c | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pinentry.c b/src/pinentry.c index 431668ff..f712c396 100644 --- a/src/pinentry.c +++ b/src/pinentry.c @@ -155,7 +155,7 @@ static gpg_error_t set_pinentry_options(struct pinentry_s *pin) tty = pin->ttyname ? pin->ttyname : ttyname(STDOUT_FILENO); if (!tty) - return GPG_ERR_CANCELED; + return GPG_ERR_ASSUAN_SERVER_FAULT; } if (!have_display && !tty) @@ -167,7 +167,7 @@ static gpg_error_t set_pinentry_options(struct pinentry_s *pin) ttytype = pin->ttytype ? pin->ttytype : p; if (!ttytype) - return GPG_ERR_CANCELED; + return GPG_ERR_ASSUAN_SERVER_FAULT; } opt = have_display ? "DISPLAY" : "TTYNAME"; diff --git a/src/pwmd.c b/src/pwmd.c index a40ab1ed..8c795990 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -1118,8 +1118,15 @@ static gboolean xml_import(const gchar *filename, const gchar *outfile, else if (iter) { rc = get_password(outfile, crypto, NULL, crypto->key, PINENTRY_SAVE); - if (rc) + if (rc == GPG_ERR_ASSUAN_SERVER_FAULT) { + log_write(N_("%s. Maybe disabling pinentry (-P) will help?"), + pwmd_strerror(rc)); goto fail; + } + else if (rc) { + log_write("%s", pwmd_strerror(rc)); + goto fail; + } } if ((fd = open(filename, O_RDONLY)) == -1) { -- 2.11.4.GIT