Make getauditlog work. For now only when configured with --enable-fd-passing.
This commit is contained in:
parent
4dbd2fbdfe
commit
c07011580a
@ -1,3 +1,8 @@
|
||||
2007-11-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
* op-support.c (_gpgme_op_reset): Implement a no-reset flag.
|
||||
* getauditlog.c (getauditlog_start): Use that flag.
|
||||
|
||||
2007-11-22 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgme.h (gpgme_op_getauditlog_start, gpgme_op_getauditlog): New.
|
||||
|
@ -42,7 +42,7 @@ getauditlog_start (gpgme_ctx_t ctx, int synchronous,
|
||||
if (!output)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
err = _gpgme_op_reset (ctx, ((synchronous&255) | 256) );
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -62,16 +62,24 @@ _gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type, void **hook,
|
||||
/* 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. */
|
||||
|
||||
@ -99,18 +107,20 @@ _gpgme_op_reset (gpgme_ctx_t ctx, int type)
|
||||
return err;
|
||||
}
|
||||
|
||||
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);
|
||||
#endif
|
||||
|
||||
if (err)
|
||||
if (!reuse_engine)
|
||||
{
|
||||
_gpgme_engine_release (ctx->engine);
|
||||
ctx->engine = NULL;
|
||||
return err;
|
||||
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);
|
||||
#endif
|
||||
if (err)
|
||||
{
|
||||
_gpgme_engine_release (ctx->engine);
|
||||
ctx->engine = NULL;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 1 || (type == 2 && !ctx->io_cbs.add))
|
||||
|
@ -1,3 +1,10 @@
|
||||
2007-11-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgsm/t-verify.c (check_result): Don't exit on error but set a flag.
|
||||
(main): Cosnult flag for return value.
|
||||
(show_auditlog): New.
|
||||
(main): Use it.
|
||||
|
||||
2007-09-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* t-engine-info.c (check_engine_info): Fix debug output.
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "t-support.h"
|
||||
|
||||
|
||||
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[] =
|
||||
@ -60,50 +62,50 @@ check_result (gpgme_verify_result_t result, int summary, char *fpr,
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +119,13 @@ show_auditlog (gpgme_ctx_t ctx)
|
||||
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);
|
||||
}
|
||||
|
||||
@ -164,8 +172,10 @@ main (int argc, char **argv)
|
||||
"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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user