+2003-01-30 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.texi (Engine Information): Rewritten.
+
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
@section Engine Information
@cindex engine, information about
-@deftypefun {const char *} gpgme_get_engine_info (void)
-The function @code{gpgme_get_engine_info} returns an @acronym{XML}
-string containing information about the available protocols and the
-engine which implement them. The following information is returned
-for each engine:
-
-@table @samp
-@item <protocol>
-The name of the protocol.
-@item <version>
-The version of the engine.
-@item <path>
-The path to the engine binary.
+@deftp {Data type} {GpgmeEngineInfo}
+@tindex GpgmeProtocol
+The @code{GpgmeEngineInfo} type specifies a pointer to a structure
+describing a crypto backend engine. The structure contains the
+following elements:
+
+@table @code
+@item GpgmeEngineInfo next
+This is a pointer to the next engine info structure in the linked
+list, or @code{NULL} if this is the last element.
+
+@item GpgmeProtocol protocol
+This is the protocol for which the crypo engine is used. You can
+convert this to a string with @code{gpgme_get_protocol_name} for
+printing.
+
+@item const char *path
+This is a string holding the path to the executable of the crypto
+engine. Currently, it is never @code{NULL}, but using @code{NULL} is
+reserved for future use, so always check before you use it.
+
+@item const char *version
+This is a string containing the version number of the crypto engine.
+It might be @code{NULL} if the version number can not be determined,
+for example because the executable doesn't exist or is invalid.
+
+@item const char *req_version
+This is a string containing the minimum required version number of the
+crypto engine for @acronym{GPGME} to work correctly. This is the
+version number that @code{gpgme_engine_check_version} verifies
+against. Currently, it is never @code{NULL}, but using @code{NULL} is
+reserved for future use, so always check before you use it.
@end table
+@end deftp
-A string is always returned. If an error occurs, the string will
-contain an @samp{<error>} tag with a description of the failure.
+@deftypefun GpgmeError gpgme_get_engine_info (GpgmeEngineInfo *info)
+The function @code{gpgme_get_engine_info} returns a linked list of
+engine info structures in @var{info}. Each info structure describes
+one configured crypto backend engine.
+
+The memory for the info structures is allocated the first time this
+function is invoked, and must not be freed by the caller.
+
+This function returns @code{GPGME_No_Error} if successful, and
+@code{GPGME_Out_Of_Core} if not enough memory is available for the
+operation.
@end deftypefun
-Here is the example output of what @code{gpgme_get_engine_info} might
-return on your system:
+Here is the example how you can provide more diagnostics if you
+receive an error message which indicates that the crypto engine is
+invalid.
@example
-<EngineInfo>
- <engine>
- <protocol>OpenPGP</protocol>
- <version>1.0.6</version>
- <path>/usr/bin/gpg</path>
- </engine>
- <engine>
- <protocol>CMS</protocol>
- <version>0.0.0</version>
- <path>/usr/bin/gpgsm</path>
- </engine>
-</EngineInfo>
+GpgmeCtx ctx;
+GpgmeError err;
+
+[...]
+
+if (err == GPGME_Invalid_Engine)
+ @{
+ GpgmeEngineInfo info;
+ err = gpgme_get_engine_info (&info);
+ if (!err)
+ @{
+ while (info && info->protocol != gpgme_get_protocol (ctx))
+ info = info->next;
+ if (!info)
+ fprintf (stderr, "GPGME compiled without support for protocol %s",
+ gpgme_get_protocol_name (info->protocol));
+ else if (info->path && !info->version)
+ fprintf (stderr, "Engine %s not installed properly",
+ info->path);
+ else if (info->path && info->version && info->req_version)
+ fprintf (stderr, "Engine %s version %s installed, "
+ "but at least version %s required", info->path,
+ info->version, info->req_version);
+ else
+ fprintf (stderr, "Unknown problem with engine for protocol %s",
+ gpgme_get_protocol_name (info->protocol));
+ @}
+ @}
@end example
+2003-01-30 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.h (enum GpgmeProtocol): Remove GPGME_PROTOCOL_AUTO.
+ * gpgme.c (gpgme_set_protocol): Don't handle GPGME_PROTOCOL_AUTO.
+ (gpgme_get_protocol_name): New function.
+
+ * engine-backend.h (struct engine_ops): New member
+ get_req_version, remove member check_version.
+ * engine.h (_gpgme_Engine_get_version): New prototype.
+ * rungpg.c (gpg_get_req_version): New function.
+ (gpg_check_version): Function removed.
+ (_gpgme_engine_ops_gpg): Add gpg_get_req_version, remove
+ gpg_check_version.
+ * engine-gpgsm.c (gpgsm_get_req_version): New function.
+ (gpgsm_check_version): Function removed.
+ (_gpgme_engine_ops_gpgsm): Add gpgsm_get_req_version, remove
+ gpgsm_check_version.
+ * engine.c: Include ops.h.
+ (_gpgme_engine_get_req_version): New function.
+ (gpgme_engine_check_version): Rewritten.
+ * version.c (gpgme_get_engine_info): Rewritten.
+ * gpgme.h (gpgme_engine_info): New structure.
+ (GpgmeEngineInfo): New type.
+
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* types.h: Remove byte and ulong types.
/* Static functions. */
const char *(*get_path) (void);
const char *(*get_version) (void);
- GpgmeError (*check_version) (void);
+ const char *(*get_req_version) (void);
GpgmeError (*new) (void **r_engine);
/* Member functions. */
}
-static GpgmeError
-gpgsm_check_version (void)
+static const char *
+gpgsm_get_req_version (void)
{
- return _gpgme_compare_versions (gpgsm_get_version (), NEED_GPGSM_VERSION)
- ? 0 : GPGME_Invalid_Engine;
+ return NEED_GPGSM_VERSION;
}
/* Static functions. */
_gpgme_get_gpgsm_path,
gpgsm_get_version,
- gpgsm_check_version,
+ gpgsm_get_req_version,
gpgsm_new,
/* Member functions. */
#include "gpgme.h"
#include "util.h"
#include "sema.h"
+#include "ops.h"
#include "engine.h"
#include "engine-backend.h"
const char *
_gpgme_engine_get_path (GpgmeProtocol proto)
{
- if (proto > sizeof (engine_ops) / sizeof (engine_ops[0]))
+ if (proto > DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_path)
const char *
_gpgme_engine_get_version (GpgmeProtocol proto)
{
- if (proto > sizeof (engine_ops) / sizeof (engine_ops[0]))
+ if (proto > DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_version)
}
+/* Get the required version number of the engine for PROTOCOL. */
+const char *
+_gpgme_engine_get_req_version (GpgmeProtocol proto)
+{
+ if (proto > DIM (engine_ops))
+ return NULL;
+
+ if (engine_ops[proto] && engine_ops[proto]->get_req_version)
+ return (*engine_ops[proto]->get_req_version) ();
+ else
+ return NULL;
+}
+
+
/* Verify the version requirement for the engine for PROTOCOL. */
GpgmeError
gpgme_engine_check_version (GpgmeProtocol proto)
{
- if (proto > sizeof (engine_ops) / sizeof (engine_ops[0]))
- return GPGME_Invalid_Value;
-
- if (!engine_ops[proto])
- return GPGME_Invalid_Engine;
-
- if (engine_ops[proto]->check_version)
- return (*engine_ops[proto]->check_version) ();
- else
- return 0;
+ return _gpgme_compare_versions (_gpgme_engine_get_version (proto),
+ _gpgme_engine_get_req_version (proto))
+ ? 0 : GPGME_Invalid_Engine;
}
const char *path;
const char *version;
- if (proto > sizeof (engine_ops) / sizeof (engine_ops[0]))
+ if (proto > DIM (engine_ops))
return GPGME_Invalid_Value;
if (!engine_ops[proto])
/* Get the version number of the engine for PROTOCOL. */
const char *_gpgme_engine_get_version (GpgmeProtocol proto);
+/* Get the version number of the engine for PROTOCOL. */
+const char *_gpgme_engine_req_version (GpgmeProtocol proto);
+
/* Verify the version requirement for the engine for PROTOCOL. */
const char *_gpgme_engine_get_info (GpgmeProtocol proto);
case GPGME_PROTOCOL_CMS:
ctx->use_cms = 1;
break;
- case GPGME_PROTOCOL_AUTO:
- return GPGME_Not_Implemented;
default:
return GPGME_Invalid_Value;
}
}
+const char *
+gpgme_get_protocol_name (GpgmeProtocol protocol)
+{
+ switch (protocol)
+ {
+ case GPGME_PROTOCOL_OpenPGP:
+ return "OpenPGP";
+
+ case GPGME_PROTOCOL_CMS:
+ return "CMS";
+
+ default:
+ return NULL;
+ }
+}
+
/**
* gpgme_set_armor:
* @ctx: the context
{
GPGME_PROTOCOL_OpenPGP = 0, /* The default mode. */
GPGME_PROTOCOL_CMS = 1,
- GPGME_PROTOCOL_AUTO = 2
}
GpgmeProtocol;
#define GPGME_KEYLIST_MODE_EXTERN 2
#define GPGME_KEYLIST_MODE_SIGS 4
+/* The engine information structure. */
+struct _gpgme_engine_info
+{
+ struct _gpgme_engine_info *next;
+
+ /* The protocol ID. */
+ GpgmeProtocol protocol;
+
+ /* The path to the engine binary. */
+ const char *path;
+
+ /* The version string of the installed engine. */
+ const char *version;
+
+ /* The minimum version required for GPGME. */
+ const char *req_version;
+};
+typedef struct _gpgme_engine_info *GpgmeEngineInfo;
+
+
/* Types for callback functions. */
/* Request a passphrase from the user. */
/* Get the protocol used with CTX */
GpgmeProtocol gpgme_get_protocol (GpgmeCtx ctx);
+/* Get the string describing protocol PROTO, or NULL if invalid. */
+const char *gpgme_get_protocol_name (GpgmeProtocol proto);
+
/* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */
void gpgme_set_armor (GpgmeCtx ctx, int yes);
const char *gpgme_check_version (const char *req_version);
/* Retrieve information about the backend engines. */
-const char *gpgme_get_engine_info (void);
+GpgmeError gpgme_get_engine_info (GpgmeEngineInfo *engine_info);
/* Return a string describing ERR. */
const char *gpgme_strerror (GpgmeError err);
}
-static GpgmeError
-gpg_check_version (void)
+static const char *
+gpg_get_req_version (void)
{
- return _gpgme_compare_versions (gpg_get_version (), NEED_GPG_VERSION)
- ? 0 : GPGME_Invalid_Engine;
+ return NEED_GPG_VERSION;
}
/* Static functions. */
_gpgme_get_gpg_path,
gpg_get_version,
- gpg_check_version,
+ gpg_get_req_version,
gpg_new,
/* Member functions. */
/* version.c - version check
Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002 g10 Code GmbH
+ Copyright (C) 2001, 2002, 2003 g10 Code GmbH
This file is part of GPGME.
return _gpgme_compare_versions (VERSION, req_version);
}
-/**
- * gpgme_get_engine_info:
- *
- * Return information about the underlying crypto engines. This is an
- * XML string with various information. A string is always returned
- * even if the crypto engines is not installed; in this case a XML
- * string with some error information is returned.
- *
- * Return value: A XML string with information about the crypto
- * engines.
- **/
-const char *
-gpgme_get_engine_info ()
+
+/* Get the information about the configured and installed engines. A
+ pointer to the first engine in the statically allocated linked list
+ is returned in *INFO. If an error occurs, it is returned. */
+GpgmeError
+gpgme_get_engine_info (GpgmeEngineInfo *info)
{
- static const char *engine_info;
+ static GpgmeEngineInfo engine_info;
DEFINE_STATIC_LOCK (engine_info_lock);
LOCK (engine_info_lock);
if (!engine_info)
{
- const char *openpgp_info = _gpgme_engine_get_info (GPGME_PROTOCOL_OpenPGP);
- const char *cms_info = _gpgme_engine_get_info (GPGME_PROTOCOL_CMS);
- char *info;
+ GpgmeEngineInfo *lastp = &engine_info;
+ GpgmeProtocol proto_list[] = { GPGME_PROTOCOL_OpenPGP,
+ GPGME_PROTOCOL_CMS };
+ int proto;
- if (!openpgp_info && !cms_info)
- info = "<EngineInfo>\n</EngineInfo>\n";
- else if (!openpgp_info || !cms_info)
+ for (proto = 0; proto < DIM (proto_list); proto++)
{
- const char *fmt = "<EngineInfo>\n"
- "%s"
- "</EngineInfo>\n";
+ const char *path = _gpgme_engine_get_path (proto_list[proto]);
- info = malloc (strlen (fmt)
- + strlen (openpgp_info
- ? openpgp_info : cms_info) + 1);
- if (info)
- sprintf (info, fmt, openpgp_info ? openpgp_info : cms_info);
- }
- else
- {
- const char *fmt = "<EngineInfo>\n"
- "%s%s"
- "</EngineInfo>\n";
- info = malloc (strlen (fmt) + strlen (openpgp_info)
- + strlen (cms_info) + 1);
- if (info)
- sprintf (info, fmt, openpgp_info, cms_info);
+ if (!path)
+ continue;
+
+ *lastp = malloc (sizeof (*engine_info));
+ if (!*lastp)
+ {
+ while (engine_info)
+ {
+ GpgmeEngineInfo next_info = engine_info->next;
+ free (engine_info);
+ engine_info = next_info;
+ }
+ UNLOCK (engine_info_lock);
+ return GPGME_Out_Of_Core;
+ }
+
+ (*lastp)->protocol = proto_list[proto];
+ (*lastp)->path = path;
+ (*lastp)->version = _gpgme_engine_get_version (proto_list[proto]);
+ (*lastp)->req_version
+ = _gpgme_engine_get_req_version (proto_list[proto]);
+ lastp = &(*lastp)->next;
}
- if (!info)
- info = "<EngineInfo>\n"
- " <error>Out of core</error>\n"
- "</EngineInfo>\n";
- engine_info = info;
}
UNLOCK (engine_info_lock);
- return engine_info;
+ *info = engine_info;
+ return 0;
}
-
\f
#define LINELENGTH 80
+2003-01-30 Marcus Brinkmann <marcus@g10code.de>
+
+ * Makefile.am (TESTS): Add t-engine-info.
+ * t-engine-info.c: New file.
+ * gpg/t-encrypt.c (main): Don't print engine info.
+ * gpg/t-eventloop.c (main): Likewise.
+ * gpg/t-encrypt-sign.c (main): Likewise.
+ * gpgsm/t-encrypt.c (main): Likewise.
+
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-verify.c (main): Adjust caller of gpgme_op_verify.
TESTS_ENVIRONMENT = GNUPGHOME=.
-TESTS = t-version t-data
+TESTS = t-version t-data t-engine-info
EXTRA_DIST = t-data-1.txt t-data-2.txt
/* t-encrypt-sign.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 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 General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002, 2003 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 General Public License as published by
+ the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
- puts ( gpgme_get_engine_info() );
do {
err = gpgme_new (&ctx);
/* t-encrypt.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001 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 General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002, 2003 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 General Public License as published by
+ the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
- puts ( gpgme_get_engine_info() );
do {
err = gpgme_new (&ctx);
/* t-eventloop.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 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 General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002, 2003 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 General Public License as published by
+ the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
- puts (gpgme_get_engine_info ());
do
{
/* t-encrypt.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001 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 General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002, 2003 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 General Public License as published by
+ the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS);
fail_if_err (err);
- puts ( gpgme_get_engine_info() );
do {
err = gpgme_new (&ctx);
--- /dev/null
+/* t-engine-info.c - Regression test for gpgme_get_engine_info.
+ Copyright (C) 2003 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 General Public License as published by
+ the Free Software Foundation; either version 2 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+\f
+#define fail_if_err(err) \
+ do \
+ { \
+ if (err) \
+ { \
+ fprintf (stderr, "%s:%d: GpgmeError %s\n", \
+ __FILE__, __LINE__, gpgme_strerror (err)); \
+ exit (1); \
+ } \
+ } \
+ while (0)
+
+\f
+void
+check_engine_info (GpgmeEngineInfo info, GpgmeProtocol protocol,
+ const char *path, const char *req_version)
+{
+ if (info->protocol != protocol)
+ {
+ fprintf (stderr, "Unexpected protocol %i (expected %i instead)\n",
+ info->protocol, protocol);
+ exit (1);
+ }
+ if (strcmp (info->path, path))
+ {
+ fprintf (stderr, "Unexpected path to executable %s (expected %s instead)",
+ info->path, path);
+ exit (1);
+ }
+ if (strcmp (info->req_version, req_version))
+ {
+ fprintf (stderr, "Unexpected required version %s (expected %s instead)",
+ info->req_version, req_version);
+ exit (1);
+ }
+}
+
+
+int
+main (int argc, char **argv )
+{
+ GpgmeEngineInfo info;
+ GpgmeError err;
+
+ err = gpgme_get_engine_info (&info);
+ fail_if_err (err);
+
+ check_engine_info (info, GPGME_PROTOCOL_OpenPGP, GPG_PATH, NEED_GPG_VERSION);
+
+ info = info->next;
+#ifdef GPGSM_PATH
+ check_engine_info (info, GPGME_PROTOCOL_CMS, GPGSM_PATH, NEED_GPGSM_VERSION);
+#else
+ if (info)
+ {
+ fprintf (stderr, "Unexpected engine info.\n");
+ exit (1);
+ }
+#endif
+
+ return 0;
+}