1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-08 23:37:47 +02:00

Avoid the " map_to_assuan_status called with no error source" diagnostic.

This commit is contained in:
Werner Koch 2004-12-18 10:22:10 +00:00
parent d75eda2b87
commit 3666a2859b
18 changed files with 68 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2004-12-18 Werner Koch <wk@g10code.com>
* agent.h (map_assuan_err): Define in terms of
map_assuan_err_with_source.
2004-12-17 Moritz Schulte <moritz@g10code.com> 2004-12-17 Moritz Schulte <moritz@g10code.com>
* query.c: Undo change from 2004-12-05. * query.c: Undo change from 2004-12-05.

View File

@ -26,6 +26,8 @@
#endif #endif
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGAGENT #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGAGENT
#include <gpg-error.h> #include <gpg-error.h>
#define map_assuan_err(a) \
map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a))
#include <errno.h> #include <errno.h>
#include <gcrypt.h> #include <gcrypt.h>

View File

@ -1,3 +1,10 @@
2004-12-18 Werner Koch <wk@g10code.com>
* 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 <wk@g10code.com> 2004-12-15 Werner Koch <wk@g10code.com>
* sysutils.h [W32]: Prototypes for registry functions. * sysutils.h [W32]: Prototypes for registry functions.

View File

@ -34,7 +34,8 @@
static gpg_error_t 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; gpg_error_t err;
char *optstr; char *optstr;
@ -48,7 +49,7 @@ send_one_option (assuan_context_t ctx, const char *name, const char *value)
assuan_error_t ae; assuan_error_t ae;
ae = assuan_transact (ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL); 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); 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. */ defaults taken from the current locale. */
gpg_error_t gpg_error_t
send_pinentry_environment (assuan_context_t ctx, send_pinentry_environment (assuan_context_t ctx,
gpg_err_source_t errsource,
const char *opt_display, const char *opt_display,
const char *opt_ttyname, const char *opt_ttyname,
const char *opt_ttytype, const char *opt_ttytype,
@ -78,7 +80,7 @@ send_pinentry_environment (assuan_context_t ctx,
dft_display = getenv ("DISPLAY"); dft_display = getenv ("DISPLAY");
if (opt_display || dft_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); opt_display ? opt_display : dft_display);
if (err) if (err)
return err; return err;
@ -93,7 +95,7 @@ send_pinentry_environment (assuan_context_t ctx,
} }
if (opt_ttyname || dft_ttyname) if (opt_ttyname || dft_ttyname)
{ {
err = send_one_option (ctx, "ttyname", err = send_one_option (ctx, errsource, "ttyname",
opt_ttyname ? opt_ttyname : dft_ttyname); opt_ttyname ? opt_ttyname : dft_ttyname);
if (err) if (err)
return err; return err;
@ -103,7 +105,7 @@ send_pinentry_environment (assuan_context_t ctx,
dft_ttytype = getenv ("TERM"); dft_ttytype = getenv ("TERM");
if (opt_ttytype || (dft_ttyname && dft_ttytype)) 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); opt_ttyname ? opt_ttytype : dft_ttytype);
if (err) if (err)
return err; return err;
@ -122,7 +124,7 @@ send_pinentry_environment (assuan_context_t ctx,
#endif #endif
if (opt_lc_ctype || (dft_ttyname && dft_lc)) 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); opt_lc_ctype ? opt_lc_ctype : dft_lc);
} }
#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE) #if defined(HAVE_SETLOCALE) && defined(LC_CTYPE)
@ -148,7 +150,7 @@ send_pinentry_environment (assuan_context_t ctx,
#endif #endif
if (opt_lc_messages || (dft_ttyname && dft_lc)) 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); opt_lc_messages ? opt_lc_messages : dft_lc);
} }
#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES) #if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES)

View File

@ -26,6 +26,7 @@
gpg_error_t gpg_error_t
send_pinentry_environment (assuan_context_t ctx, send_pinentry_environment (assuan_context_t ctx,
gpg_err_source_t errsource,
const char *opt_display, const char *opt_display,
const char *opt_ttyname, const char *opt_ttyname,
const char *opt_ttytype, const char *opt_ttytype,

View File

@ -38,7 +38,7 @@
simple: All errors with a gpg_err_source of UNKNOWN are genuine simple: All errors with a gpg_err_source of UNKNOWN are genuine
Assuan codes all others are passed verbatim through. */ Assuan codes all others are passed verbatim through. */
gpg_error_t gpg_error_t
map_assuan_err (int err) map_assuan_err_with_source (int err, int source)
{ {
gpg_err_code_t ec; 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; ec = err < 100? GPG_ERR_ASSUAN_SERVER_FAULT : GPG_ERR_ASSUAN;
break; 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 */ /* Map GPG_xERR_xx error codes to Assuan status codes */

View File

@ -61,7 +61,7 @@ typedef char gnupg_isotime_t[16];
/*-- maperror.c --*/ /*-- maperror.c --*/
int map_kbx_err (int err); 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); int map_to_assuan_status (int rc);
/*-- gettime.c --*/ /*-- gettime.c --*/

View File

@ -1,3 +1,12 @@
2004-12-18 Werner Koch <wk@g10code.com>
* gpg.h (map_assuan_err): Define in terms of
map_assuan_err_with_source.
2004-12-15 Werner Koch <wk@g10code.com>
* Makefile.am (LDADD): Remove ZLIBS.
2004-10-22 Werner Koch <wk@g10code.com> 2004-10-22 Werner Koch <wk@g10code.com>
* g10.c (main): Display a bit fat warning that this gpg should not * g10.c (main): Display a bit fat warning that this gpg should not

View File

@ -108,7 +108,7 @@ gpgv2_SOURCES = gpgv.c \
# ks-db.h \ # ks-db.h \
# $(common_source) # $(common_source)
LDADD = $(needed_libs) @LIBINTL@ @CAPLIBS@ @ZLIBS@ @W32LIBS@ LDADD = $(needed_libs) @LIBINTL@ @CAPLIBS@ @W32LIBS@
gpg2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) -lassuan -lgpg-error gpg2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) -lassuan -lgpg-error
gpgv2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) -lassuan -lgpg-error gpgv2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) -lassuan -lgpg-error

View File

@ -171,7 +171,9 @@ start_agent (void)
if (rc) if (rc)
return map_assuan_err (rc); return map_assuan_err (rc);
#ifdef __GNUC__
#warning put this code into common/asshelp.c #warning put this code into common/asshelp.c
#endif
dft_display = getenv ("DISPLAY"); dft_display = getenv ("DISPLAY");
if (opt.display || dft_display) if (opt.display || dft_display)

View File

@ -29,6 +29,8 @@
#error GPG_ERR_SOURCE_DEFAULT already defined #error GPG_ERR_SOURCE_DEFAULT already defined
#endif #endif
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPG #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 <gpg-error.h> #include <gpg-error.h>

View File

@ -1,3 +1,8 @@
2004-12-18 Werner Koch <wk@g10code.com>
* keybox-defs.h (map_assuan_err): Define in terms of
map_assuan_err_with_source.
2004-12-07 Werner Koch <wk@g10code.com> 2004-12-07 Werner Koch <wk@g10code.com>
* keybox-init.c (keybox_release): Close the file pointer. * keybox-init.c (keybox_release): Close the file pointer.

View File

@ -25,8 +25,10 @@
#error GPG_ERR_SOURCE_DEFAULT already defined #error GPG_ERR_SOURCE_DEFAULT already defined
#endif #endif
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_KEYBOX #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_KEYBOX
#include <gpg-error.h> #include <gpg-error.h>
#define map_assuan_err(a) \
map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a))
#include <sys/types.h> /* off_t */ #include <sys/types.h> /* off_t */
/* We include the type defintions from jnlib instead of defining our /* We include the type defintions from jnlib instead of defining our

View File

@ -1,3 +1,8 @@
2004-12-18 Werner Koch <wk@g10code.com>
* scdaemon.h (map_assuan_err): Define in terms of
map_assuan_err_with_source.
2004-12-15 Werner Koch <wk@g10code.com> 2004-12-15 Werner Koch <wk@g10code.com>
* scdaemon.c [W32]: Various hacks to make it run under W32. * scdaemon.c [W32]: Various hacks to make it run under W32.

View File

@ -26,6 +26,9 @@
#endif #endif
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_SCD #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_SCD
#include <gpg-error.h> #include <gpg-error.h>
#define map_assuan_err(a) \
map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a))
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>

View File

@ -1,3 +1,10 @@
2004-12-18 Werner Koch <wk@g10code.com>
* 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 <wk@g10code.com> 2004-12-17 Werner Koch <wk@g10code.com>
* call-dirmngr.c (isvalid_status_cb, lookup_status_cb) * call-dirmngr.c (isvalid_status_cb, lookup_status_cb)

View File

@ -168,7 +168,7 @@ start_agent (ctrl_t ctrl)
if (rc) if (rc)
return map_assuan_err (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.display, opt.ttyname, opt.ttytype,
opt.lc_ctype, opt.lc_messages); opt.lc_ctype, opt.lc_messages);
} }

View File

@ -26,6 +26,9 @@
#endif #endif
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGSM #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGSM
#include <gpg-error.h> #include <gpg-error.h>
#define map_assuan_err(a) \
map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a))
#include <ksba.h> #include <ksba.h>
#include "../common/util.h" #include "../common/util.h"