From 3666a2859bd31115708b027cb69fa824c8111de4 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sat, 18 Dec 2004 10:22:10 +0000 Subject: [PATCH] Avoid the " map_to_assuan_status called with no error source" diagnostic. --- agent/ChangeLog | 5 +++++ agent/agent.h | 2 ++ common/ChangeLog | 7 +++++++ common/asshelp.c | 16 +++++++++------- common/asshelp.h | 1 + common/maperror.c | 4 ++-- common/util.h | 2 +- g10/ChangeLog | 9 +++++++++ g10/Makefile.am | 2 +- g10/call-agent.c | 2 ++ g10/gpg.h | 2 ++ kbx/ChangeLog | 5 +++++ kbx/keybox-defs.h | 4 +++- scd/ChangeLog | 5 +++++ scd/scdaemon.h | 3 +++ sm/ChangeLog | 7 +++++++ sm/call-agent.c | 2 +- sm/gpgsm.h | 3 +++ 18 files changed, 68 insertions(+), 13 deletions(-) diff --git a/agent/ChangeLog b/agent/ChangeLog index 81c979414..b22241bc9 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,8 @@ +2004-12-18 Werner Koch + + * agent.h (map_assuan_err): Define in terms of + map_assuan_err_with_source. + 2004-12-17 Moritz Schulte * query.c: Undo change from 2004-12-05. diff --git a/agent/agent.h b/agent/agent.h index 8112c258a..7ff692504 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -26,6 +26,8 @@ #endif #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGAGENT #include +#define map_assuan_err(a) \ + map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a)) #include #include diff --git a/common/ChangeLog b/common/ChangeLog index 3115ad897..9b048ae49 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,10 @@ +2004-12-18 Werner Koch + + * maperror.c (map_assuan_err): Renamed to .. + (map_assuan_err_with_source): .. this and add arg SOURCE.c + * asshelp.c (send_pinentry_environment, send_one_option): Add arg + ERRSOURCE. + 2004-12-15 Werner Koch * sysutils.h [W32]: Prototypes for registry functions. diff --git a/common/asshelp.c b/common/asshelp.c index 243d6b9e7..efaf71e30 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -34,7 +34,8 @@ static gpg_error_t -send_one_option (assuan_context_t ctx, const char *name, const char *value) +send_one_option (assuan_context_t ctx, gpg_err_source_t errsource, + const char *name, const char *value) { gpg_error_t err; char *optstr; @@ -48,7 +49,7 @@ send_one_option (assuan_context_t ctx, const char *name, const char *value) assuan_error_t ae; ae = assuan_transact (ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL); - err = ae? map_assuan_err (ae) : 0; + err = ae? map_assuan_err_with_source (errsource, ae) : 0; free (optstr); } @@ -61,6 +62,7 @@ send_one_option (assuan_context_t ctx, const char *name, const char *value) defaults taken from the current locale. */ gpg_error_t send_pinentry_environment (assuan_context_t ctx, + gpg_err_source_t errsource, const char *opt_display, const char *opt_ttyname, const char *opt_ttytype, @@ -78,7 +80,7 @@ send_pinentry_environment (assuan_context_t ctx, dft_display = getenv ("DISPLAY"); if (opt_display || dft_display) { - err = send_one_option (ctx, "display", + err = send_one_option (ctx, errsource, "display", opt_display ? opt_display : dft_display); if (err) return err; @@ -93,7 +95,7 @@ send_pinentry_environment (assuan_context_t ctx, } if (opt_ttyname || dft_ttyname) { - err = send_one_option (ctx, "ttyname", + err = send_one_option (ctx, errsource, "ttyname", opt_ttyname ? opt_ttyname : dft_ttyname); if (err) return err; @@ -103,7 +105,7 @@ send_pinentry_environment (assuan_context_t ctx, dft_ttytype = getenv ("TERM"); if (opt_ttytype || (dft_ttyname && dft_ttytype)) { - err = send_one_option (ctx, "ttytype", + err = send_one_option (ctx, errsource, "ttytype", opt_ttyname ? opt_ttytype : dft_ttytype); if (err) return err; @@ -122,7 +124,7 @@ send_pinentry_environment (assuan_context_t ctx, #endif if (opt_lc_ctype || (dft_ttyname && dft_lc)) { - err = send_one_option (ctx, "lc-ctype", + err = send_one_option (ctx, errsource, "lc-ctype", opt_lc_ctype ? opt_lc_ctype : dft_lc); } #if defined(HAVE_SETLOCALE) && defined(LC_CTYPE) @@ -148,7 +150,7 @@ send_pinentry_environment (assuan_context_t ctx, #endif if (opt_lc_messages || (dft_ttyname && dft_lc)) { - err = send_one_option (ctx, "display", + err = send_one_option (ctx, errsource, "display", opt_lc_messages ? opt_lc_messages : dft_lc); } #if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES) diff --git a/common/asshelp.h b/common/asshelp.h index 993594882..2d6dc79e6 100644 --- a/common/asshelp.h +++ b/common/asshelp.h @@ -26,6 +26,7 @@ gpg_error_t send_pinentry_environment (assuan_context_t ctx, + gpg_err_source_t errsource, const char *opt_display, const char *opt_ttyname, const char *opt_ttytype, diff --git a/common/maperror.c b/common/maperror.c index 89ecee987..91731468f 100644 --- a/common/maperror.c +++ b/common/maperror.c @@ -38,7 +38,7 @@ simple: All errors with a gpg_err_source of UNKNOWN are genuine Assuan codes all others are passed verbatim through. */ gpg_error_t -map_assuan_err (int err) +map_assuan_err_with_source (int err, int source) { gpg_err_code_t ec; @@ -77,7 +77,7 @@ map_assuan_err (int err) ec = err < 100? GPG_ERR_ASSUAN_SERVER_FAULT : GPG_ERR_ASSUAN; break; } - return gpg_err_make (GPG_ERR_SOURCE_UNKNOWN, ec); + return gpg_err_make (source, ec); } /* Map GPG_xERR_xx error codes to Assuan status codes */ diff --git a/common/util.h b/common/util.h index 0b9357d3a..835be4e0e 100644 --- a/common/util.h +++ b/common/util.h @@ -61,7 +61,7 @@ typedef char gnupg_isotime_t[16]; /*-- maperror.c --*/ int map_kbx_err (int err); -gpg_error_t map_assuan_err (int err); +gpg_error_t map_assuan_err_with_source (int source, int err); int map_to_assuan_status (int rc); /*-- gettime.c --*/ diff --git a/g10/ChangeLog b/g10/ChangeLog index 01bbf649d..6966bbd7b 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +2004-12-18 Werner Koch + + * gpg.h (map_assuan_err): Define in terms of + map_assuan_err_with_source. + +2004-12-15 Werner Koch + + * Makefile.am (LDADD): Remove ZLIBS. + 2004-10-22 Werner Koch * g10.c (main): Display a bit fat warning that this gpg should not diff --git a/g10/Makefile.am b/g10/Makefile.am index aa7833fb9..8e63e9335 100644 --- a/g10/Makefile.am +++ b/g10/Makefile.am @@ -108,7 +108,7 @@ gpgv2_SOURCES = gpgv.c \ # ks-db.h \ # $(common_source) -LDADD = $(needed_libs) @LIBINTL@ @CAPLIBS@ @ZLIBS@ @W32LIBS@ +LDADD = $(needed_libs) @LIBINTL@ @CAPLIBS@ @W32LIBS@ gpg2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) -lassuan -lgpg-error gpgv2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) -lassuan -lgpg-error diff --git a/g10/call-agent.c b/g10/call-agent.c index 473b38236..9c7f8409b 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -171,7 +171,9 @@ start_agent (void) if (rc) return map_assuan_err (rc); +#ifdef __GNUC__ #warning put this code into common/asshelp.c +#endif dft_display = getenv ("DISPLAY"); if (opt.display || dft_display) diff --git a/g10/gpg.h b/g10/gpg.h index bf61411f7..42c9cc662 100644 --- a/g10/gpg.h +++ b/g10/gpg.h @@ -29,6 +29,8 @@ #error GPG_ERR_SOURCE_DEFAULT already defined #endif #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPG +#define map_assuan_err(a) \ + map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a)) #include diff --git a/kbx/ChangeLog b/kbx/ChangeLog index d75700216..3688174bd 100644 --- a/kbx/ChangeLog +++ b/kbx/ChangeLog @@ -1,3 +1,8 @@ +2004-12-18 Werner Koch + + * keybox-defs.h (map_assuan_err): Define in terms of + map_assuan_err_with_source. + 2004-12-07 Werner Koch * keybox-init.c (keybox_release): Close the file pointer. diff --git a/kbx/keybox-defs.h b/kbx/keybox-defs.h index 5724b85a0..b58294459 100644 --- a/kbx/keybox-defs.h +++ b/kbx/keybox-defs.h @@ -25,8 +25,10 @@ #error GPG_ERR_SOURCE_DEFAULT already defined #endif #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_KEYBOX - #include +#define map_assuan_err(a) \ + map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a)) + #include /* off_t */ /* We include the type defintions from jnlib instead of defining our diff --git a/scd/ChangeLog b/scd/ChangeLog index fe3b3f6c4..87328f650 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,8 @@ +2004-12-18 Werner Koch + + * scdaemon.h (map_assuan_err): Define in terms of + map_assuan_err_with_source. + 2004-12-15 Werner Koch * scdaemon.c [W32]: Various hacks to make it run under W32. diff --git a/scd/scdaemon.h b/scd/scdaemon.h index c8d78c88b..c59879448 100644 --- a/scd/scdaemon.h +++ b/scd/scdaemon.h @@ -26,6 +26,9 @@ #endif #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_SCD #include +#define map_assuan_err(a) \ + map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a)) + #include #include diff --git a/sm/ChangeLog b/sm/ChangeLog index b28c45af8..167ec8753 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,10 @@ +2004-12-18 Werner Koch + + * gpgsm.h (map_assuan_err): Define in terms of + map_assuan_err_with_source. + * call-agent.c (start_agent): Pass error source to + send_pinentry_environment. + 2004-12-17 Werner Koch * call-dirmngr.c (isvalid_status_cb, lookup_status_cb) diff --git a/sm/call-agent.c b/sm/call-agent.c index 3ea1c4565..0d15a5595 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -168,7 +168,7 @@ start_agent (ctrl_t ctrl) if (rc) return map_assuan_err (rc); - return send_pinentry_environment (agent_ctx, + return send_pinentry_environment (agent_ctx, GPG_ERR_SOURCE_DEFAULT, opt.display, opt.ttyname, opt.ttytype, opt.lc_ctype, opt.lc_messages); } diff --git a/sm/gpgsm.h b/sm/gpgsm.h index fe4e93910..17ad21ed6 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -26,6 +26,9 @@ #endif #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGSM #include +#define map_assuan_err(a) \ + map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a)) + #include #include "../common/util.h"