[svn] gpgme - r1279 - in trunk: gpgme tests tests/gpgsm
svn author wk
cvs at cvs.gnupg.org
Fri Nov 23 14:07:14 CET 2007
Author: wk
Date: 2007-11-23 14:07:04 +0100 (Fri, 23 Nov 2007)
New Revision: 1279
Modified:
trunk/gpgme/ChangeLog
trunk/gpgme/getauditlog.c
trunk/gpgme/op-support.c
trunk/tests/ChangeLog
trunk/tests/gpgsm/t-verify.c
Log:
Make getauditlog work. For now only when configured with --enable-fd-passing.
Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog 2007-11-22 16:44:37 UTC (rev 1278)
+++ trunk/gpgme/ChangeLog 2007-11-23 13:07:04 UTC (rev 1279)
@@ -1,3 +1,8 @@
+2007-11-23 Werner Koch <wk at 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 at g10code.com>
* gpgme.h (gpgme_op_getauditlog_start, gpgme_op_getauditlog): New.
Modified: trunk/gpgme/getauditlog.c
===================================================================
--- trunk/gpgme/getauditlog.c 2007-11-22 16:44:37 UTC (rev 1278)
+++ trunk/gpgme/getauditlog.c 2007-11-23 13:07:04 UTC (rev 1279)
@@ -42,7 +42,7 @@
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;
Modified: trunk/gpgme/op-support.c
===================================================================
--- trunk/gpgme/op-support.c 2007-11-22 16:44:37 UTC (rev 1278)
+++ trunk/gpgme/op-support.c 2007-11-23 13:07:04 UTC (rev 1279)
@@ -62,16 +62,24 @@
/* 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 @@
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))
Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog 2007-11-22 16:44:37 UTC (rev 1278)
+++ trunk/tests/ChangeLog 2007-11-23 13:07:04 UTC (rev 1279)
@@ -1,3 +1,10 @@
+2007-11-23 Werner Koch <wk at 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 at g10code.de>
* t-engine-info.c (check_engine_info): Fix debug output.
Modified: trunk/tests/gpgsm/t-verify.c
===================================================================
--- trunk/tests/gpgsm/t-verify.c 2007-11-22 16:44:37 UTC (rev 1278)
+++ trunk/tests/gpgsm/t-verify.c 2007-11-23 13:07:04 UTC (rev 1279)
@@ -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 @@
{
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 @@
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 @@
"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;
}
More information about the Gnupg-commits
mailing list