Maintainer: Marcus Brinkmann <marcus@g10code.com>
Bug reports: bug-gpgme@gnupg.org
Security related bug reports: security@gnupg.org
+License: LGPLv2.1+
FSF <gnu@gnu.org>
* Interface changes relative to the 1.1.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_signature_t EXTENDED: New field chain_model.
+ gpgme_op_getauditlog_start NEW.
+ gpgme_op_getauditlog NEW.
+ GPGME_AUDITLOG_HTML NEW.
+ GPGME_AUDITLOG_WITH_HELP NEW.
Noteworthy changes in version 1.1.5 (2007-07-09)
* Made the W32 support more robust.
- Copyright 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
+ Copyright 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
if (rc)
{
if (ctx->log_fp)
- fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Error: %s]\n",
+ fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Error: %s (%d)]\n",
assuan_get_assuan_log_prefix (),
(unsigned int)getpid (), ctx->inbound.fd,
- strerror (errno));
+ strerror (errno), errno);
return _assuan_error (ASSUAN_Read_Error);
}
if (!nread)
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
+# License along with this program; if not, see <http://www.gnu.org/licenses/>.
cat <<EOF
/* Generated automatically by mkerrors */
/* Do not edit! See mkerrors for copyright notice. */
unsigned int n;
if (!err_source)
- return (oldcode & 0x00ffffff); /* Make sure that the gpg-error
- source part is cleared. */
+ {
+ if (oldcode == -1)
+ return -1;
+ else
+ return (oldcode & 0x00ffffff); /* Make sure that the gpg-error
+ source part is cleared. */
+ }
switch (oldcode)
{
switch (errno)
{
case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break;
+ case EAGAIN:
+ if (errno > 0 && errno < 4096)
+ {
+ n = (EAGAIN | (1 << 15));
+ break;
+ }
default: n = 270; /*GPG_ERR_ASS_READ_ERROR*/ break;
}
break;
switch (errno)
{
case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break;
+ case EAGAIN:
+ if (errno > 0 && errno < 4096)
+ {
+ n = (EAGAIN | (1 << 15));
+ break;
+ }
default: n = 271; /*GPG_ERR_ASS_WRITE_ERROR*/ break;
}
break;
an error is indeed returned. */
n = 16381; /*GPG_ERR_MISSING_ERRNO*/
break;
- case ENOMEM: n = (1 << 15) | 86; break;
+ case ENOMEM:
+ if (errno > 0 && errno < 4096)
+ {
+ n = (ENOMEM | (1 << 15));
+ break;
+ }
default:
n = 16382; /*GPG_ERR_UNKNOWN_ERRNO*/
break;
+2007-11-22 Werner Koch <wk@g10code.com>
+
+ * gpgme.h (gpgme_op_getauditlog_start, gpgme_op_getauditlog): New.
+ * libgpgme.vers: Ditto.
+ * gpgme.def: Ditto.
+ * getauditlog.c: New.
+ * engine-backend.h (struct engine_ops): Add member GETAUDITLOG.
+ * engine-gpgsm.c (gpgsm_getauditlog): New.
+ (_gpgme_engine_ops_gpgsm): Insert new function.
+ (gpgsm_new): Try to enable audit log support.
+ * rungpg.c (_gpgme_engine_ops_gpg): Insert dummy entry.
+
2007-11-20 Werner Koch <wk@g10code.com>
* op-support.c (_gpgme_parse_inv_recp): Add new reason code 11.
encrypt.c encrypt-sign.c decrypt.c decrypt-verify.c verify.c \
sign.c passphrase.c progress.c \
key.c keylist.c trust-item.c trustlist.c \
- import.c export.c genkey.c delete.c edit.c \
+ import.c export.c genkey.c delete.c edit.c getauditlog.c \
engine.h engine-backend.h engine.c rungpg.c status-table.h \
$(gpgsm_components) sema.h priv-io.h $(system_components) \
debug.c debug.h gpgme.c version.c error.c
gpgme_error_t (*verify) (void *engine, gpgme_data_t sig,
gpgme_data_t signed_text,
gpgme_data_t plaintext);
-
+ gpgme_error_t (*getauditlog) (void *engine, gpgme_data_t output,
+ unsigned int flags);
+
void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs);
void (*io_event) (void *engine, gpgme_event_io_t type, void *type_data);
}
}
+ /* Ask gpgsm to enable the audit log support. */
+ if (!err)
+ {
+ err = assuan_transact (gpgsm->assuan_ctx, "OPTION enable-audit-log=1",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ if (gpg_err_code (err) == GPG_ERR_UNKNOWN_OPTION)
+ err = 0; /* This is an optional feature of gpgsm. */
+ }
+
#if !USE_DESCRIPTOR_PASSING
if (!err
&& (_gpgme_io_set_close_notify (gpgsm->input_cb.fd,
}
+/* Send the GETAUDITLOG command. The result is saved to a gpgme data
+ object. */
+static gpgme_error_t
+gpgsm_getauditlog (void *engine, gpgme_data_t output, unsigned int flags)
+{
+ engine_gpgsm_t gpgsm = engine;
+ gpgme_error_t err = 0;
+
+ if (!gpgsm || !output)
+ return gpg_error (GPG_ERR_INV_VALUE);
+
+ gpgsm->output_cb.data = output;
+ err = gpgsm_set_fd (gpgsm, OUTPUT_FD, 0);
+ if (err)
+ return err;
+
+ gpgsm_clear_fd (gpgsm, INPUT_FD);
+ gpgsm_clear_fd (gpgsm, MESSAGE_FD);
+
+ err = start (gpgsm, "GETAUDITLOG");
+
+ return err;
+}
+
+
+
static void
gpgsm_set_status_handler (void *engine, engine_status_handler_t fnc,
void *fnc_value)
gpgsm_sign,
NULL, /* trustlist */
gpgsm_verify,
+ gpgsm_getauditlog,
gpgsm_set_io_cbs,
gpgsm_io_event,
gpgsm_cancel
}
+gpgme_error_t
+_gpgme_engine_op_getauditlog (engine_t engine, gpgme_data_t output,
+ unsigned int flags)
+{
+ if (!engine)
+ return gpg_error (GPG_ERR_INV_VALUE);
+
+ if (!engine->ops->getauditlog)
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+
+ return (*engine->ops->getauditlog) (engine->engine, output, flags);
+}
+
+
void
_gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs)
{
gpgme_data_t signed_text,
gpgme_data_t plaintext);
+gpgme_error_t _gpgme_engine_op_getauditlog (engine_t engine,
+ gpgme_data_t output,
+ unsigned int flags);
+
void _gpgme_engine_set_io_cbs (engine_t engine,
gpgme_io_cbs_t io_cbs);
void _gpgme_engine_io_event (engine_t engine,
--- /dev/null
+/* getauditlog.c - Retrieve the audit log.
+ Copyright (C) 2007 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gpgme.h"
+#include "context.h"
+#include "ops.h"
+
+\f
+static gpgme_error_t
+getauditlog_status_handler (void *priv, gpgme_status_code_t code, char *args)
+{
+ return 0;
+}
+
+
+static gpgme_error_t
+getauditlog_start (gpgme_ctx_t ctx, int synchronous,
+ gpgme_data_t output, unsigned int flags)
+{
+ gpgme_error_t err;
+
+ if (!output)
+ return gpg_error (GPG_ERR_INV_VALUE);
+
+ err = _gpgme_op_reset (ctx, synchronous);
+ if (err)
+ return err;
+
+ _gpgme_engine_set_status_handler (ctx->engine,
+ getauditlog_status_handler, ctx);
+
+ return _gpgme_engine_op_getauditlog (ctx->engine, output, flags);
+}
+
+
+
+/* Return the auditlog for the current session. This may be called
+ after a successful or failed operation. If no audit log is
+ available GPG_ERR_NO_DATA is returned. This is the asynchronous
+ variant. */
+gpgme_error_t
+gpgme_op_getauditlog_start (gpgme_ctx_t ctx,
+ gpgme_data_t output, unsigned int flags)
+{
+ return getauditlog_start (ctx, 0, output, flags);
+}
+
+
+/* Return the auditlog for the current session. This may be called
+ after a successful or failed operation. If no audit log is
+ available GPG_ERR_NO_DATA is returned. This is the synchronous
+ variant. */
+gpgme_error_t
+gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags)
+{
+ gpgme_error_t err = getauditlog_start (ctx, 1, output, flags);
+ if (!err)
+ err = _gpgme_wait_one (ctx);
+ return err;
+}
+
gpgme_get_giochannel @121
gpgme_get_fdptr @122
+ gpgme_op_getauditlog_start @123
+ gpgme_op_getauditlog @124
+
; END
typedef unsigned int gpgme_keylist_mode_t;
+\f
+/* Flags for the audit log functions. */
+#define GPGME_AUDITLOG_HTML 1
+#define GPGME_AUDITLOG_WITH_HELP 128
+
\f
/* Signature notations. */
const void *reserved, int idx)
_GPGME_DEPRECATED;
+\f
+/* Return the auditlog for the current session. This may be called
+ after a successful or failed operation. If no audit log is
+ available GPG_ERR_NO_DATA is returned. */
+gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output,
+ unsigned int flags);
+gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output,
+ unsigned int flags);
+
+
\f
/* Various functions. */
gpgme_sig_notation_get;
gpgme_free;
+
+ gpgme_op_getauditlog_start;
+ gpgme_op_getauditlog;
};
gpg_sign,
gpg_trustlist,
gpg_verify,
+ NULL,
gpg_set_io_cbs,
gpg_io_event,
gpg_cancel
}
+static void
+show_auditlog (gpgme_ctx_t ctx)
+{
+ gpgme_error_t err;
+ gpgme_data_t data;
+
+ err = gpgme_data_new (&data);
+ fail_if_err (err);
+ err = gpgme_op_getauditlog (ctx, data, 0);
+ fail_if_err (err);
+ gpgme_data_release (data);
+}
+
+
+
int
main (int argc, char **argv)
{
"3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
GPG_ERR_NO_ERROR, GPGME_VALIDITY_FULL);
+ show_auditlog (ctx);
+
/* Checking a manipulated message. */
gpgme_data_release (text);
err = gpgme_data_new_from_mem (&text, test_text1f, strlen (test_text1f), 0);