/* type is: 0: asynchronous operation (use global or user event loop).
1: synchronous operation (always use private event loop).
2: asynchronous private operation (use private or user
- event loop). */
+ event loop).
+ 256: Modification flag to suppress the engine reset.
+*/
gpgme_error_t
_gpgme_op_reset (gpgme_ctx_t ctx, int type)
{
gpgme_error_t err = 0;
struct gpgme_io_cbs io_cbs;
+ int no_reset = (type & 256);
+ int reuse_engine = 0;
+
+ type &= 255;
_gpgme_release_result (ctx);
- if (ctx->engine)
+ if (ctx->engine && no_reset)
+ reuse_engine = 1;
+ else if (ctx->engine)
{
/* Attempt to reset an existing engine. */
return err;
}
- err = _gpgme_engine_set_locale (ctx->engine, LC_CTYPE, ctx->lc_ctype);
+ if (!reuse_engine)
+ {
+ err = _gpgme_engine_set_locale (ctx->engine, LC_CTYPE, ctx->lc_ctype);
#ifdef LC_MESSAGES
- if (!err)
- err = _gpgme_engine_set_locale (ctx->engine,
- LC_MESSAGES, ctx->lc_messages);
+ if (!err)
+ err = _gpgme_engine_set_locale (ctx->engine,
+ LC_MESSAGES, ctx->lc_messages);
#endif
-
- if (err)
- {
- _gpgme_engine_release (ctx->engine);
- ctx->engine = NULL;
- return err;
+ if (err)
+ {
+ _gpgme_engine_release (ctx->engine);
+ ctx->engine = NULL;
+ return err;
+ }
}
if (type == 1 || (type == 2 && !ctx->io_cbs.add))
#include "t-support.h"
\f
+static int got_errors;
+
static const char test_text1[] = "Hallo Leute!\n";
static const char test_text1f[]= "Hallo Leute?\n";
static const char test_sig1[] =
{
fprintf (stderr, "%s:%i: Unexpected number of signatures\n",
__FILE__, __LINE__);
- exit (1);
+ got_errors = 1;
}
if (sig->summary != summary)
{
fprintf (stderr, "%s:%i: Unexpected signature summary: "
"want=0x%x have=0x%x\n",
__FILE__, __LINE__, summary, sig->summary);
- exit (1);
+ got_errors = 1;
}
if (strcmp (sig->fpr, fpr))
{
fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n",
__FILE__, __LINE__, sig->fpr);
- exit (1);
+ got_errors = 1;
}
if (gpg_err_code (sig->status) != status)
{
fprintf (stderr, "%s:%i: Unexpected signature status: %s\n",
__FILE__, __LINE__, gpgme_strerror (sig->status));
- exit (1);
+ got_errors = 1;
}
if (sig->notations)
{
fprintf (stderr, "%s:%i: Unexpected notation data\n",
__FILE__, __LINE__);
- exit (1);
+ got_errors = 1;
}
if (sig->wrong_key_usage)
{
fprintf (stderr, "%s:%i: Unexpectedly wrong key usage\n",
__FILE__, __LINE__);
- exit (1);
+ got_errors = 1;
}
if (sig->validity != validity)
{
fprintf (stderr, "%s:%i: Unexpected validity: %i\n",
__FILE__, __LINE__, sig->validity);
- exit (1);
+ got_errors = 1;
}
if (gpg_err_code (sig->validity_reason) != GPG_ERR_NO_ERROR)
{
fprintf (stderr, "%s:%i: Unexpected validity reason: %s\n",
__FILE__, __LINE__, gpgme_strerror (sig->validity_reason));
- exit (1);
+ got_errors = 1;
}
}
err = gpgme_data_new (&data);
fail_if_err (err);
err = gpgme_op_getauditlog (ctx, data, 0);
- fail_if_err (err);
+ if (err)
+ {
+ fprintf (stderr, "%s:%i: Can't get audit log: %s\n",
+ __FILE__, __LINE__, gpgme_strerror (err));
+ got_errors = 1;
+ }
+ print_data (data);
gpgme_data_release (data);
}
"3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
GPG_ERR_BAD_SIGNATURE, GPGME_VALIDITY_UNKNOWN);
+ show_auditlog (ctx);
+
gpgme_data_release (text);
gpgme_data_release (sig);
gpgme_release (ctx);
- return 0;
+ return got_errors? 1 : 0;
}