Page MenuHome GnuPG

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/ChangeLog b/ChangeLog
index 5cb11bcd..4c77add1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,805 +1,809 @@
+2008-01-04 Marcus Brinkmann <marcus@g10code.de>
+
+ * configure.ac: Support gpgconf.
+
2007-09-27 Marcus Brinkmann <marcus@g10code.de>
* assuan-pipe-connect.c (pipe_connect_gpgme): Do not close process
handle here. Use this function also on Unix systems.
* assuan-pipe-connect.c (pipe_connect_gpgme): Fix last change.
* assuan-pipe-connect.c (pipe_connect_gpgme): New function, use it
if _ASSUAN_IN_GPGME_BUILD_ASSUAN.
2007-09-17 Werner Koch <wk@g10code.com>
* configure.ac: Use the svn version magic.
2007-09-07 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Check for C++, Qt and support --enable-w32-qt.
* m4/pkg.m4: New file.
2007-08-21 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (--enable-w32-glib): Use --enableval, not
--withval.
2007-07-16 Marcus Brinkmann <marcus@g10code.de>
* assuan/assuan-socket.c (_assuan_close): Always use close().
* assuan/assuan.h (_gpgme_io_close): New prototype.
(close): New macro, define as _gpgme_io_close.
2007-07-13 Marcus Brinkmann <marcus@g10code.de>
* assuan/assuan-io.c (_assuan_simple_read, _assuan_simple_write):
Always use read/write (which means _gpgme_io_read and
_gpgme_io_write).
2007-07-09 Marcus Brinkmann <marcus@g10code.de>
Released 1.1.5.
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
2007-07-08 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (GPGSM_DEFAULT) [*-mingw32*]: Initialize it.
(HAVE_ASSUAN_H): Set to 1 if we have it.
(funopen): Use AC_REPLACE_FUNCS.
(USE_DESCRIPTOR_PASSING): Define to 1 if we have it. Do not
define it at all if we don't.
(NETLIBS) [have_w32_system]: Add -lws2_32.
(DIRSEP_C, DIRSEP_S, EXPSEP_C, EXPSEP_S, PATHSEP_S)
[HAVE_DOSISH_SYSTEM]: Remove definitions.
* assuan/assuan.h (_assuan_funopen): Define to _gpgme_funopen.
* assuan/funopen.c: Move to ../gpgme/funopen.c.
* assuan/Makefile.am (libassuan_la_SOURCES): Remove funopen.c.
2007-07-04 Marcus Brinkmann <marcus@g10code.de>
* assuan/Makefile.am (INCLUDES): Include $(top_srcdir)/gpgme.
* assuan/assuan.h: Include <ath.h> instead of trying to duplicate
the definitions.
* assuan/: Update files to 2007-07-04 version of assuan.
* autogen.sh: Use = not == in test.
2007-03-05 Werner Koch <wk@g10code.com>
Released 1.1.4.
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
* autogen.sh: New option --force.
2007-01-29 Marcus Brinkmann <marcus@g10code.de>
Released 1.1.3.
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
2007-01-26 Werner Koch <wk@g10code.com>
* configure.ac: Changed gpg and gpgsm version checks to work with
arbitrary names of the gpg binary. New option --disable-gpg-test
and --disable-gpgsm-test.
2007-01-09 Werner Koch <wk@g10code.com>
* configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION): Must define
after it may have been changed by an option.
2007-01-08 Werner Koch <wk@g10code.com>
* configure.ac: Require gpg-error 1.4 due to the use of
gpg_error_from_syserror.
(HAVE_ASSUAN_H): New.
2007-01-05 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add options --with-gpg-version and
--with-gpgsm-version to allow overriding the minimum version
requirements.
2006-12-17 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Fix two typos in last change.
2006-12-03 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Use descriptor passing only if --enable-fd-passing
is provided.
* configure.ac: Add check for use of descriptor passing.
2006-11-29 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_GPG_VERSION): Bump to 1.3.0.
2006-09-19 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Turn stpcpy into a replacement function.
Check for unistd.h and add setenv as replacement function.
2006-07-29 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Check for network libraries and set NETLIBS.
2006-07-06 Marcus Brinkmann <marcus@g10code.de>
* lang, lang/cl: New subdirectories.
* lang/Makefile.am, lang/README: New files.
* configure.ac (AC_CONFIG_FILES): Add lang/Makefile,
lang/cl/Makefile and lang/cl/gpgme.asd.
* Makefile.am (SUBDIRS): Add lang.
2006-03-02 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
2006-02-22 Marcus Brinkmann <marcus@g10code.de>
Released 1.1.1.
* configure.ac (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump for
release.
(LIBGPGME_LT_REVISION): Reset to 0 for release.
2006-01-05 Werner Koch <wk@g10code.com>
* configure.ac: Test for inline feature.
(AH_BOTTOM): New to define the pure attribute.
2006-01-03 Werner Koch <wk@g10code.com>
* configure.ac: Append SVN revision to the version.
2005-11-18 Werner Koch <wk@g10code.com>
* configure.ac (BUILD_REVISION): New.
2005-11-17 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add support for --enable-w32-glib (disabled by
default). Invoke AM_PATH_GLIB_2_0.
2005-11-16 Werner Koch <wk@g10code.com>
* configure.ac (CFLAGS) [W32]: Make sure that -mms-bitfields are used.
2005-11-15 Werner Koch <wk@g10code.com>
* configure.ac: Create BUILD_FILEVERSION from SVN Revision.
* autogen.sh [W32]: Build shared and static versions of the library.
2005-10-20 Marcus Brinkmann <marcus@g10code.de>
* w32-dll/ChangeLog, w32-dll/build-dll, w32-dll/gpgme.def: Remove
files.
* configure.ac: Instead checking for windres and dlltool, invoke
AC_LIBTOOL_WIN32_DLL and AC_LIBTOOL_RC.
* src/Makefile.am [HAVE_W32_SYSTEM]: Use libtool, which simplifies
the rules.
2005-10-01 Marcus Brinkmann <marcus@g10code.de>
Released 1.1.0.
* configure.ac (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump for
release.
(LIBGPGME_LT_REVISION): Reset to 0 for release.
2005-09-12 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (HAVE_PTH): Don't add $PTH_CFLAGS to $CFLAGS here.
2005-08-26 Werner Koch <wk@g10code.com>
* configure.ac (SEPCONSTANTS): New to define DIRSEP_C et al.
2005-08-19 Werner Koch <wk@g10code.com>
* configure.ac [W32]: Create values for versioninfo.rc and list
substuture versioninfo.rc.
* configure.ac: Define ENABLE_GPGSM.
2005-08-08 Werner Koch <wk@g10code.com>
* configure.ac (stpcpy): Changed from replace to test.
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AH_BOTTOM): Removed.
2005-03-09 Werner Koch <wk@g10code.com>
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
* Makefile.am (EXTRA_DIST): Include autogen.sh
* autogen.sh: Added the usual code to build for W32 (--build-w32).
* configure.ac: Fixed the mingw32 host string, removed OS/2 stuff.
(HAVE_DRIVE_LETTERS): Removed.
(HAVE_W32_SYSTEM): Added.
(AC_GNU_SOURCE): New to replace the identical AH_VERBATIM.
(AH_BOTTOM): Added.
2004-12-28 Werner Koch <wk@g10code.com>
Released 1.0.2.
* Makefile.am (AUTOMAKE_OPTIONS): Build bzip 2 version.
(ACLOCAL_AMFLAGS): Add -I m4.
* configure.ac: Require automake 1.9.3 and autoconf 2.59.
* acinclude.m4: Changed quoting for automake 1.9.
* README: Use SHA1 instead of MD5.
2004-12-11 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Replace ttyname_r if it doesn't exist (and warn in
that case).
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README: Refer to COPYING.LESSER and "each file" instead of
COPYING.
* COPYING.LESSER: New file.
* gpgme.spec.in (%doc): Add COPYING.LESSER.
* acinclude.m4, configure.ac, Makefile.am: Change license to LGPL
2.1 or later.
* TODO: Add copyright notice.
* README.CVS: Likewise.
* configure.ac (GPGSM_VERSION): Fix filter to get it.
2004-10-22 Marcus Brinkmann <marcus@g10code.de>
Released 1.0.1.
* configure.ac (LIBGPGME_LT_REVISION): Bump up to 2.
(AC_INIT): Set version to 1.0.1.
* configure.ac: Set HAVE_GPGSM to true only if $GPGSM is not "no".
2004-09-30 Marcus Brinkmann <marcus@g10code.de>
Released 1.0.0.
* configure.ac (LIBGPGME_LT_REVISION): Bump up to 1.
(AC_INIT): Set version to 1.0.0.
* Makefile.am (EXTRA_DIST): Remove README-alpha.
* README-alpha: Remove file.
2004-09-17 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Disable AC_CONFIG_MACRO_DIR for now.
2004-09-14 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Improve diagnostics with version check.
* configure.ac: Print diagnostics about found thread libraries at
the end. Check for the versions of GPG and GPGSM and print the
found versions at the end.
(HAVE_GPGSM): Do not require GPGSM to exist and be readable.
(AC_CONFIG_MACRO_DIR): Invoke with argument m4.
* acinclude.m4: Add copyright notice.
(jm_GLIBC21, AM_PATH_GPG_ERROR, _AC_PTH_ERROR, _AC_PTH_VERBOSE,
AC_CHECK_PTH): Removed.
2004-06-23 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Check for <sys/uio.h>.
2004-06-08 Marcus Brinkmann <marcus@g10code.de>
Released 0.9.0.
* configure.ac (AC_INIT): Set version number to 0.9.0.
(LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump up by one.
(LIBGPGME_LT_REVISION): Reset to zero.
2004-05-21 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (GPGME_CONFIG_API_VERSION): New variable,
substitute it.
2004-04-29 Marcus Brinkmann <marcus@g10code.de>
Released 0.4.7.
* configure.ac (LIBGPGME_LT_REVISION): Bump it up.
2004-04-02 Thomas Schwinge <schwinge@nic-nac-project.de>
* autogen.sh: Added ACLOCAL_FLAGS.
2004-04-06 Werner Koch <wk@gnupg.org>
Released 0.4.6.
* config.guess, config.sub, ltmain.sh: Updated to those from
libtools 1.5.4.
2004-03-07 Marcus Brinkmann <marcus@g10code.de>
Released 0.4.5.
* configure.ac (NEED_GPGSM_VERSION): Bump up to 1.9.6.
* Makefile.am (EXTRA_DIST): Remove autogen.sh and README.CVS.
2004-02-18 Werner Koch <wk@gnupg.org>
* configure.ac: Make the check for funopen fail with just a
warning.
2004-02-11 Werner Koch <wk@gnupg.org>
* autogen.sh (check_version): Removed bashism and simplified.
2004-02-10 Werner Koch <wk@gnupg.org>
* configure.ac: Fixed funopen test change.
2004-02-06 Moritz Schulte <mo@g10code.com>
* configure.ac: Fix funopen replacement mechanism.
2004-01-31 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add invocation of AC_SYS_LARGEFILE, AC_TYPE_OFF_T
and AC_FUNC_FSEEKO.
2004-01-12 Werner Koch <wk@gnupg.org>
Released 0.4.4.
* configure.ac: Bumbed LT_Revision; now at C12/A1/R1.
(NEED_GPGSM_VERSION): Set to 1.9.3.
(min_automake_version): Added.
* README.CVS: New.
* Makefile.am (EXTRA_DIST): Added README.CVS.
* autogen.sh: Updated.
2003-11-19 Werner Koch <wk@gnupg.org>
* acinclude.m4: Add AM_PATH_GPG_ERROR.
* configure.ac: Check for timegm. Made warning messages more
prominent.
2003-10-06 Marcus Brinkmann <marcus@g10code.de>
Released 0.4.3.
* configure.ac (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump up by 1.
(LIBGPGME_LT_REVISION): Set to 0.
2003-09-13 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Require libgpg-error 0.5.
* acinclude.m4: Remove libtool cruft, add jm_GLIBC21.
* configure.ac: Add check for getenv_r, and call jm_GLIBC21.
Define HAVE_THREAD_SAFE_GETENV if appropriate.
2003-09-03 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Remove GPGME_CONFIG_LIBS and GPGME_CONFIG_CFLAGS.
2003-09-02 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Move invocation of AC_CANONICAL_HOST up to
suppress warning by autoconf.
2003-08-30 Robert Schiele <rschiele@uni-mannheim.de>
* gpgme.spec.in: %{_infodir}/dir is not packaged,
remove to prevent checking failure.
2003-08-18 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: If building Assuan, check for funopen and
fopencookie, and make isascii, putc_unlocked and memrchr
replacement functions.
(AM_PATH_GPG_ERROR): Require 0.3.
2003-07-31 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AC_INIT): Bump version to 0.4.3.
2003-07-30 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (LIBGPGME_LT_REVISION): Bump up to 1.
Released 0.4.2.
2003-07-08 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Complain if libgpg-error is not found.
2003-06-22 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AC_INIT): Bump version to 0.4.2.
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (LIBGPGME_LT_CURRENT): Bump up to 11.
* configure.ac: Use AM_PATH_GPG_ERROR.
* configure.ac: Check for libgpg-error. Define
GPG_ERR_SOURCE_DEFAULT.
2003-05-26 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_GPG_VERSION): Bump up to 1.2.2.
2003-05-18 Marcus Brinkmann <marcus@g10code.de>
In all files, replace the Gpgme* type names with the new gpgme_*
type names.
2003-02-01 Marcus Brinkmann <marcus@g10code.de>
* assuan/: Update files to 2002-11-10 version of assuan.
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* bonobo/gpgme.c, bonobo/main.c, bonobo/main.h, bonobo/Makefile,
bonobo/Makefile.am, bonobo/Makefile.in: Dead files removed.
* configure.ac: Remove automake conditional BUILD_BONOBO
(AC_CONFIG_FILES): Remove bonobo/Makefile.
* Makefile.am (bonobo): Remove variable.
(SUBDIRS): Remove ${bonobo}.
* configure.ac: Remove all uses of GNUPG_CHECK_TYPEDEF, for byte,
ushort, ulong, u16 and u32.
* acinclude.m4 (GNUPG_CHECK_TYPEDEF): Remove macro.
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: New conditional HAVE_LD_VERSION_SCRIPT.
Call AC_CANONICAL_HOST, use host instead target.
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Bump up to 0.4.1.
Released 0.4.0.
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* autogen.sh (automake_vers): Require 1.7 (really 1.7.1) for the
conditional source distribution bug fix.
2002-12-08 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (LIBGPGME_LT_CURRENT): Increase by one.
(LIBGPGME_LT_AGE, LIBGPGME_LT_REVISION): Set to 0.
2002-11-28 Marcus Brinkmann <marcus@g10code.de>
* NEWS: Add note about moving "gpgmeplug" to the "cryptplug"
package.
* README: Remove instructions related to "gpgmeplug".
* configure.ac: Remove enable option "gpgmeplug" and automake
conditional BUILD_GPGMEPLUG, as well as the status info about it.
(GPGMEPLUG): Remove variable.
* Makefile.am (gpgmeplug): Remove variable.
(SUBDIRS): Remove ${gpgmeplug}.
* cryptplug.h, gpgme-openpgp.c, gpgmeplug.dox, gpgme-smime.c,
Makefile.am, gpgmeplug.c, ChangeLog: Files removed.
2002-11-22 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Disable GPGSM for all dosish systems.
2002-10-12 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add automake conditional HAVE_GPGSM.
2002-10-08 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AC_INIT): Bump version up to 0.4.0.
(NEED_GPG_VERSION): Bump up to 1.2.0.
(NEED_GPGSM_VERSION): Bump up to 0.9.0.
* README: Update version numbers.
* NEWS: Start entry for 0.4.0.
2002-09-20 Werner Koch <wk@gnupg.org>
Released 0.3.11.
* configure.ac: Bump up LIBGPGME_LT_REVISION.
* configure.ac (AC_CHECK_HEADERS): Check for sys/select.h.
2002-09-04 Marcus Brinkmann <marcus@g10code.de>
* autogen.sh (autoconf_vers): Bump up to 2.53 to get the @&t@
quadrigraph. Always cutting the edge!
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Create and substitute LTLIBOBJS.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
Released 0.3.10.
* NEWS: Update for 0.3.9 release.
* configure.ac: Bump up LIBGPGME_LT_REVISION.
2002-08-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.spec.in: Changed user name in Wojciech Polak's email
address from ghostface to polak per request by himself.
2002-08-28 Werner Koch <wk@gnupg.org>
* acinclude.m4 (GNUPG_CHECK_VA_COPY): New.
* configure.ac: Use it.
2002-08-23 Werner Koch <wk@gnupg.org>
* configure.ac (GPGME_CONFIG_CFLAGS): Renamed from GPGME_CFLAGS
and removed the libpath because it is set by the config script.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Bump version number to 0.3.10.
* NEWS: Add template for development version.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
Released 0.3.9.
* NEWS: Update for 0.3.9 release.
* Makefile.am (EXTRA_DIST): Add gpgme.spec.in.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
* jnlib/argparse.c, jnlib/argparse.h, jnlib/ChangeLog,
jnlib/dotlock.c, jnlib/dotlock.h, jnlib/libjnlib-config.h,
jnlib/logging.c, jnlib/logging.h,jnlib/Makefile.am,
jnlib/mischelp.h, jnlib/README, jnlib/stringhelp.c,
jnlib/stringhelp.h, jnlib/strlist.c, jnlib/strlist.h,
jnlib/types.h, jnlib/xmalloc.c, jnlib/xmalloc.h: Remove files.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (SUBDIRS): Remove jnlib.
* configure.ac: Don't check for unsigned short or unsigned long.
Don't check for memicmp, strlwr, strtoul, memmove, stricmp.
Make stpcpy a replaced function.
Don't define HAVE_JNLIB_LOGGING.
Don't generate jnlib/Makefile.
2002-07-02 Werner Koch <wk@gnupg.org>
* configure.ac: Bumbed version number to 0.3.9; add a comment on
when to change it.
* gpgme.spec.in: New. Contributed by Wojciech Polak.
* Makefile.am (dist-hook): New.
* AUTHORS: Added Wojciech and bug reporting addresses.
2002-06-25 Werner Koch <wk@gnupg.org>
Released 0.3.8.
* configure.ac: Bumbed LT version to 9/3/0.
(NEED_GPGSM_VERSION): Need 0.3.8 due to fixed export command.
2002-06-04 Marcus Brinkmann <marcus@g10code.de>
Released 0.3.7.
* configure.ac (AC_INIT): Set version to 0.3.7.
(LIBGPGME_LT_REVISION): Add one.
* README: Document version requirement correctly.
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* acinclude.m4: Fix Pth check so that it doesn't error out if pth
is not found.
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add checks for Pth and pthreads.
* acinclude.m4: Add slightly hacked check for pth (seems to be an
autoconf version problem).
2002-05-21 Werner Koch <wk@gnupg.org>
* configure.ac (NEED_GPGSM_VERSION): We need gpgsm 0.3.7.
2002-05-03 Werner Koch <wk@gnupg.org>
Released 0.3.6.
2002-04-05 Marcus Brinkmann <marcus@g10code.de>
* acconfig.h: File removed.
* configure.ac (NEED_GPG_VERSION): Add description.
(NEED_GPGSM_VERSION): Likewise.
(HAVE_DOSISH_SYSTEM): Likewise.
(HAVE_DRIVE_LETTERS): Likewise.
(GPG_PATH): Likewise.
(GPGSM_PATH): Likewise.
* acinclude.m4 (GNUPG_CHECK_TYPEDEF): Likewise.
2002-04-01 Werner Koch <wk@gnupg.org>
Released 0.3.5.
2002-03-17 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add automake conditional HAVE_DOSISH_SYSTEM.
2002-03-04 Werner Koch <wk@gnupg.org>
* configure.ac: Bumbed version to 0.3.4-cvs to continue development.
Released 0.3.4.
* configure.ac: Bumbed LT version numbers to (7,1,0), requires
gpgsm 0.3.1.
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AC_INIT): Change version number to snapshot CVS
version.
2002-02-13 Werner Koch <wk@gnupg.org>
* configure.ac (vasprintf,fopencookie): Add checks.
2002-02-12 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AC_INIT): Bump version to 0.3.3.
* jnlib/Makefile.am: Rever to older version that includes xmalloc
but not dotlock and some other files. Reported by Stéphane
Corthésy.
2002-02-10 Marcus Brinkmann <marcus@g10code.de>
* Released 0.3.2.
* configure.ac (AC_INIT): Bump version to 0.3.2.
* jnlib/libjnlibconfig.h: Revert to older version that doesn't
expect libgcrypt. Reported by Jose Carlos Garcia Sogo
<jsogo@debian.org>.
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
* Released 0.3.1.
* configure.ac (LIBGPGME_LT_CURRENT): Bump it up to 6!
(NEED_GPGSM_VERSION): Bump it up to 0.3.0!
(AC_INIT): Bump version to 0.3.1
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (HAVE_JNLIB_LOGGING): Define always for assuan.
2001-12-19 Werner Koch <wk@gnupg.org>
* configure.ac (VERSION,PACKAGE): Defined and subst. Used for
AM_INIT_AUTOMAKE and moved all version number more to the top.
2001-12-18 Marcus Brinkmann <marcus@g10code.de>
* autogen.sh (libtool_vers): Bump to 1.4.
* configure.ac (LIBGPGME_LT_CURRENT): Increment.
(LIBGPGME_LT_AGE): Reset.
Improve comment.
Fix wrong comment character.
2001-12-18 Werner Koch <wk@gnupg.org>
* acinclude.m4 (GNUPG_FIX_HDR_VERSION): Fixed for new automake.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (GPG): Substitute this variable.
(GPGSM): Likewise.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (AC_CONFIG_FILES): Add tests/gpg/Makefile and
tests/gpgsm/Makefile.
2001-11-21 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (gpgmeplug): New variable, set to gpgmeplug if
[BUILD_GPGMEPLUG].
* configure.ac (AC_CONFIG_FILES): Add gpgmeplug/Makefile.
Support --enable-gpgmeplug.
2001-11-21 Marcus Brinkmann <marcus@g10code.de>
* autogen.sh: Tighten version dependencies.
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (SUBDIRS): Support building the assuan library
(currently if GPGSM_PATH is set)..
* configure.ac: Support building the assuan library.
* assuan: New directory, populated with the Assuan library
(copied from the newpg repository).
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_GPGSM_VERSION): New variable. Treat it
similarly to NEED_GPG_VERSION.
* acconfig.h: Likewise.
2001-11-18 Marcus Brinkmann <marcus@g10code.de>
* configure.in: Renamed to ...
* configure.ac: ... this. Update to autoconf 2.52. Lots of small
changes in the transition. Support --with-gpg=PATH and
--with-gpgsm=PATH options. Check if test suites can be run.
* acconfig.h: Add GPGSM_PATH.
* Makefile.am: New variable `tests', set to `tests' if
RUN_GPG_TESTS.
(SUBDIRS): Replace string `tests' with variable `tests'.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* autogen.sh: Invoke automake with `-a' (add missing files).
Do not invoke configure.
2001-09-17 Werner Koch <wk@gnupg.org>
Released 0.2.3.
* configure.in (NEED_GPG_VERSION): Set to 1.0.6. Incremented LT
current and age.
* Makefile.am (SUBDIRS): Add doc
2001-06-12 Werner Koch <wk@gnupg.org>
Released 0.2.2.
2001-04-05 Werner Koch <wk@gnupg.org>
* configure.in (NEED_GPG_VERSION): Set to 1.0.4g
2001-04-02 Werner Koch <wk@gnupg.org>
Released 0.2.1.
Changed the copyright notices all over the place.
2001-02-28 Werner Koch <wk@gnupg.org>
Released 0.2.0.
2001-01-18 Werner Koch <wk@gnupg.org>
* autogen.sh: Added option --build-w32.
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 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
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/configure.ac b/configure.ac
index 5145d128..fcae5ab5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,645 +1,767 @@
# configure.ac for GPGME
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
# (Process this file with autoconf to produce a configure script.)
AC_PREREQ(2.59)
min_automake_version="1.9.3"
# Version number: Remember to change it immediately *after* a release.
# Make sure to run "svn up" and "./autogen.sh --force"
# before a "make dist". See below for the LT versions.
#
# The SVN version is usually the next intended release version with
# the string "-svnNNN" appended. The reason for this is that tests for a
# specific feature can already be done under the assumption that the
# SVN version is the most recent one in a branch. To disable the SVN
# version for the real release, set the my_issvn macro to no.
m4_define(my_version, [1.1.6])
m4_define(my_issvn, [yes])
m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
|| echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
AC_INIT([gpgme], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
[bug-gpgme@gnupg.org])
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
LIBGPGME_LT_CURRENT=17
# Subtract 2 from this value if you want to make the LFS transition an
# ABI break. [Note to self: Remove this comment with the next regular break.]
LIBGPGME_LT_AGE=6
LIBGPGME_LT_REVISION=4
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
##############################################
BUILD_REVISION=svn_revision
PACKAGE=$PACKAGE_NAME
VERSION=$PACKAGE_VERSION
AC_CONFIG_SRCDIR(gpgme/gpgme.h)
dnl FIXME: Enable this with autoconf 2.59.
dnl AC_CONFIG_MACRO_DIR(m4)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
# Enable GNU extensions on systems that have them.
AC_GNU_SOURCE
AH_VERBATIM([_REENTRANT],
[/* To allow the use of GPGME in multithreaded programs we have to use
special features from the library.
IMPORTANT: gpgme is not yet fully reentrant and you should use it
only from one thread. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif])
AC_PROG_CC
AC_PROG_CXX
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
# Don't default to build static libs.
AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_RC
AC_PROG_LIBTOOL
# For now we hardcode the use of version scripts. It would be better
# to write a test for this or even implement this within libtool.
have_ld_version_script=no
case "${host}" in
*-*-linux*)
have_ld_version_script=yes
;;
*-*-gnu*)
have_ld_version_script=yes
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
GPG_DEFAULT=no
GPGSM_DEFAULT=no
+GPGCONF_DEFAULT=no
component_system=None
have_dosish_system=no
have_w32_system=no
build_w32_glib=no
build_w32_qt=no
case "${host}" in
*-mingw32*)
# special stuff for Windoze NT
have_dosish_system=yes
have_w32_system=yes
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
+ GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
#component_system='COM+'
AM_PATH_GLIB_2_0
AC_ARG_ENABLE(w32-glib,
AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
build_w32_glib=$enableval)
# Check disabled, because the qt-dev packages in gpg4win do
# not provide any support for cross compilation.
# PKG_CHECK_MODULES(QT4_CORE, QtCore)
# Use it like this:
# ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
AC_SUBST(QT4_CORE_CFLAGS)
AC_SUBST(QT4_CORE_LIBS)
AC_ARG_ENABLE(w32-qt,
AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
build_w32_qt=$enableval)
;;
*)
AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
if test "$have_pth" = yes; then
AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
fi
AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
if test "$have_pthread" = yes; then
AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
fi
# XXX: Probably use exec-prefix here?
# GPG_DEFAULT='/usr/bin/gpg'
# GPGSM_DEFAULT='/usr/bin/gpgsm'
+# GPGCONF_DEFAULT='/usr/bin/gpgconf'
;;
esac
if test "$have_dosish_system" = yes; then
AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
[Defined if we run on some of the PCDOS like systems
(DOS, Windoze. OS/2) with special properties like
no file modes])
fi
AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
# Checks for header files.
AC_CHECK_HEADERS(sys/select.h)
# Type checks.
AC_C_INLINE
AC_CHECK_SIZEOF(unsigned int)
AC_SYS_LARGEFILE
AC_TYPE_OFF_T
# Checks for compiler features.
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
if test "$have_w32_system" = yes; then
CFLAGS="$CFLAGS -mms-bitfields"
fi
fi
# Network library fun.
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
[NETLIBS="-lnsl $NETLIBS"]))
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
[NETLIBS="-lsocket $NETLIBS"]))
AC_SUBST(NETLIBS)
# Checks for library functions.
AC_FUNC_FSEEKO
AC_REPLACE_FUNCS(vasprintf)
if test "$ac_cv_func_vasprintf" != yes; then
GNUPG_CHECK_VA_COPY
fi
# Try to find a thread-safe version of ttyname().
AC_REPLACE_FUNCS(ttyname_r)
if test "$ac_cv_func_ttyname_r" != yes; then
AC_MSG_WARN([
***
*** ttyname() is not thread-safe and ttyname_r() does not exist
***])
fi
# Try to find a thread-safe version of getenv().
have_thread_safe_getenv=no
jm_GLIBC21
if test $GLIBC21 = yes; then
have_thread_safe_getenv=yes
fi
if test $have_thread_safe_getenv = yes; then
AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
fi
have_getenv_r=no
AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
AC_MSG_WARN([
***
*** getenv() is not thread-safe and getenv_r() does not exist
***])
fi
# For converting time strings to seconds since Epoch, we need the timegm
# function.
AC_CHECK_FUNCS(timegm)
if test "$ac_cv_func_timegm" != yes; then
AC_MSG_WARN([
***
*** timegm() not available - a non-thread-safe kludge will be used
*** and the TZ variable might be changed at runtime.
***])
fi
# Checking for libgpg-error.
AM_PATH_GPG_ERROR(1.4,, AC_MSG_ERROR([libgpg-error was not found]))
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
[The default error source for GPGME.])
# Checks for system services
NEED_GPG_VERSION_DEFAULT=1.3.0
NEED_GPGSM_VERSION_DEFAULT=1.9.6
+NEED_GPGCONF_VERSION_DEFAULT=2.0.4
NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
+NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
AC_ARG_WITH(gpg-version,
AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
NEED_GPG_VERSION=$withval)
if test "$NEED_GPG_VERSION" = "yes"; then
NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
fi
if test "$NEED_GPG_VERSION" = "no"; then
NEED_GPG_VERSION=0.0.0
fi
AC_ARG_WITH(gpgsm-version,
AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
NEED_GPGSM_VERSION=$withval)
if test "$NEED_GPGSM_VERSION" = "yes"; then
NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
fi
if test "$NEED_GPGSM_VERSION" = "no"; then
NEED_GPGSM_VERSION=0.0.0
fi
+AC_ARG_WITH(gpgconf-version,
+ AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
+ NEED_GPGCONF_VERSION=$withval)
+if test "$NEED_GPGCONF_VERSION" = "yes"; then
+ NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
+fi
+if test "$NEED_GPGCONF_VERSION" = "no"; then
+ NEED_GPGCONF_VERSION=0.0.0
+fi
AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
[Min. needed GnuPG version.])
AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
[Min. needed GPGSM version.])
+AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
+ [Min. needed GPGCONF version.])
NO_OVERRIDE=no
AC_ARG_WITH(gpg,
AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
GPG=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
AC_PATH_PROG(GPG, gpg)
fi
if test -z "$GPG"; then
GPG="$GPG_DEFAULT"
fi
fi
if test "$GPG" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([
***
*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
***])
else
AC_MSG_ERROR([
***
*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
***])
fi
fi
else
AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
AC_SUBST(GPG)
fi
dnl Check for GnuPG version requirement.
GPG_VERSION=unknown
ok=maybe
if test -z "$GPG" -o "x$GPG" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
ok=no
else
if test ! -x "$GPG"; then
AC_MSG_WARN([GnuPG not executable, version check disabled])
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
req_major=`echo $NEED_GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $NEED_GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $NEED_GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
major=`echo $GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
if test "$ok" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
fi
fi
run_gpg_test="$ok"
AC_ARG_ENABLE(gpg-test,
AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
run_gpg_test=$enableval)
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
AC_SUBST(GPG_PATH)
NO_OVERRIDE=no
AC_ARG_WITH(gpgsm,
AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
GPGSM=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
AC_PATH_PROG(GPGSM, gpgsm)
fi
if test -z "$GPGSM"; then
GPGSM="$GPGSM_DEFAULT"
fi
fi
if test "$GPGSM" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([
***
*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
***])
else
AC_MSG_ERROR([
***
*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
***])
fi
fi
else
AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
fi
AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
dnl Check for GPGSM version requirement.
GPGSM_VERSION=unknown
ok=maybe
if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
ok=no
else
if test ! -x "$GPGSM"; then
AC_MSG_WARN([GPGSM not executable, version check disabled])
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
req_major=`echo $NEED_GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $NEED_GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $NEED_GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
major=`echo $GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
if test "$ok" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
fi
fi
run_gpgsm_test="$ok"
AC_ARG_ENABLE(gpgsm-test,
AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
run_gpgsm_test=$enableval)
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
+NO_OVERRIDE=no
+AC_ARG_WITH(gpgconf,
+ AC_HELP_STRING([--with-gpgconf=PATH],
+ [use gpgconf binary at PATH]),
+ GPGCONF=$withval, NO_OVERRIDE=yes)
+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
+ GPGCONF=
+ NO_OVERRIDE=yes
+ if test "$cross_compiling" != "yes"; then
+ AC_PATH_PROG(GPGCONF, gpgconf)
+ fi
+ if test -z "$GPGCONF"; then
+ GPGCONF="$GPGCONF_DEFAULT"
+ fi
+fi
+if test "$GPGCONF" = no; then
+ if test "$NO_OVERRIDE" = "yes"; then
+ if test "$cross_compiling" != "yes"; then
+ AC_MSG_WARN([
+***
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+***])
+ else
+ AC_MSG_ERROR([
+***
+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
+***])
+ fi
+ fi
+else
+ AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
+ AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
+fi
+AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
+
+dnl Check for GPGCONF version requirement.
+GPGCONF_VERSION=unknown
+ok=maybe
+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
+ ok=no
+else
+ if test "$cross_compiling" = "yes"; then
+ AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
+ ok=no
+ else
+ if test ! -x "$GPGCONF"; then
+ AC_MSG_WARN([GPGCONF not executable, version check disabled])
+ ok=no
+ fi
+ fi
+fi
+if test "$ok" = "maybe"; then
+ AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
+ req_major=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+ req_minor=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+ req_micro=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
+ major=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+ minor=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+ micro=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test "$ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
+ fi
+fi
+run_gpgconf_test="$ok"
+AC_ARG_ENABLE(gpgconf-test,
+ AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
+ run_gpgconf_test=$enableval)
+AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
+
+# Only build if supported.
+AM_CONDITIONAL(BUILD_GPGCONF, test "$GPGCONF" != "no")
+if test "$GPGCONF" != "no"; then
+ AC_DEFINE(HAVE_GPGCONF, 1,
+ [Defined if we are building with gpgconf support.])
+fi
+
+
# FIXME: Only build if supported.
AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
if test "$GPGSM" != "no"; then
AC_DEFINE(HAVE_ASSUAN_H, 1,
[Defined if we are building with assuan support.])
fi
# Check for funopen
AC_CHECK_FUNCS(funopen)
if test $ac_cv_func_funopen != yes; then
# No funopen but we can implement that in terms of fopencookie.
AC_CHECK_FUNCS(fopencookie)
if test $ac_cv_func_fopencookie = yes; then
AC_REPLACE_FUNCS(funopen)
else
AC_MSG_WARN([
***
*** No implementation of fopencookie or funopen available
***])
fi
fi
# More assuan replacement functions.
AC_REPLACE_FUNCS(isascii)
AC_REPLACE_FUNCS(putc_unlocked)
AC_REPLACE_FUNCS(memrchr)
AC_REPLACE_FUNCS(stpcpy)
# Check for unistd.h for setenv replacement function.
AC_CHECK_HEADERS(unistd.h)
AC_REPLACE_FUNCS(setenv)
# More assuan checks.
AC_CHECK_HEADERS([sys/uio.h])
# Assuan check for descriptor passing.
AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
[supports_descriptor_passing=yes],
[supports_descriptor_passing=no
AC_MSG_WARN([
***
*** Data structure for sending ancillary data missing.
*** Descriptor passing won't work.
***])],[
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#if HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#include <unistd.h>
])
AC_ARG_ENABLE(fd-passing,
AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
use_descriptor_passing=$enableval)
if test "$supports_descriptor_passing" != "yes"; then
use_descriptor_passing=no
fi
if test "$use_descriptor_passing" = "yes"; then
AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
[Defined if descriptor passing is enabled and supported])
fi
AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
# Assuan check for the getsockopt SO_PEERCRED
AC_MSG_CHECKING(for SO_PEERCRED)
AC_CACHE_VAL(assuan_cv_sys_so_peercred,
[AC_TRY_COMPILE([#include <sys/socket.h>],
[struct ucred cr;
int cl = sizeof cr;
getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
assuan_cv_sys_so_peercred=yes,
assuan_cv_sys_so_peercred=no)
])
AC_MSG_RESULT($assuan_cv_sys_so_peercred)
if test $assuan_cv_sys_so_peercred = yes; then
AC_DEFINE(HAVE_SO_PEERCRED, 1,
[Defined if SO_PEERCRED is supported (Linux specific)])
fi
if test "$have_w32_system" = yes; then
NETLIBS="-lws2_32 $NETLIBS"
fi
# End of assuan checks.
AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
# Make the version number in gpgme/gpgme.h the same as the one here.
# (this is easier than to have a *.in file just for one substitution)
GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
# Generate values for the DLL version info
if test "$have_w32_system" = yes; then
BUILD_TIMESTAMP=`date --iso-8601=minutes`
changequote(,)dnl
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
fi
AC_SUBST(BUILD_REVISION)
AC_SUBST(BUILD_TIMESTAMP)
AC_SUBST(BUILD_FILEVERSION)
# Add a few constants to help porting to W32
AH_VERBATIM([SEPCONSTANTS],
[
/* Separators as used in $PATH. */
#ifdef HAVE_DOSISH_SYSTEM
#define PATHSEP_C ';'
#else
#define PATHSEP_C ':'
#endif
])
AH_BOTTOM([
/* Definition of GCC specific attributes. */
#if __GNUC__ > 2
# define GPGME_GCC_A_PURE __attribute__ ((__pure__))
#else
# define GPGME_GCC_A_PURE
#endif
])
# Substitution used for gpgme-config
GPGME_CONFIG_LIBS="-lgpgme"
GPGME_CONFIG_CFLAGS=""
AC_SUBST(GPGME_CONFIG_API_VERSION)
AC_SUBST(GPGME_CONFIG_LIBS)
AC_SUBST(GPGME_CONFIG_CFLAGS)
# Frob'da Variables
LTLIBOBJS=`echo "$LIB@&t@OBJS" |
sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
AC_SUBST(LTLIBOBJS)
#
# Create config files
AC_CONFIG_FILES(Makefile assuan/Makefile gpgme/Makefile
tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
doc/Makefile complus/Makefile
gpgme/versioninfo.rc)
AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
AC_OUTPUT
echo "
GPGME v${VERSION} has been configured as follows:
- GnuPG path: $GPG
- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
+ GnuPG path: $GPG
+ GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
+
+ GpgSM path: $GPGSM
+ GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
- GpgSM path: $GPGSM
- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
+ GpgConf path: $GPGCONF
+ GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
- GPGME Pthread: $have_pthread
- GPGME Pth: $have_pth
+ GPGME Pthread: $have_pthread
+ GPGME Pth: $have_pth
"
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index f942d83c..ea6a9a01 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,5610 +1,5642 @@
+2008-01-04 Marcus Brinkmann <marcus@g10code.de>
+
+ * Makefile.am (gpgconf_components): New variable.
+ (main_sources): Add gpgconf.c.
+ * gpgme.h (gpgme_protocol_t): New protocol GPGME_PROTOCOL_GPGCONF.
+ (gpgme_conf_level_t, gpgme_conf_type_t, gpgme_conf_arg_t)
+ (gpgme_conf_opt_t, gpgme_conf_comp_t, gpgme_conf_arg_new)
+ (gpgme_conf_arg_release, gpgme_conf_opt_change)
+ (gpgme_conf_release, gpgme_op_conf_load, gpgme_op_conf_save): New
+ types.
+ * gpgconf.c, engine-gpgconf.c: New files.
+ * engine.h: (_gpgme_engine_op_conf_load,
+ (_gpgme_engine_op_conf_save): New prototypes.
+ * op-support.c (_gpgme_op_reset): Ignore not implemented locale
+ function.
+ * posix-util.c (_gpgme_get_gpgconf_path): New function.
+ * w32-util.c (_gpgme_get_gpgconf_path): New function.
+ * engine-gpgsm.c:
+ (_gpgme_engine_ops_gpgsm): Add stubs for conf_load and conf_save.
+ * rungpg.c:
+ (_gpgme_engine_ops_gpg): Add stubs for conf_load and conf_save.
+ * gpgme.def: Add new gpgconf related interfaces.
+ * libgpgme.vers: Likewise.
+ * util.h (_gpgme_get_gpgconf_path): New prototype.
+ * gpgme.h (gpgme_protocol_t): Add GPGME_PROTOCOL_GPGCONF.
+ * engine-backend.h (_gpgme_engine_ops_gpgconf): New prototype.
+ (struct engine_ops): Add members for conf_load and conf_save.
+ * engine.c (engine_ops): Add _gpgme_engine_ops_gpgconf.
+ (_gpgme_engine_op_conf_load,
+ (_gpgme_engine_op_conf_save): New functions.
+ (gpgme_get_engine_info): Allow protocol GPGME_PROTOCOL_GPGCONF.
+
2007-11-28 Marcus Brinkmann <marcus@g10code.de>
* w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Search
for installation directory. Remove old fallback default.
(find_program_in_inst_dir): New function.
2007-11-26 Werner Koch <wk@g10code.com>
* engine-gpgsm.c (struct engine_gpgsm): Add field INLINE_DATA and
always reset it before calling start.
(gpgsm_new): Clear it.
(status_handler): Implement it.
(gpgsm_getauditlog) [USE_DESCRIPTOR_PASSING]: Use INLINE_DATA.
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.
* 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.
2007-11-12 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp: New version from Frank Osterfeld.
2007-10-11 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp: New version from Frank Osterfeld.
2007-10-09 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp: New version from Frank Osterfeld and Marc
Mutz.
2007-10-05 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp, w32-qt-io.cpp: New versions from Frank
Osterfeld.
2007-10-04 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.h, kdpipeiodevice.cpp, kdpipeiodevice.moc,
w32-qt-io.cpp: New versions from Frank Osterfeld.
2007-10-02 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp, kdpipeiodevice.moc: New versions.
* w32-qt-io.cpp (_gpgme_io_fd2str): Print actual_fd if available.
(_gpgme_io_dup): Only acquire a reference, do not actually dup.
Submitted by Frank Osterfeld.
* priv-io.h, engine-gpgsm.c: Add comments.
* w32-qt-io.cpp (_gpgme_io_select): Remove code handling frozen FDs.
* w32-glib-io.c (_gpgme_io_close): Always dereference the channel,
even if not primary.
(_gpgme_io_dup): Acquire a reference. Replace unused
implementation by assertion.
2007-09-28 Werner Koch <wk@g10code.com>
* engine-gpgsm.c (iocb_data_t): Add SERVER_FD_STR.
(gpgsm_new): Set it.
(gpgsm_set_fd): Use it.
* w32-glib-io.c (find_channel): Add a new primary flag.
(_gpgme_io_close): Close channel only if primary.
(_gpgme_io_dup): Put newfd into the table as shallow copy.
* priv-io.h (struct io_select_fd_s): Remove member FROZEN.
* w32-io.c (_gpgme_io_select): Ditto.
* w32-glib-io.c (_gpgme_io_select): Ditto.
* posix-io.c (_gpgme_io_select): Ditto.
* rungpg.c (read_status): Ditto.
* wait.c (fd_table_put): Ditto.
* rungpg.c (gpg_io_event): Add tracing.
(start): Use gpg_io_event for sending the start event.
* engine-gpgsm.c (gpgsm_io_event): Add tracing.
(start): Use gpgsm_io_event for sending the start event.
* wait.c (_gpgme_add_io_cb, _gpgme_run_io_cb): Add tracing.
2007-09-28 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.moc, w32-qt-io.cpp, kdpipeiodevice.cpp: New
versions from Frank Osterfeld.
2007-09-27 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c (_gpgme_io_spawn),
w32-qt-io.cpp (_gpgme_io_spawn), w32-io.c (_gpgme_io_spawn): Close
the process handle, return 0.
* gpgme.h (gpgme_protocol_t): Add GPGME_PROTOCOL_UNKNOWN.
* gpgme.c (gpgme_get_protocol_name): Implement support for
GPGME_PROTOCOL_UNKNOWN.
* kdpipeiodevice.h: Fix last change.
* w32-glib-io.c (_gpgme_io_pipe), w32-qt-io.c (_gpgme_io_pipe),
w32-io.c (_gpgme_io_pipe), posix-io.c (_gpgme_io_pipe): Fix debug
output.
2007-09-25 Marcus Brinkmann <marcus@g10code.de>
* conversion.c, keylist.c: Include <sys/types.h>.
* kdpipeiodevice.h: Use namespace _gpgme_.
* kdpipeiodevice.cpp: Use namespace _gpgme_.
[Q_OS_WIN32 && NOMINMAX]: Do not define NOMINMAX again.
* w32-qt-io.cpp: Change namespace of KDPipeIODevice to
_gpgme_::KDPipeIODevice.
2007-09-17 Werner Koch <wk@g10code.com>
* rungpg.c (gpg_new): Make robust against undefined ttyname or
ttytype.
2007-09-14 Werner Koch <wk@g10code.com>
* data-mem.c (gpgme_data_release_and_get_mem): Fix tracing bug.
2007-09-14 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_release): Call gpgme_sig_notation_clear.
2007-09-13 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_new): Handle return value of _gpgme_getenv (fixes
small memory leak).
2007-09-07 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_qt_la_SOURCES): Move
moc_kdpipeiodevice.cpp to EXTRA_DIST, as this is only included by
another file (it's more like a header file than a cpp file, but
automake doesn't know that).
* w32-qt-io.cpp (_gpgme_io_spawn): Fix several cast errors and typos.
* w32-io.c (_gpgme_io_write): Use TRACE_SYSRES instead of TRACE_SYS.
(libgpgme_qt_la_LIBADD): Add QT4_CORE_LIBS, not QT4_CORE_LIB.
* kdpipeiodevice.h, kdpipeiodevice.cpp, moc_kdpipeiodevice.cpp,
kdpipeiodevice.moc, w32-qt-io.c: New files.
* Makefile.am (ltlib_gpgme_extra): Rename to ltlib_gpgme_glib.
(ltlib_gpgme_qt): New variable.
(lib_LTLIBRARIES): Add $(ltlib_gpgme_qt).
(libgpgme_qt_la_SOURCES): New variable.
(AM_CPPFLAGS): Add @QT4_CORE_INCLUDES@
(AM_CFLAGS): Add @QT4_CORE_CFLAGS@.
(libgpgme_qt_la_LDFLAGS, libgpgme_qt_la_DEPENDENCIES)
(libgpgme_qt_la_LIBADD): New variables.
* sema.h (struct critsect_s): Rename "private" to "priv" to make
C++ users happy. Change users.
* posix-sema.c (_gpgme_sema_cs_enter, _gpgme_sema_cs_leave)
(_gpgme_sema_cs_destroy): Likewise.
* w32-sema.c (critsect_init, _gpgme_sema_cs_enter)
(_gpgme_sema_cs_leave, _gpgme_sema_cs_destroy): Likewise.
* w32-glib-io.c (gpgme_get_giochannel): Change return type to
void*.
(gpgme_get_fdptr): New function.
* w32-io.c (gpgme_get_fdptr): New function
* gpgme.def: Add gpgme_get_fdptr.
2007-08-22 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (_gpgme_io_write): Return early if COUNT is zero.
(writer): Remove superfluous check.
2007-08-20 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Move include of gpg-error.h out of extern "C".
2007-08-07 Werner Koch <wk@g10code.com>
* gpgme.h (struct _gpgme_signature): Add member CHAIN_MODEL.
* verify.c (parse_trust): Set Chain_MODEL.
2007-08-02 Werner Koch <wk@g10code.com>
* w32-glib-io.c (_gpgme_io_spawn): Use DETACHED_PROCESS flag.
* w32-io.c (_gpgme_io_spawn): Ditto.
(_gpgme_io_write): Map ERROR_NO_DATA to EPIPE.
* debug.c (_gpgme_debug): Enable assuan logging.
(_gpgme_debug_subsystem_init): New. * version.c
(do_subsystem_inits): Disable assuan logging and initialize de
debug system.
(gpgme_check_version): Do not trace before the subsystems are
initialized.
2007-07-17 Marcus Brinkmann <marcus@g10code.de>
* debug.c: Include <errno.h> and "debug.h".
(_gpgme_debug): Save and restore ERRNO.
(TOHEX): New macro.
(_gpgme_debug_buffer): New function.
* conversion.c, data-compat.c, data-mem.c, data.c, engine-gpgsm.c,
gpgme.c, keylist.c, posix-io.c, rungpg.c, sign.c, version.c,
w32-io.c, wait.c: Replace DEBUG macros by TRACE_* variants. In
most of these files, add many more tracepoints.
2007-07-16 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (status_handler): Do not send BYE here.
* w32-io.c (struct reader_context_s, struct writer_context_s): New
members REFCOUNT.
(create_reader, create_writer): Initialize C->refcount to 1.
(destroy_reader, destroy_writer): Only destroy if C->refcount
drops to 0.
(find_reader, find_writer, kill_reader, kill_writer): Beautify.
* priv-io.h (_gpgme_io_dup): New prototype.
* posix-io.c (_gpgme_io_dup): New function.
* w32-io.c (_gpgme_io_dup): Likewise.
* w32-glib-io.c (_gpgme_io_dup): Likewise.
* engine-gpgsm.c (start): Reverting to version 2007-07-10.
2007-07-13 Marcus Brinkmann <marcus@g10code.de>
* data-user.c (user_read, user_write, user_seek): Set errno and
return -1 instead returning the error code directly.
* data-compat.c (old_user_seek): Likewise.
* gpgme.c (gpgme_sig_notation_add): Return error properly.
* Revert the "close_notify_handler" returns int stuff. Always
close in the _gpgme_io_close implementations.
* engine-gpgsm.c (status_handler): Try to terminate the connection
in case of error.
* w32-io.c (_gpgme_io_read): Return C->error_code in ERRNO.
(_gpgme_io_write): Likewise.
* priv-io.h (_gpgme_io_set_close_notify): Change type of HANDLER
to _gpgme_close_notify_handler.
(_gpgme_close_notify_handler): New type.
(_gpgme_io_dup): Remove prototype.
* posix-io.c (notify_table, _gpgme_io_set_close_notify): Change
type of HANDLER to _gpgme_close_notify_handler_t.
(_gpgme_io_close): Do not close the FD if handler returns 0.
(_gpgme_io_dup): Remove function.
* w32-io.c (notify_table, _gpgme_io_set_close_notify,
_gpgme_io_close): Change type of HANDLER to
_gpgme_close_notify_handler_t.
(_gpgme_io_close): Do not close the FD if handler returns 0.
(_gpgme_io_dup): Remove function.
* w32-glib-io.c (_gpgme_io_dup): Remove function.
(_gpgme_io_set_close_notify, notify_table): Change type of HANDLER
to _gpgme_close_notify_handler_t.
(_gpgme_io_close): Do not close the FD if handler returns 0.
* rungpg.c (close_notify_handler): Change return type to int,
return 1.
* engine-gpgsm.c (close_notify_handler): Change return type to
int, return 0 for status FD and 1 for all other FDs.
(start): Do not duplicate the status FD.
2007-07-12 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am: Replace implicite rule by suffix rule. Add
SUFFIXES for that.
2007-07-12 Werner Koch <wk@g10code.com>
* version.c (do_subsystem_inits) [W32]: Make sure that the socket
system has been started.
2007-07-10 Marcus Brinkmann <marcus@g10code.de>
* priv-io.h (_gpgme_io_dup): New prototype.
* posix-io.c (_gpgme_io_dup): New function.
* w32-io.c (_gpgme_io_dup): Likewise.
* w32-glib-io.c (_gpgme_io_dup): Likewise.
* engine-gpgsm.c (start): Use _gpgme_dup() instead of dup().
2007-07-08 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file.
* funopen.c (funopen): Rename to _gpgme_funopen.
2007-04-30 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new): Fix error handling for ttyname_r.
* rungpg.c (gpg_new): Likewise.
Submitted by Stephen Tether.
2007-02-26 Werner Koch <wk@g10code.com>
* verify.c (op_data_t): New element PLAINTEXT_SEEN.
(_gpgme_verify_status_handler): Return an error if more than one
plaintext has been seen.
(parse_error): New arg SET_STATUS. Also detect it based on an
ERROR status (gpg > 1.4.6).
2007-01-26 Werner Koch <wk@g10code.com>
* w32-io.c (build_commandline): Fixed stupid quoting bug.
* w32-glib-io.c (build_commandline): Ditto.
* rungpg.c (gpg_set_locale): Avoid dangling pointer after free.
* gpgme-config.in: New options --get-gpg and --get-gpgsm.
2007-01-18 Marcus Brinkmann <marcus@g10code.de>
* data.h (_gpgme_data_get_fd): Add prototype.
(gpgme_data_get_fd_cb): New type.
(struct _gpgme_data_cbs): New member get_fd.
* data.c (_gpgme_data_get_fd): New function.
* data-fd.c (fd_get_fd): New function.
(fd_cbs): Add fd_get_fd.
* data-stream.c (stream_get_fd): New function.
(stream_cbs): Add stream_get_fd.
* data-mem.c (mem_cbs): Add NULL for get_fd callback.
* data-user.c (user_cbs): Likewise.
* engine-gpgsm.c (gpgsm_set_fd) [USE_DESCRIPTOR_PASSING]: Try to
short-cut by passing the data descriptor directly.
2007-01-17 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (build_commandline): Quote all command line arguments.
* w32-glib-io.c (build_commandline): Likewise.
2007-01-10 Werner Koch <wk@g10code.com>
* ttyname_r.c (ttyname_r) [W32]: Return a dummy name.
2007-01-08 Werner Koch <wk@g10code.com>
* version.c (do_subsystem_inits): Do assuan init only if building
with Assuan.
* setenv.c: Include assuan-def.h only if building with Assuan
support.
* op-support.c (_gpgme_op_reset): Set LC_MESSAGES only if
if defined.
* engine-gpgsm.c (gpgsm_set_locale): Ditto.
* rungpg.c (gpg_set_locale): Ditto.
2006-12-17 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_set_protocol): Shut down the engine when
switching protocols.
(gpgme_ctx_set_engine_info): Likewise for engine info.
* engine.h (_gpgme_engine_reset): New function prototype.
* engine.c (_gpgme_engine_reset): New function.
* engine-backend.h (struct engine_ops): New member RESET.
* rungpg.c (_gpgme_engine_ops_gpg): Add NULL for reset function.
* engine-gpgsm.c (_gpgme_engine_ops_gpgsm)
[USE_DESCRIPTOR_PASSING]: Add gpgsm_reset for reset.
(_gpgme_engine_ops_gpgsm) [!USE_DESCRIPTOR_PASSING]: Add NULL for
reset function.
(gpgsm_reset) [USE_DESCRIPTOR_PASSING]: New function.
* op-support.c (_gpgme_op_reset): Try to use the engine's reset
function if available.
* engine-gpgsm.c (gpgsm_new): Move code to dup status_fd to ...
(start): ... here.
* posix-io.c (_gpgme_io_recvmsg, _gpgme_io_sendmsg): New functions.
* engine.h (_gpgme_engine_new): Remove arguments lc_ctype and
lc_messages from prototype.
(_gpgme_engine_set_locale): New prototype.
* engine.c (_gpgme_engine_set_locale): New function.
* op-support.c (_gpgme_op_reset): Call _gpgme_engine_set_locale.
* engine-backend.h (struct engine_ops): Add new member SET_LOCALE.
Remove arguments lc_messages and lc_ctype from member NEW.
* engine-gpgsm.c (struct engine_gpgsm): New members lc_ctype_set
and lc_messages_set.
(gpgsm_new): Remove lc_messages and lc_ctype
arguments.
(gpgsm_set_locale): New function.
(_gpgme_engine_ops_gpgsm): Add gpgsm_set_locale.
* rungpg.c (struct engine_gpg): Add new members lc_messages and
lc_ctype.
(gpg_release): Release lc_messages and lc_ctype if set.
(gpg_new): Remove lc_messages and lc_ctype arguments.
(gpg_set_locale): New function.
(_gpgme_engine_ops_gpg): Add gpg_set_locale.
(add_arg): Implement in terms of:
(add_arg_ext): New function.
(start): Set lc-messages and lc-ctype arguments here.
2006-12-03 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (struct engine_gpgsm): Move members
input_fd_server, output_fd_server, message_fd_server to ...
(iocb_data): ... here (as server_fd).
(close_notify_handler): Reset tags as well.
(gpgsm_new): Implement support for descriptor
passing.
(fd_type_t): New type.
(gpgsm_clear_fd): New function. Use it instead of _gpgsm_io_close
for unused communication channels.
(gpgsm_set_fd): Rewritten to support descriptor passing. All
relevant callers adjusted as well (previously of _gpgme_io_close).
2006-12-02 Marcus Brinkmann <marcus@g10code.de>
* version.c: Include "assuan.h".
(do_subsystem_inits): Call assuan_set_assuan_err_source.
2006-12-01 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_real_la_SOURCES): Rename to main_sources.
(libgpgme_la_SOURCES, libgpgme_pthread_la_SOURCES,
libgpgme_glib_la_SOURCES, libgpgme_pth_la_SOURCES): Add
$(main_sources).
(libgpgme_la_DEPENDENCIES, libgpgme_la_LIBADD,
libgpgme_pthread_la_DEPENDENCIES, libgpgme_pthread_la_LIBADD,
libgpgme_pth_la_DEPENDENCIES, libgpgme_pth_la_LIBADD,
libgpgme_glib_la_DEPENDENCIES, libgpgme_glib_la_LIBADD): Remove
libgpgme-real.la.
(noinst_LTLIBRARIES): Removed.
(libgpgme_glib_la_CFLAGS, libgpgme_pth_la_CFLAGS): Removed.
(AM_CFLAGS): New variable.
2006-11-30 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c: Replace AssuanError with gpg_error_t and
ASSUAN_CONTEXT with assuan_context_t.
2006-11-29 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new): Check return value of
assuan_pipe_connect.
* rungpg.c: Include <unistd.h>.
(gpg_new): Support --display, --ttyname, --ttytype, --lc-ctype and
--lc-messages. Fixes issue 734.
2006-10-24 Marcus Brinkmann <marcus@g10code.de>
* trustlist.c (gpgme_op_trustlist_next): Return error if OPD is
NULL.
2006-10-23 Marcus Brinkmann <marcus@g10code.de>
* wait-global.c (gpgme_wait): Unlock CTX_LIST_LOCK while calling
_gpgme_engine_io_event().
* keylist.c (gpgme_op_keylist_next): Return error if OPD is NULL.
2006-09-25 Marcus Brinkmann <marcus@g10code.de>
* data-mem.c (gpgme_data_release_and_get_mem): Release the data
object properly.
2006-09-22 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (keylist_colon_handler): Move debug output after
initialising KEY.
2006-07-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in (Options): Add NETLIBS.
* Makefile.am (libgpgme_la_LIBADD, libgpgme_pthread_la_LIBADD,
libgpgme_pth_la_LIBADD, libgpgme_glib_la_LIBADD): Add NETLIBS.
* rungpg.c (read_status): Fix comparison disguising as an
assignment.
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_set_locale): Remove conditional on
HAVE_W32_SYSTEM, and just check for LC_MESSAGES.
2006-07-16 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (read_status): Strip potential carriage return.
* genkey.c (get_key_parameter): Skip potential carriage return.
* version.c (_gpgme_get_program_version): Strip potential carriage
return.
* data.c (gpgme_data_set_file_name): Allow to clear the file name
by passing NULL.
2006-06-22 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_get_key): Also clone the engine info.
2006-03-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in (cflags_pth): Revert accidential removal of
pthread support with last change.
2006-02-28 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c (O_BINARY) [!O_BINARY]: New macro.
(_gpgme_io_pipe): Open pipes in binary mode.
2006-02-22 Marcus Brinkmann <marcus@g10code.de>
* engine.c (gpgme_engine_check_version): Reimplemented to allow
checking the version correctly even after changing the engine
information. Bug reported by Stéphane Corthésy.
* rungpg.c (read_colon_line): Invoke colon preprocess handler if
it is set.
(colon_preprocessor_t): New type.
(struct engine_gpg): New member colon.preprocess_fnc.
(gpg_keylist_preprocess): New function.
* keylist.c (keylist_colon_handler): Allow short key IDs.
2006-02-15 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (create_writer): Make C->have_data a manually resetted
event.
(writer): Move code from end of if block to beginning, so it
is also run the first time.
(_gpgme_io_write): Move assert check after error check. Reset
the is_empty event, and also do it eagerly.
(_gpgme_io_select): Unconditionally wait for the is_empty event.
2006-01-26 Werner Koch <wk@g10code.com>
* w32-util.c (_gpgme_get_conf_int): New.
* posix-util.c (_gpgme_get_conf_int): New.
* w32-io.c (get_desired_thread_priority): New.
(create_reader, create_writer): Use it here.
2006-01-04 Werner Koch <wk@g10code.com>
* debug.h (_gpgme_debug_srcname): New. Use it with the debug macros.
* w32-glib-io.c (_gpgme_io_set_nonblocking): Add debug
statements. Disable error return for failed nonblocking call.
2006-01-03 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c (_gpgme_io_close): Only close fd if there is no
channel for it.
2005-12-31 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c (find_channel): Set channel to unbuffered.
(_gpgme_io_select): Fix debug output.
2005-12-23 Werner Koch <wk@g10code.com>
* gpgme.h (struct _gpgme_signature): Append field PKA_ADDRESS.
* verify.c (release_op_data, _gpgme_verify_status_handler): Set
this field.
2005-12-20 Werner Koch <wk@g10code.com>
* gpgme.h (gpgme_status_code_t): Added GPGME_STATUS_PKA_TRUST_BAD
and GPGME_STATUS_PKA_TRUST_GOOD.
(struct _gpgme_signature): New field pka_trust.
* verify.c (_gpgme_verify_status_handler): Set pka_trust.
2005-12-06 Werner Koch <wk@g10code.com>
* keylist.c (keylist_colon_handler): Store fingerprints of the
subkeys. Reset the secret flag of subkeys for stub secret keys.
(NR_FIELDS): Bumped up to 16
2005-11-27 Marcus Brinkmann <marcus@g10code.de>
* engine.c (_gpgme_set_engine_info): Use new_file_name in
engine_get_version invocation. Reported by Stéphane Corthésy.
2005-11-24 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c (_gpgme_io_fd2str): Remove debug printf.
2005-11-18 Werner Koch <wk@g10code.com>
* w32-glib-io.c: Include glib.h before windows to avoid a symbol
shadowing warning.
(find_channel): Better use g_io_channel_win32_new_fd instead of
the autodetection function g_io_channel_unix_new.
(_gpgme_io_select): Rewritten. It is now a fully working select
implementation.
2005-11-18 Marcus Brinkmann <marcus@g10code.de>
* priv-io.h (_gpgme_io_fd2str): New prototype.
* posix-io.c (_gpgme_io_fd2str): New function.
* w32-io.c (_gpgme_io_fd2str): New function.
* rungpg.c: Use this new function.
* w32-glib-io.c (_gpgme_io_fd2str): Rewrote the file handle code
again. Two's company, three's the musketeers.
* w32-glib-io.c: Rewrote the file handle code. We don't create
system fds for every handle (doesn't work for inherited handles),
but we create pseudo fds in a private namespace that designate a
handle and potentially a giochannel.
2005-11-18 Werner Koch <wk@g10code.com>
* versioninfo.rc.in: Set file version to LT-version + Svn-revision.
2005-11-17 Marcus Brinkmann <marcus@g10code.de>
* w32-glib-io.c: New file.
* gpgme.def (gpgme_get_giochannel): Add symbol.
* Makefile.am (system_components) [HAVE_DOSISH_SYSTEM]: Remove
w32-io.c.
(ltlib_gpgme_extra): New variable.
(lib_LTLIBRARIES): Add $(ltlib_gpgme_extra).
(system_components_not_extra): New variable.
(libgpgme_la_SOURCES, libgpgme_pthread_la_SOURCES,
(libgpgme_pth_la_SOURCES): Add $(system_components_not_extra).
(libgpgme_glib_la_LDFLAGS, libgpgme_glib_la_DEPENDENCIES,
(libgpgme_glib_la_LIBADD, libgpgme_glib_la_CFLAGS)
[BUILD_W32_GLIB]: New variables.
* gpgme-config.in (glib): New option.
* gpgme.m4 (AM_PATH_GPGME_GLIB): New macro.
2005-11-17 Marcus Brinkmann <marcus@g10code.de>
* priv-io.h (_gpgme_io_waitpid, _gpgme_io_kill): Removed.
* w32-io.c (_gpgme_io_waitpid, _gpgme_io_kill): Removed.
* posix-io.c (_gpgme_io_kill): Removed.
(_gpgme_io_waitpid): Declare static.
2005-10-24 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (_gpgme_io_spawn): Don't minimize window, hide it.
2005-10-21 Werner Koch <wk@g10code.com>
* Makefile.am: Fixed cut+paste problem
2005-10-20 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am: Build versioninfo.lo, not versioninfo.o. Also, fix
the whole mess.
2005-10-16 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_edit): Don't add a key argument if in card edit
mode.
2005-10-06 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (gpgme.dll gpgme.dll.a): Use $(srcdir) for
gpgme.def.
* gpgme.h (gpgme_free): New prototype.
* data-mem.c (gpgme_free): New function.
* libgpgme.vers (GPGME_1.1): Add gpgme_free.
* gpgme.def: Add gpgme_free.
2005-10-02 Marcus Brinkmann <marcus@g10code.de>
* util.h (_gpgme_decode_percent_string): Add new argument BINARY
to prototype.
* verify.c (parse_notation): Likewise for invocation.
* conversion.c (_gpgme_decode_percent_string): Likewise to
declaration. If set, do not replace '\0' characters with a
printable string.
* gpgme.h (struct _gpgme_key_sig): New field notations.
* ops.h (_gpgme_parse_notation): New prototype.
* sig-notation.c (_gpgme_parse_notation): New function.
* key.c (gpgme_key_unref): Free all signature notations.
* keylist.c (op_data_t): New member tmp_keysig.
(finish_key): Clear OPD->tmp_keysig.
* gpgme.c (gpgme_set_keylist_mode): Remove check.
* rungpg.c (gpg_keylist): Support listing signature notations.
(gpg_keylist_ext): Likewise.
2005-10-01 Marcus Brinkmann <marcus@g10code.de>
* engine.h (_gpgme_set_engine_info): Add prototype.
* engine-backend.h (struct engine_ops): Change return type of
get_file_name() to const char * to silence gcc warning.
* engine.c (engine_get_file_name): Change return type to const
char * to silence gcc warning.
(gpgme_get_engine_info): Use transitional variable to go from
const char * to char * to silence gcc warning.
(_gpgme_set_engine_info): Likewise.
* engine-gpgsm.c (struct engine_gpgsm): Change type of LINE to
char * to silence gcc warning.
(gpgsm_new): Make ARGV a pointer to const char.
(status_handler): Change type of SRC, END, DST, ALINE and NEWLINE
to char * to silence gcc warning.
* gpgme.def: Add gpgme_data_set_file_name,
gpgme_data_get_file_name, gpgme_sig_notation_clear,
gpgme_sig_notation_add and gpgme_sig_notation_get.
* libgpgme.vers: Add gpgme_sig_notation_clear,
gpgme_sig_notation_add and gpgme_sig_notation_get.
* Makefile.am (libgpgme_real_la_SOURCES): Add sig-notation.c.
* context.h (struct gpgme_context): New field sig_notations.
* gpgme.h (struct _gpgme_sig_notation): New member value_len and
critical.
(GPGME_SIG_NOTATION_CRITICAL): New symbol.
(gpgme_sig_notation_flags_t): New type.
(gpgme_sig_notation_add, gpgme_sig_notation_clear,
gpgme_sig_notation_get): New prototypes.
* ops.h (_gpgme_sig_notation_create, _gpgme_sig_notation_free):
New prototypes.
* sig-notation.c (_gpgme_sig_notation_free): New file.
* verify.c (parse_notation): Use support functions.
(release_op_data): Likewise.
* rungpg.c (append_args_from_sig_notations): New function.
(gpg_encrypt_sign, gpg_sign): Call it.
2005-09-30 Marcus Brinkmann <marcus@g10code.de>
* data.h (struct gpgme_data): New member file_name.
* data.c (gpgme_data_set_filename): New function.
(_gpgme_data_release): Free DH->filename if necessary.
(gpgme_data_get_filename): New function.
* rungpg.c (gpg_encrypt): Set filename option.
(gpg_encrypt_sign): Likewise.
(gpg_sign): Likewise.
* libgpgme.vers (GPGME_1.1): Add gpgme_data_set_file_name and
gpgme_data_get_file_name.
* decrpyt.c, verify.c, gpgme.h: Replace plaintext_filename with
file_name.
2005-09-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_key): Add field is_qualified.
(struct _gpgme_subkey): Likewise.
* keylist.c (set_subkey_capability, set_mainkey_capability): Set
field is_qualified.
2005-09-23 Werner Koch <wk@g10code.com>
* w32-io.c (_gpgme_io_pipe): Removed use of environment variable
again.
(create_reader, create_writer): Set thread priority higher.
2005-09-19 Werner Koch <wk@g10code.com>
* w32-io.c (_gpgme_io_pipe): New environment variable to change
the size of the pipe buffer.
2005-09-13 Werner Koch <wk@g10code.com>
* ath.c: Changes to make it work under W32.
2005-09-12 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_la_SOURCES): Set to ath.h and ath.c.
(ath_pth_src, ath_pthread_src): Removed.
(w32_o_files): Replace ath-compat.o with ath.o.
(libgpgme_pth_la_CFLAGS): New variable.
* ath-compat.c, ath-pthread-compat.c, ath-pth-compat.c: Removed.
* ath.h (ath_pthread_available, ath_pth_available): Removed.
(ath_init) [!_ATH_EXT_SYM_PREFIX]: Do not define macro.
(struct ath_ops, ath_init) [_ATH_COMPAT]: Removed.
(_ATH_COMPAT): Macro removed.
* posix-sema.c (_gpgme_sema_subsystem_init): Do not call
_gpgme_ath_init.
2005-09-12 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (release_op_data): Do not free opd->tmp_uid.
2005-09-07 Werner Koch <wk@g10code.com>
* w32-io.c (build_commandline): Quote argv[0].
2005-08-26 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (command_handler): Use _gpgme_io_write instead of write.
* edit.c (command_handler): Do not depend on PROCESSED being
available.
* engine.h (engine_command_handler_t): Add new argument processed.
* ops.h (_gpgme_passphrase_command_handler_internal): Rename
prototype to ...
(_gpgme_passphrase_command_handler): ... this one.
* passphrase.c (_gpgme_passphrase_command_handler_internal):
Rename to ...
(_gpgme_passphrase_command_handler): ... this one.
* edit.c (command_handler): Add new argument processed. Remove
local variable with the same name. Always return processed as
true.
* rungpg.c (command_handler): Send a newline character if the
handler did not.
2005-08-26 Werner Koch <wk@g10code.com>
* w32-util.c (read_w32_registry_string): Updated from code used by
GnuPG. This allows for expanding strings and features the
implicit fallback key.
(w32_shgetfolderpath, find_program_at_standard_place): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): With no registry
entry, locate the programs at the standard place.
(dlopen, dlsym, dlclose): New, so that we can keep on using what
we are accustomed to.
* debug.c (debug_init): Use PATHSEP_C so that under W32 a
semicolon is used which allows us to create files with drive
letters.
* w32-io.c (_gpgme_io_read, _gpgme_io_write): Print content in
debug mode too.
2005-08-19 Werner Koch <wk@g10code.com>
* gpgme.def: New.
* versioninfo.rc.in: New.
* Makefile.am: Addes support for building a W32 DLL.
* ttyname_r.c (ttyname_r) [W32]: Return error.
* ath-compat.c [W32]: select and co are not yet supported; return
error.
* data-stream.c (stream_seek): Use ftell if ftello is not available.
2005-08-08 Werner Koch <wk@g10code.com>
* util.h (stpcpy): Renamed to ..
(_gpgme_stpcpy): .. this and made inline. This avoids duplicate
definitions when linking statically.
* stpcpy.c: Removed.
2005-07-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_PLAINTEXT.
(struct _gpgme_op_decrypt_result): New member plaintext_filename.
(struct _gpgme_op_verify_result): Likewise.
* ops.h (_gpgme_parse_plaintext): Add prototype.
* op-support.c (_gpgme_parse_plaintext): New function.
* decrypt.c (release_op_data): Release
OPD->result.plaintext_filename.
(_gpgme_decrypt_status_handler): Handle GPGME_STATUS_PLAINTEXT.
* verify.c (release_op_data): Release
OPD->result.plaintext_filename.
(_gpgme_verify_status_handler): Handle GPGME_STATUS_PLAINTEXT.
2005-07-26 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_get_key): Allow key IDs.
2005-06-20 Marcus Brinkmann <marcus@g10code.de>
* gpgme.m4: Only call GPGME_CONFIG if found.
2005-06-03 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_signature): New members pubkey_algo and
hash_algo.
* verify.c (parse_valid_sig): Parse pubkey and hash algo numbers.
(parse_new_sig): Parse pubkey, hash algo and timestamp for ERRSIG.
(_gpgme_decrypt_status_handler): Fix last change.
* gpgme.h (struct _gpgme_recipient): New structure.
(gpgme_recipient_t): New type.
(struct _gpgme_op_decrypt_result): Add member recipients.
* decrypt.c (op_data_t): New member last_recipient_p.
(_gpgme_op_decrypt_init_result): Initialize last_recipient_p.
(parse_enc_to): New function.
(_gpgme_decrypt_status_handler): Handle status ENC_TO and
NO_SECKEY.
* wait-global.c (gpgme_wait): Break out of the fd processing loop
after an error.
Reported by Igor Belyi <gpgme@katehok.ac93.org>.
2005-06-02 Marcus Brinkmann <marcus@g10code.de>
* wait.h (_gpgme_run_io_cb): New prototype.
* wait.c (_gpgme_run_io_cb): New function.
* wait-global.c (gpgme_wait): Call it.
* wait-user.c (_gpgme_user_io_cb_handler): Likewise.
* wait-private.c (_gpgme_wait_on_condition): Likewise.
2005-06-02 Werner Koch <wk@g10code.com>
* passphrase.c (_gpgme_passphrase_status_handler): Take care of
GPGME_STATUS_NEED_PASSPHRASE_PIN.
(_gpgme_passphrase_command_handler_internal): Also act on the key
"passphrase.pin.ask".
* gpgme.h: Added status codes GPGME_STATUS_SIG_SUBPACKET,
GPGME_STATUS_NEED_PASSPHRASE_PIN, GPGME_STATUS_SC_OP_FAILURE,
GPGME_STATUS_SC_OP_SUCCESS, GPGME_STATUS_CARDCTRL,
GPGME_STATUS_BACKUP_KEY_CREATED.
2005-05-28 Marcus Brinkmann <marcus@g10code.de>
* data-user.c: Include <errno.h>.
2005-05-17 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_new): Set the CTX->include_certs default to the
default.
2005-05-11 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (_gpgme_io_select): Fix loop increment.
2005-05-05 Marcus Brinkmann <marcus@g10code.de>
* data-user.c (user_release): Only call user hook if provided.
(user_seek): Return EBADF if no user hook is provided.
(user_read): Likewise.
(user_write): Likewise.
2005-04-28 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GPGME_INCLUDE_CERTS_DEFAULT): New macro.
* engine-gpgsm.c (gpgsm_sign): Send the include-certs option after
the reset, just for cleanliness, and do not sent it at all if the
default is requested.
* gpgme.c (gpgme_set_include_certs): Allow to use
GPGME_INCLUDE_CERTS_DEFAULT.
2005-04-21 Werner Koch <wk@g10code.com>
* verify.c (calc_sig_summary): Set the key revoked bit.
2005-04-14 Marcus Brinkmann <marcus@g10code.de>
* wait-global.c (gpgme_wait): Use LI->ctx when checking a context
in the list, not the user-provided CTX.
Reported by Igor Belyi <gpgme@katehok.ac93.org>.
* wait-global.c (gpgme_wait): If no context is found, and we
should not hang, set *status to 0 and return NULL.
Reported by Igor Belyi <gpgme@katehok.ac93.org>.
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
* data.h (EOPNOTSUPP) [_WIN32]: Remove definition.
* data.c (EOPNOTSUPP) [HAVE_W32_SYSTEM]: Remove definition.
(gpgme_data_read, gpgme_data_write, gpgme_data_seek): Return
ENOSYS instead EOPNOTSUPP.
* data-compat.c (EOPNOTSUPP) [HAVE_W32_SYSTEM]: Remove definition.
(gpgme_error_to_errno): Map GPG_ERR_NOT_SUPPORTED
to ENOSYS.
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
* io.h: Rename to ...
* priv-io.h: ... this.
* Makefile.am (libgpgme_real_la_SOURCES): Change io.h to priv-io.h.
* data.c, engine-gpgsm.c, posix-io.c, rungpg.c, version.c,
w32-io.c, wait-private.c, wait-global.c, wait-user.c, wait.c:
Change all includes of "io.h" to "priv-io.h"
2005-03-09 Werner Koch <wk@g10code.com>
* w32-util.c (_gpgme_get_gpg_path, _gpgme_get_gpgsm_path): Do not
cast away type checks.
* io.h [W32]: Do not include stdio.h. If it is needed do it at
the right place.
* data.h [W32]: Removed kludge for EOPNOTSUP.
* data.c, data-compat.c [W32]: Explicitly test for it here.
Replaced use of _WIN32 by HAVE_W32_SYSTEM except for public header
files.
2005-03-07 Timo Schulz <twoaday@g10code.de>
* gpgme.h: [_WIN32] Removed ssize_t typedef.
* ath.h: [_WIN32] Added some (dummy) types.
* io.h: [_WIN32] include stdio.h.
* data.h: [_WIN32] Define EOPNOTSUPP.
* w32-io.c [_WIN32] (_gpgme_io_subsystem_init): New.
* gpgme.c [_WIN32] (gpgme_set_locale): Disabled.
2004-12-12 Marcus Brinkmann <marcus@g10code.de>
* engine.c (_gpgme_set_engine_info): Fix assertion.
2004-12-11 Marcus Brinkmann <marcus@g10code.de>
* util.h [HAVE_CONFIG_H && HAVE_TTYNAME_R] (ttyname_r): Define
prototype.
* ttyname_r.c: New file.
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* putc_unlocked.c, funopen.c: I just claim copyright on these
files and change their license to LGPL, because they are totally
trivial wrapper functions.
* isascii.c: Change copyright notice to the one from ctype/ctype.h
in the GNU C Library (CVS Head 2004-10-10), where isascii is
defined as a macro doing exactly the same as the function in this
file.
* memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06).
* stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10).
* ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c,
ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c,
data.c, data-compat.c, data-fd.c, data.h, data-mem.c,
data-stream.c, data-user.c, debug.c, debug.h, decrypt.c,
decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c,
engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c,
export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h,
key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c,
passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c,
rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c,
util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c,
wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change
license to LGPL.
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* libgpgme.vers (GPGME_1.1): New version.
* engine-backend.h (struct engine_ops): Add argument FILE_NAME to
member get_version(). Add arguments FILE_NAME and HOME_DIR to
member new(). Change return type of get_file_name and get_version
to char *.
* engine-gpgsm.c (gpgsm_get_version): Change return type to char
pointer. Do not cache result.
(gpgsm_new): Add file_name and home_dir argument, and use them
instead of the defaults, if set.
* rungpg.c (struct engine_gpg): New member file_name.
(gpg_get_version): Change return type to char pointer, and do not
cache result.
(gpg_release): Free gpg->file_name.
(gpg_new): Take new arguments file_name and home_dir. Set the
--homedir argument if HOME_DIR is not NULL. Set gpg->file_name.
(start): Use gpg->file_name instead _gpgme_get_gpg_path, if set.
* engine.h (_gpgme_engine_info_copy, _gpgme_engine_info_release):
New prototypes.
(_gpgme_engine_new): Change first argument to gpgme_engine_info_t
info.
* engine.c: Include <assert.h>.
(gpgme_get_engine_info): Set *INFO within the lock. Move
ENGINE_INFO and ENGINE_INFO_LOCK to ....
(engine_info, engine_info_lock): ... here. New static variables.
(engine_get_version): Add file_name argument to
get_version invocation. Change return type to char pointer.
(gpgme_engine_check_version): Rewritten to free() the return value
of engine_get_version after using it.
(_gpgme_engine_info_release): New function.
(gpgme_get_engine_info): Rewritten.
(_gpgme_engine_info_copy): New function.
(_gpgme_set_engine_info): New function.
(gpgme_set_engine_info): New function.
(_gpgme_engine_new): Change first argument to gpgme_engine_info_t
info, and use that.
* gpgme.h (struct _gpgme_engine_info): Change type of file_name
and version to char * (remove the const). New member home_dir.
(gpgme_set_engine_info, gpgme_ctx_get_engine_info,
gpgme_ctx_set_engine_info): New prototypes.
* context.h (struct gpgme_context): New member engine_info.
* gpgme.c (gpgme_new): Allocate CTX->engine_info.
(gpgme_release): Deallocate CTX->engine_info.
(gpgme_ctx_get_engine_info, gpgme_ctx_set_engine_info): New
functions.
* op-support.c (_gpgme_op_reset): Look for correct engine info and
pass it to _gpgme_engine_new.
* version.c (gpgme_check_version): Adjust to
_gpgme_compare_versions returning an int.
(_gpgme_compare_versions): Return an int value, not a const char
pointer.
* ops.h (_gpgme_compare_versions): Same for prototype.
2004-10-03 Marcus Brinkmann <marcus@g10code.de>
* verify.c (parse_trust): If no reason is provided, set
SIG->validity_reason to 0.
(calc_sig_summary): Set GPGME_SIGSUM_CRL_TOO_OLD if appropriate.
2004-10-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (map_assuan_error): Return 0 if ERR is 0.
(start): Call map_assuan_error on return value of
assuan_write_line.
2004-10-05 Marcus Brinkmann <marcus@g10code.de>
* op-support.c (_gpgme_op_data_lookup): Use char pointer for
pointer arithmetic.
2004-09-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.m4: Implement the --api-version check.
* rungpg.c (read_status): Move the polling of the output data pipe
to just before removing the command fd, from just before adding
it. This avoids buffering problems.
* data.c (_gpgme_data_inbound_handler): Use _gpgme_io_read, not
read, to improve debug output.
2004-09-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GPGME_IMPORT_NEW, GPGME_IMPORT_UID, GPGME_IMPORT_SIG,
GPGME_IMPORT_SUBKEY, GPGME_IMPORT_SECRET,
(GPGME_KEYLIST_MODE_LOCAL, GPGME_KEYLIST_MODERN_EXTERN,
GPGME_KEYLIST_MODE_SIGS, GPGME_KEYLIST_MODE_VALIDATE): Change from
enum to macros.
(gpgme_keylist_mode_t): Define as unsigned int.
(gpgme_key_t): Change type of keylist_mode to
gpgme_keylist_mode_t.
2004-09-23 Marcus Brinkmann <marcus@g10code.de>
* data.c (_gpgme_data_outbound_handler): Close the file descriptor
if we get an EPIPE.
* data-stream.c (stream_seek): Call ftello and return the current
offset.
* data.h (struct gpgme_data): Change type of data.mem.offset to
off_t.
* data.c (gpgme_data_seek): Check dh->cbs->seek callback, not read
callback. If SEEK_CUR, adjust the offset by the pending buffer
size. Clear pending buffer on success.
2004-09-14 Marcus Brinkmann <marcus@g10code.de>
* gpgme.m4: Add copyright notice.
2004-08-18 Marcus Brinkmann <marcus@g10code.de>
* passphrase.c (_gpgme_passphrase_status_handler): Always run the
status handler.
2004-08-17 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (build_argv): Use --no-sk-comment, not --no-comment.
2004-06-23 Marcus Brinkmann <marcus@g10code.de>
* key.c (_gpgme_key_append_name): Make sure tail points to the
byte following the uid.
(_gpgme_key_add_sig): Likewise. Don't use calloc, but malloc and
memset.
2004-06-02 Marcus Brinkmann <marcus@g10code.de>
* libgpgme.vers: Remove C-style comment, which is not supported by
older binutils.
2004-05-21 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in (Options): Support --api-version.
* libgpgme.vers: List all gpgme symbols under version GPGME_1.0.
* decrypt.c (_gpgme_decrypt_status_handler): Fix last change.
* verify.c (parse_error): Likewise.
* verify.c (parse_error): Do not skip location of where token.
* gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_REVKEYSIG.
* verify.c (_gpgme_verify_status_handler): Add handling of
GPGME_STATUS_REVKEYSIG.
(parse_trust): Likewise.
2004-05-21 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_decrypt_result): New fields
wrong_key_usage and _unused.
* decrypt.c (_gpgme_decrypt_status_handler): Don't skip over
character after a matched string, as in a protocol error this
could skip over the trailing binary zero.
Handle decrypt.keyusage error notifications.
* gpgme.h (struct _gpgme_key): New member keylist_mode.
* keylist.c (keylist_colon_handler): Set the keylist_mode of KEY.
2004-04-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_signature): Change member WRONG_KEY_USAGE
to unsigned int. Same for member _unused.
* keylist.c (set_mainkey_trust_info): Rewritten.
(set_subkey_capability): Handle 'd' (disabled).
(set_mainkey_capability): Rewritten.
2004-04-22 Marcus Brinkmann <marcus@g10code.de>
* gpgme.m4: Quote first argument to AC_DEFUN.
2004-04-21 Werner Koch <wk@gnupg.org>
* key.c (gpgme_key_unref): Allow passing NULL like free does.
The rule of least surprise.
2004-04-15 Werner Koch <wk@gnupg.org>
* verify.c (prepare_new_sig, _gpgme_verify_status_handler): Remove
unused result.signatures items.
* keylist.c (gpgme_get_key): Return an error if FPR is NULL.
2004-04-08 Werner Koch <wk@gnupg.org>
* verify.c (_gpgme_verify_status_handler): Ignore the error status
if we can't process it.
* decrypt-verify.c (decrypt_verify_status_handler): Backed out
yesterday's hack. It is not any longer required.
2004-04-07 Werner Koch <wk@gnupg.org>
* decrypt-verify.c (decrypt_verify_status_handler): Hack to cope
with meaningless error codes from the verify status function.
2004-04-05 Werner Koch <wk@gnupg.org>
* gpgme.h: Add GPGME_STATUS_NEWSIG.
* verify.c (parse_error): Compare only the last part of the where
token.
(prepare_new_sig): New.
(parse_new_sig): Use prepare_new_sig when required.
(_gpgme_verify_status_handler): Handle STATUS_NEWSIG.
* engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation
option. Fixed pattern construction.
(status_handler): Add debugging output.
2004-03-23 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new): Protect _only_ tty related code with
isatty(). Submitted by Bernhard Herzog.
2004-03-11 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new): Protect all tty related code with
isatty().
* rungpg.c (gpg_cancel): Set GPG->fd_data_map to NULL after
releasing it.
* engine-gpgsm.c (gpgsm_cancel): Only call assuan_disconnect if
GPGSM->assuan_ctx is not NULL. Set it to NULL afterwards.
2004-03-07 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in: Do not emit include and lib directory for
prefix "/usr" or "".
2004-03-03 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (gpgsm_export_ext): Properly insert a space
beween patterns.
2004-02-18 Werner Koch <wk@gnupg.org>
* gpgme-config.in: Ignore setting of --prefix.
2004-02-25 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_cancel): New function.
(gpg_release): Call it here.
(_gpgme_engine_ops_gpg): Add it here.
* engine-gpgsm.c (gpgsm_cancel): Fix last change.
2004-02-24 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_cancel): New function.
* engine-backend.h (struct engine_ops): New member cancel.
* engine.h (_gpgme_engine_cancel): New prototype.
* engine.c (_gpgme_engine_cancel): New function.
* engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Add new member cancel.
(gpgsm_cancel): New function.
(gpgsm_release): Use it.
* rungpg.c (_gpgme_engine_ops_gpg): Add new member cancel.
2004-02-17 Werner Koch <wk@gnupg.org>
* gpgme.h: Add GPGME_KEYLIST_MODE_VALIDATE.
* engine-gpgsm.c (gpgsm_keylist): Send this to gpgsm.
2004-02-15 Werner Koch <wk@gnupg.org>
* memrchr.c (memrchr): Fixed implementation. Problem pointed out
by Adriaan de Groot.
2004-02-01 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (build_argv): Use --no-comment, not --comment "".
* data-compat.c (gpgme_data_new_from_filepart): Call fseeko if
available.
* data-stream.c (stream_seek): Likewise.
2004-01-16 Werner Koch <wk@gnupg.org>
* conversion.c (_gpgme_map_gnupg_error): Handle numerical codes as
used by GnuPG 1.9.x
2004-01-13 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_key_sig): Fix comment on REVOKED.
2004-01-12 Werner Koch <wk@gnupg.org>
* sign.c: Include util.h for prototype of _gpgme_parse_timestamp.
2003-12-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (_GPGME_D_CLASS): Revert this change.
(struct _gpgme_key_sig): For C++ compilers, rename class
member to _obsolete_class. Add new member sig_class.
(struct _gpgme_new_signature): Same here.
* key.c (gpgme_key_sig_get_ulong_attr): Use CERTSIG->sig_class,
not CERTSIG->class.
* keylist.c (keylist_colon_handler): Likewise for KEYSIG, but keep
setting KEYSIG->class, too. Rename variable CLASS to SIG_CLASS.
* sign.c (parse_sig_created): Set SIG->sig_class.
2003-12-22 Werner Koch <wk@gnupg.org>
* gpgme.h (_GPGME_D_CLASS): Kludge for C++ compatibility without
changing the C API.
2003-11-19 Werner Koch <wk@gnupg.org>
* conversion.c (_gpgme_parse_timestamp): New.
(atoi_1, atoi_2, atoi_4): New.
* keylist.c (parse_timestamp): Removed. Changed all callers to use
the new function.
* verify.c (parse_valid_sig): Ditto. Repalced the errno check.
* sign.c (parse_sig_created): Ditto.
2003-10-31 Werner Koch <wk@gnupg.org>
* keylist.c (parse_timestamp): Detect ISO 8601 timestamps and try
to convert them.
2003-10-10 Marcus Brinkmann <marcus@g10code.de>
* genkey.c (get_key_parameter): Make a copy of the key parameters.
Submitted by Miguel Coca <e970095@zipi.fi.upm.es>.
2003-10-06 Marcus Brinkmann <marcus@g10code.de>
* data-compat.c: Include <sys/time.h> before <sys/stat.h> for
broken systems.
* engine-gpgsm.c (map_assuan_error): If ERR is -1, return sensible
error.
* io.h (_gpgme_io_subsystem_init): New prototype.
* posix-io.c (_gpgme_io_subsystem_init): Add function.
(_gpgme_io_spawn): Do not fixup signal handler here.
* version.c (do_subsystem_inits): Call _gpgme_io_subsystem_init.
* debug.c (debug_init): Drop const qualifier from E.
* ath.h (struct ath_ops): Make ADDR argument of CONNECT prototype
const.
(ath_connect): Make ADDR argument const.
* ath-pthread.c (ath_connect): Likewise.
* ath-pth.c (ath_connect): Likewise.
* ath-compat.c (ath_connect): Likewise.
* ath.c (ath_connect): Likewise.
* ath.h [HAVE_SYS_SELECT_H]: Include <sys/select.h> for fd_set.
[!HAVE_SYS_SELECT_H]: Include <sys/time.h>.
* conversion.c (_gpgme_hextobyte): Drop "unsigned" from type of
SRC argument.
* util.h (_gpgme_hextobyte): Likewise for prototype.
* gpgme.h: Remove trailing comma in enum.
* rungpg.c: Do not include <time.h>, <sys/time.h>, <sys/types.h>,
<signal.h>, <fcntl.h>, or "unistd.h".
2003-10-02 Marcus Brinkmann <marcus@g10code.de>
* engine-backend.h (struct engine_ops): Add argument TYPE.
* engine.c (_gpgme_engine_op_edit): Likewise.
* engine.h: Likewise.
* rungpg.c (gpg_edit): Likewise. Use it.
* edit.c (edit_start): Likewise. Pass it on.
(gpgme_op_edit_start, gpgme_op_edit): Likewise.
(gpgme_op_card_edit_start, gpgme_op_card_edit): New functions.
2003-09-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpg_strerror_r): Change prototype to match
gpg_strerror_r change.
* error.c (gpg_strerror_r): Likewise, also update implementation.
* gpgme.c (gpgme_hash_algo_name): Change name of RMD160 to
RIPEMD160, name of TIGER to TIGER192, name of CRC32-RFC1510 to
CRC32RFC1510, and name of CRC24-RFC2440 to CRC24RFC2440.
2003-09-14 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Add prototype for gpgme_set_locale.
* gpgme.h: Define macro _GPGME_INLINE depending on the compiler
characteristics and use that instead __inline__.
* context.h (struct gpgme_context): New members lc_ctype and
lc_messages.
* gpgme.c: Include <locale.h>.
(def_lc_lock, def_lc_ctype, def_lc_messages): New static
variables.
(gpgme_set_locale): New function.
* engine.c (_gpgme_engine_new): Add arguments lc_ctype and
lc_messages.
* engine.h (_gpgme_engine_new): Likewise.
* engine-gpgsm.c (gpgsm_new): Likewise.
* rungpg.c (gpg_new): Likewise.
* engine-backend.h (struct engine_ops): Likewise to NEW.
* op-support.c (_gpgme_op_reset): Likewise to invocation of
_gpgme_engine_new.
2003-09-13 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_strerror_r): New prototype.
* error.c (gpgme_strerror_r): New function.
* get-env.c: New file.
* util.h (_gpgme_getenv): Add prototype.
* Makefile.am (libgpgme_real_la_SOURCES): Add get-env.c.
* rungpg.c (build_argv): Use _gpgme_getenv.
* debug.c (debug_init): Likewise.
* engine-gpgsm.c (gpgsm_new): Likewise.
(gpgsm_new): Use ttyname_r.
* w32-io.c (_gpgme_io_spawn): Disable debugging for now.
2003-09-03 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in: Use $libdir, not @libdir@, for the echo
command.
* gpgme-config.in: Rewritten.
* gpgme.m4: Rewritten.
2003-08-19 Marcus Brinkmann <marcus@g10code.de>
The ath files (ath.h, ath.c, ath-pth.c, ath-pthread.c,
ath-compat.c, ath-pth-compat.c and ath-pthread-compat.c) have been
updated to have better thread support, and the Makefile.am was
changed to reflect that.
* util.h [!HAVE_FOPENCOOKIE]: Remove fopencookie declaration.
* engine-gpgsm.c (gpgsm_assuan_simple_command): Set ERR to return
value of status_fnc.
* rungpg.c (start): Return SAVED_ERRNO, not errno.
2003-08-18 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (start): Use saved_errno instead errno.
2003-08-18 Marcus Brinkmann <marcus@g10code.de>
* funopen.c, putc_unlocked.c, isascii.c, memrchr.c: New files.
* fopencookie.c: File removed.
2003-08-15 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in: Put gpg-error related flags after gpgme's.
2003-08-14 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_new_signature): Rename member CLASS to
_OBSOLETE_CLASS, add member CLASS with type unsigned int.
* sign.c (parse_sig_created): Also set SIG->_unused_class for
backward compatibility.
2003-08-04 Marcus Brinkmann <marcus@g10code.de>
* verify.c (parse_new_sig): Fix status parsing case.
2003-07-31 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_subkey): Add flag CAN_AUTHENTICATE.
Lower _UNUSED to 23 bits.
(struct _gpgme_key): Likewise.
* keylist.c (set_mainkey_capability): Support 'a' and 'A'.
(set_subkey_capability): Support 'a'.
* keylist.c (gpgme_get_key): Check if there is more than one key
listed, and return GPG_ERR_AMBIGUOUS_NAME in that case.
* util.h (_gpgme_decode_c_string): Change type of LEN argument to
size_t.
(_gpgme_decode_percent_string): Likewise.
* conversion.c (_gpgme_decode_c_string): Likewise.
(_gpgme_decode_percent_string): Likewise.
(_gpgme_map_gnupg_error): Change type of I to unsigned int.
* signers.c (gpgme_signers_clear): Likewise.
(gpgme_signers_enum): New unsigned variable SEQNO, set to SEQ.
Use SEQNO instead SEQ.
* wait.c (fd_table_put): Change type of I and J to unsigned int.
* wait-global.c (_gpgme_wait_global_event_cb): Change type of IDX
to unsigned int.
(gpgme_wait): Change type of I and IDX to unsigned int.
* wait-private.c (_gpgme_wait_on_condition): Change type of IDX
and I to unsigned int.
* posix-io.c (_gpgme_io_close): Cast return value of macro DIM to
int to suppress gcc warning.
(_gpgme_io_set_close_notify): Likewise.
(_gpgme_io_select): Change type of I to unsigned int.
* engine.c (gpgme_get_engine_info): Change type of PROTO to
unsigned int.
* wait-user.c (_gpgme_user_io_cb_handler): Change type of IDX and
I to unsigned int.
2003-07-29 Marcus Brinkmann <marcus@g10code.de>
* decrypt-verify.c (decrypt_verify_status_handler): Expand silly
and wrong expression.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* encrypt.c (encrypt_sym_status_handler): Likewise.
* sign.c (sign_status_handler): Likewise.
* verify.c (verify_status_handler): Likewise.
* decrypt.c (decrypt_status_handler): Likewise.
* engine.c (gpgme_get_engine_info): Initialize NULL.
2003-07-23 Marcus Brinkmann <marcus@g10code.de>
* gpgme-config.in (gpg_error_libs): Quote GPG_ERROR_CFLAGS and
GPG_ERROR_LIBS when setting the corresponding variables.
Reported by Stéphane Corthésy.
2003-07-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (set_recipients): Move declaration of NEWLEN to
the beginning of the block.
2003-06-22 Marcus Brinkmann <marcus@g10code.de>
* data-mem.c (mem_write): Copy original buffer content.
2003-06-22 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_user_ids_release, gpgme_user_ids_append): Remove
prototypes.
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (AM_CPPFLAGS): Add @GPG_ERROR_CFLAGS@.
* gpgme-config.in (gpg_error_libs, gpg_error_cflags): New variables.
Print them.
* op-support.c (_gpgme_parse_inv_userid): Rename to
_gpgme_parse_inv_recp and change to new datatype.
* ops.h (_gpgme_parse_inv_key): Fix prototype.
* gpgme.h (struct _gpgme_invalid_user_id): Rename to
__gpgme_invalid_key. Rename field ID to KEY.
(gpgme_invalid_user_id_t): Rename to gpgme_invalid_key_t.
(struct _gpgme_op_encrypt_result): Here, too.
(struct _gpgme_op_sign_result): Likewise.
* encrypt.c (struct op_data): Likewise.
(release_op_data): Likewise.
* sign.c (struct op_data): Likewise.
(release_op_data): Likewise.
* posix-io.c (_gpgme_io_read): Save errno across debug calls.
(_gpgme_io_write): Likewise.
(_gpgme_io_pipe): Likewise.
(_gpgme_io_select): Likewise.
* rungpg.c (struct engine_gpg): Remove arg_error.
(add_arg): Don't set arg_error.
(add_data): Likewise.
(start): Don't check arg_error.
(gpg_new): Check return value of add_arg.
* verify.c (parse_notation): Free allocated memory at error.
2003-06-05 Marcus Brinkmann <marcus@g10code.de>
Everywhere: Use libgpg-error error codes.
* Makefile.am (EXTRA_DIST): Remove mkerrors.
(BUILT_SOURCES): Remove errors.c.
(MOSTLYCLEANFILES): Likewise.
(libgpgme_la_SOURCES): Likewise. Add error.c.
(errors.c): Remove target.
* mkerrors: File removed.
* error.c: New file.
* gpgme.h (gpgme_error_t): Change to type gpg_error_t.
(gpgme_err_code_t, gpgme_err_source_t): New types.
(gpgme_err_code, gpgme_err_source, gpgme_error, gpgme_err_make):
New static inline functions.
(gpgme_strsource, gpgme_err_code_from_errno,
gpgme_err_code_to_errno, gpgme_err_make_from_errno,
gpgme_error_from_errno): New prototypes.
2003-05-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_op_export_start): Change second arg to const char *.
(gpgme_op_export): Likewise.
(gpgme_op_export_ext_start): New prototype.
(gpgme_op_export_ext): Likewise.
* engine.h: Likewise for _gpgme_engine_op_export and
_gpgme_engine_op_export_ext.
* engine-backend.h (struct engine_ops): Change second argument of
prototype of export to const char *, and add reserverd int as
third argument. Add prototype for export_ext.
* engine.c (_gpgme_engine_op_export_ext): New function.
(_gpgme_engine_op_export): Change second argument of prototype of
export to const char *, and add reserverd int as third argument.
* rungpg.c (gpg_export): Change second argument of prototype of
export to const char *, and add reserverd int as third argument.
(gpg_export_ext): New function.
(gpg_keylist_ext): Break loop at error.
(_gpgme_engine_ops_gpg): Add gpg_export_ext.
* engine-gpgsm.c (gpgsm_export): Change second argument of
prototype of export to const char *, and add reserverd int as
third argument.
(gpgsm_export_ext): New function.
(_gpgme_engine_ops_gpgsm): Add gpgsm_export_ext.
* export.c (export_start): Change second argument of prototype of
export to const char *, and add reserverd int as third argument.
(gpgme_op_export_start): Likewise.
(export_ext_start): New function.
(gpgme_op_export_ext_start): Likewise.
(gpgme_op_export_ext): Likewise.
* gpgme.h (gpgme_keylist_mode_t): New type for anonymous enum.
(gpgme_sigsum_t): New type for anonymous enum.
* encrypt-sign.c (encrypt_sign_start): Check for errors earlier,
and return an error if RECP is not set.
* Makefile.am (libgpgme_la_SOURCES): Remove user-id.c.
* user-id.c: Remove file.
* ops.h: Remove prototype for _gpgme_user_ids_all_valid.
* gpgme.h (gpgme_encrypt_flags_t): New type.
(gpgme_op_encrypt_start): Change second parameter to type
gpgme_key_t[], and add third parameter.
(gpgme_op_encrypt): Likewise.
(gpgme_op_encrypt_sign_start): Likewise.
(gpgme_op_encrypt_sign): Likewise.
* encrypt.c (encrypt_start): Likewise.
(gpgme_op_encrypt_start): Likewise.
(gpgme_op_encrypt): Likewise. Pass flags to engine.
* encrypt-sign.c (encrypt_sign_start): Likewise.
(gpgme_op_encrypt_sign_start): Likewise.
(gpgme_op_encrypt_sign): Likewise.
* engine-backend.h (struct engine_ops): Likewise for prototypes of
encrypt and encrypt_sign.
* engine.h: Likewise for prototypes of _gpgme_engine_op_encrypt
and _gpgme_engine_op_encrypt_sign.
* engine.c (_gpgme_engine_op_encrypt): Likewise.
(_gpgme_engine_op_encrypt_sign): Likewise.
* rungpg.c (gpg_encrypt): Likewise.
(gpg_encrypt_sign): Likewise.
* rungpg.c (gpg_encrypt): Check flags for always trust option.
* engine-gpgsm.c (gpgsm_encrypt): Likewise.
(set_recipients): Rewritten to use keys instead user IDs.
* rungpg.c (append_args_from_recipients): Rewritten to use keys
instead user IDs.
* encrypt.c (_gpgme_encrypt_status_handler): Change errors
returned to GPGME_Invalid_Key and GPGME_General_Error.
2003-05-28 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c: Rename GpgsmObject to engine_gpgsm_t.
(struct gpgsm_object_s): Rename to struct engine_gpgsm.
* rungpg.c: Rename GpgObject to engine_gpg_t.
(struct gpg_object_s): Rename to struct engine_gpg.
* context.h (struct gpgme_context): Change EngineObject to
engine_object_t.
(enum ctx_op_data_type): Rename to ctx_op_data_id_t.
(ctx_op_data_t): New type.
(struct gpgme_context): Use it.
* ops.h (_gpgme_op_data_lookup): Use new type name.
* op-support.c (_gpgme_op_data_lookup): Likewise.
* engine.c: Rename EngineObject to engine_t in the file. Also
EngineStatusHandler to engine_status_handler_t,
EngineCommandHandler to engine_command_handler_t and
EngineColonLineHandler to engine_colon_line_handler.
* rungpg.c (start): Likewise.
* engine-gpgsm.c: Likewise.
* engine-backend.h (struct engine_ops): Likewise
* engine.h (struct engine_object_s): Rename to struct engine.
(EngineObject): Rename to engine_t. Also everywhere else in the
file.
(EngineStatusHandler): Rename to engine_status_handler_t.
(EngineColonLineHandler): Rename to engine_colon_line_handler_t.
(EngineCommandHandler): Rename to engine_command_handler_t.
* engine-gpgsm.c (gpgsm_export): Fix bug in last change.
* Makefile.am (libgpgme_la_SOURCES): Remove recipient.c, add
user-id.c.
* gpgme.h (gpgme_recipients_t): Removed.
(gpgme_recipients_new, gpgme_recipients_release,
gpgme_recipients_add_name,
gpgme_recipients_add_name_with_validity, gpgme_recipients_count,
gpgme_recipients_enum_open, gpgme_recipients_enum_read,
gpgme_recipients_enum_close): Removed.
(gpgme_op_encrypt, gpgme_op_encrypt_start, gpgme_op_encrypt_sign,
gpgme_op_encrypt_sign_start, gpgme_op_export_start,
gpgme_op_export): Change second argument to gpgme_user_id_t.
(gpgme_user_ids_release): New prototype.
(gpgme_user_ids_append): Likewise.
* ops.h (_gpgme_recipients_all_valid): Remove.
(_gpgme_user_ids_all_valid): Add.
* context.h (struct gpgme_recipients): Removed.
* user-id.c: New file.
* recipient.c: Removed file.
* rungpg.c (append_args_from_recipients): Change last arg to
gpgme_user_id_t. Reimplement.
(gpg_encrypt): Change second arg to gpgme_user_id_t.
(gpg_encrypt_sign): Likewise.
(gpg_export): Likewise. Rewrite user ID list code.
* engine.c (_gpgme_engine_op_encrypt): Change second arg to
gpgme_user_id_t.
(_gpgme_engine_op_encrypt_sign): Likewise.
(_gpgme_engine_op_export): Likewise.
* engine.h (_gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign,
_gpgme_engine_op_export): Likewise.
* engine-gpgsm.c (set_recipients): Likewise. Rewrite loop code.
(gpgsm_encrypt): Likewise.
(gpgsm_export): Likewise.
* engine-backend.h (struct engine_ops): Likewise for members
ENCRYPT, ENCRYPT_SIGN and EXPORT.
* export.c (export_start, gpgme_op_export_start, gpgme_op_export):
Likewise.
* encrypt.c (encrypt_start): Likewise. Don't check for count of
recipients.
(gpgme_op_encrypt_start): Likewise.
(gpgme_op_encrypt): Likewise.
* encrypt-sign.c (encrypt_sign_start): Likewise.
(gpgme_op_encrypt_sign): Likewise.
(gpgme_op_encrypt_sign_start): Likewise.
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_op_import_result): Add skipped_new_keys.
* import.c (parse_import_res): Add skipped_new_keys parser.
* op-support.c (_gpgme_parse_inv_userid): Add missing break
statements.
* encrypt.c (gpgme_op_encrypt): Use gpgme_error_t instead of int.
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
* encrypt.c (gpgme_op_encrypt_result): Use intermediate variable
HOOK to avoid compiler warning. Don't ask, you don't want to know.
(_gpgme_encrypt_status_handler): Likewise.
(_gpgme_op_encrypt_init_result): Likewise.
* decrypt.c (gpgme_op_decrypt_result): Likewise.
(_gpgme_decrypt_status_handler): Likewise.
(_gpgme_op_decrypt_init_result): Likewise.
* verify.c (gpgme_op_verify_result): Likewise.
(_gpgme_verify_status_handler): Likewise.
(_gpgme_op_verify_init_result): Likewise.
* edit.c (edit_status_handler): Likewise.
(command_handler): Likewise.
(edit_start): Likewise.
* genkey.c (gpgme_op_genkey_result): Likewise.
(genkey_status_handler): Likewise.
(genkey_start): Likewise.
* import.c (gpgme_op_import_result): Likewise.
(import_status_handler): Likewise.
(_gpgme_op_import_start): Likewise.
* trustlist.c (gpgme_op_trustlist_next): Likewise.
(_gpgme_op_trustlist_event_cb): Likewise.
(gpgme_op_trustlist_start): Likewise.
* keylist.c (gpgme_op_keylist_result): Likewise.
(keylist_colon_handler): Likewise.
(keylist_status_handler): Likewise.
(_gpgme_op_keylist_event_cb): Likewise.
(gpgme_op_keylist_start): Likewise.
(gpgme_op_keylist_ext_start): Likewise.
(gpgme_op_keylist_next): Likewise.
* passphrase.c (_gpgme_passphrase_status_handler): Likewise.
(_gpgme_passphrase_command_handler_internal): Likewise.
* sign.c (gpgme_op_sign_result): Likewise.
(_gpgme_sign_status_handler): Likewise.
(_gpgme_op_sign_init_result): Likewise.
* passphrase.c (_gpgme_passphrase_command_handler_internal): Fix
access to pointer type.
2003-05-26 Marcus Brinkmann <marcus@g10code.de>
* engine.h (EngineCommandHandler): Change last argument to int fd.
* gpgme.h (gpgme_passphrase_cb_t): Rewritten to take parts of the
description and fd.
(gpgme_edit_cb_t): Change last argument to int fd.
* ops.h (_gpgme_passphrase_command_handler_internal): New prototype.
* passphrase.c: Include <assert.h>.
(op_data_t): Rename userid_hint to uid_hint, remove last_pw_handle.
(release_op_data): Check values before calling free.
(_gpgme_passphrase_status_handler): Likewise.
(_gpgme_passphrase_command_handler_internal): New function.
(_gpgme_passphrase_command_handler): Rewritten.
* edit.c (edit_status_handler): Pass -1 as fd argument.
(command_handler): Update prototype. New variable processed. Use
it to store return value of
_gpgme_passphrase_command_handler_internal which is now used
instead _gpgme_passphrase_command_handler. Use it also to check
if we should call the user's edit function. Pass fd to user's
edit function.
* rungpg.c (struct gpg_object_s): Change type of cmd.cb_data to
void *.
(gpg_release): Check value before calling free. Do not release
cmd.cb_data.
(command_cb): Function removed.
(command_handler): New function. Thus we don't use a data object
for command handler stuff anymore, but handle it directly. This
allows proper error reporting (cancel of passphrase requests, for
example). Also all callbacks work via direct writes to the file
descriptor (so that passphrases are not kept in insecure memory).
(gpg_set_command_handler): Rewritten to use even more ugly hacks.
(read_status): Check cmd.keyword before calling free. Install
command_handler as the I/O callback handler with GPG as private
data.
* rungpg.c (gpg_new): Add --enable-progress-filter to gpg
invocation.
* decrypt-verify.c (_gpgme_op_decrypt_verify_start): Rename to
decrypt_verify_start.
(gpgme_op_decrypt_verify_start): Call decrypt_verify_start.
(gpgme_op_decrypt_verify): Likewise.
* verify.c (verify_status_handler): New function that also calls
progress status handler.
(_gpgme_op_verify_start): Set status handler to verify_status_handler.
Rename to (verify_start).
(gpgme_op_verify_start): Call verify_start.
(gpgme_op_verify): Likewise.
* encrypt.c (encrypt_status_handler): New function.
(_gpgme_encrypt_sym_status_handler): Call progress status handler.
Make static. Rename to encrypt_sym_status_handler.
(encrypt_start): Set status handler to encrypt_sym_status_handler
or encrypt_status_handler.
* sign.c (sign_status_handler): New function.
(sign_start): Set status handler to sign_status_handler.
* decrypt.c (decrypt_status_handler): New function that also calls
progress status handler.
(decrypt_start): Set status handler to decrypt_status_handler.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* decrypt-verify.c (decrypt_verify_status_handler): Call
_gpgme_progress_status_handler.
* conversion.c (_gpgme_decode_c_string): Add missing break
statement.
* recipient.c (gpgme_recipients_add_name_with_validity): Add one
to buffer to allocate.
2003-05-19 Marcus Brinkmann <marcus@g10code.de>
* verify.c (parse_new_sig): Fix ERRSIG case.
Submitted by Benjamin Lee <benjaminlee@users.sf.net>.
2003-05-18 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: The following types are renamed. The old name is kept
as a deprecated typedef.
(GpgmeCtx): Rename to gpgme_ctx_t.
(GpgmeData): Rename to gpgme_data_t.
(GpgmeRecipients): Rename to gpgme_recipients_t.
(GpgmeError): Rename to gpgme_error_t.
(GpgmeDataEncoding): Rename to gpgme_data_encoding_t.
(GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t.
(GpgmeHashAlgo): Rename to gpgme_hash_algo_t.
(GpgmeSigStat): Rename to gpgme_sig_stat_t.
(GpgmeSigMode): Rename to gpgme_sig_mode_t.
(GpgmeAttr): Rename to gpgme_attr_t.
(GpgmeValidity): Rename to gpgme_validity_t.
(GpgmeProtocol): Rename to gpgme_protocol_t.
(GpgmeStatusCode): Rename to gpgme_status_code_t.
(GpgmeEngineInfo): Rename to gpgme_engine_info_t.
(GpgmeSubkey): Rename to gpgme_subkey_t.
(GpgmeKeySig): Rename to gpgme_keysig_t.
(GpgmeUserID): Rename to gpgme_user_id_t.
(GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t.
(GpgmeProgressCb): Rename to gpgme_progress_cb_t.
(GpgmeEditCb): Rename to gpgme_edit_cb_t.
(GpgmeIOCb): Rename to gpgme_io_cb_t.
(GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t.
(GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t.
(GpgmeEventIO): Rename to gpgme_event_io_t.
(GpgmeEventIOCb): Rename to gpgme_event_io_cb_t.
(GpgmeIOCbs): Rename to gpgme_io_cbs.
(gpgme_io_cbs_t): New type.
(GpgmeDataReadCb): Rename to gpgme_data_read_cb_t.
(GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t.
(GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t.
(GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t.
(GpgmeDataCbs): Rename to gpgme_data_cbs.
(gpgme_data_cbs_t): New type.
(GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t.
(GpgmeEncryptResult): Rename to gpgme_encrypt_result_t.
(GpgmeDecryptResult): Rename to gpgme_decrypt_result_t.
(GpgmeNewSignature): Rename to gpgme_new_signature_t.
(GpgmeSignResult): Rename to gpgme_sign_result_t.
(GpgmeSigNotation): Rename to gpgme_sig_notation_t.
(GpgmeSignature): Rename to gpgme_signature_t.
(GpgmeVerifyResult): Rename to gpgme_verify_result_t.
(GpgmeImportStatus): Rename to gpgme_import_status_t.
(GpgmeImportResult): Rename to gpgme_import_result_t.
(GpgmeGenKeyResult): Rename to gpgme_genkey_result_t.
(GpgmeKeyListResult): Rename to gpgme_keylist_result_t.
(GpgmeTrustItem): Rename to gpgme_trust_item_t.
* gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros
GPGME_No_Recipients, GPGME_Invalid_Recipient and
GPGME_No_Passphrase.
* data.h (struct gpgme_data_s): Rename to struct gpgme_data.
* context.h (struct gpgme_context_s): Rename to struct
gpgme_context.
(struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (finish_key): Clear OPD->tmp_uid.
2003-05-18 Marcus Brinkmann <marcus@g10code.de>
* verify.c (_gpgme_verify_status_handler): Return GPGME_No_Data
for NODATA status without signatures.
2003-05-05 Marcus Brinkmann <marcus@g10code.de>
* key.c (_gpgme_key_append_name): Use decoded string to parse user id.
(_gpgme_key_add_sig): Likewise.
2003-05-04 Marcus Brinkmann <marcus@g10code.de>
* context.h (struct gpgme_context_s): Remove member op_info.
* key.c (_gpgme_key_add_sig): Initialize SIG->uid.
* gpgme.h (GpgmeError): Add deprecated values for
GPGME_Invalid_Type and GPGME_Invalid_Mode.
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_get_op_info): Remove prototype.
* ops.h (_gpgme_set_op_info,
_gpgme_data_release_and_return_string, _gpgme_data_get_as_string,
_gpgme_data_append, _gpgme_data_append_string,
_gpgme_data_append_string_for_xml, _gpgme_data_append_for_xml,
_gpgme_data_append_percentstring_for_xml): Likewise.
(_gpgme_progress_status_handler): Change first arg to void *.
* progress.c (_gpgme_progress_status_handler): Likewise.
* conversion.c: Do not include <string.h>, <errno.h>, <ctype.h>,
and <sys/types.h>, but <string.h>.
(_gpgme_data_append): Remove function.
(_gpgme_data_append_string): Likewise.
(_gpgme_data_append_for_xml): Likewise.
(_gpgme_data_append_string_for_xml): Likewise.
(_gpgme_data_append_percentstring_for_xml): Likewise.
* data-mem.c (_gpgme_data_get_as_string): Likewise.
(_gpgme_data_release_and_return_string): Likewise.
* gpgme.c (gpgme_get_op_info): Likewise.
(_gpgme_set_op_info): Likewise.
* gpgme.h (struct _gpgme_key): New structure.
(GpgmeKey): Define using _gpgme_key.
(struct _gpgme_subkey): New structure.
(GpgmeSubKey): New type.
(struct _gpgme_key_sig): New structure.
(GpgmeKeySig): New type.
(struct _gpgme_user_id): New structure.
(GpgmeUserID): New type.
(struct _gpgme_op_keylist_result): New structure.
(GpgmeKeyListResult): New type.
(gpgme_op_keylist_result): New function.
(gpgme_key_get_as_xml): Remove prototype.
* context.h (struct gpgme_context_s): Remove members tmp_key,
tmp_uid, key_cond and key_queue.
(struct key_queue_item_s): Remove structure.
(struct user_id_s): Remove structure.
(struct gpgme_recipients_s): Replace with simple
GpgmeUserID list.
* gpgme.c (gpgme_release): Do not release CTX->tmp_key.
* ops.h (_gpgme_key_add_subkey, _gpgme_key_append_name,
_gpgme_key_add_sig, _gpgme_trust_item_new): New prototypes.
* rungpg.c (command_cb): Return GpgmeError instead int.
New variable ERR. Use it to hold return value of cmd handler.
(gpg_delete): Access fingerprint of key directly.
(append_args_from_signers): Likewise.
(gpg_edit): Likewise.
(append_args_from_recipients): Use GpgmeUserID for recipient list.
* engine-gpgsm.c: Do not include "key.h".
(gpgsm_delete): Access fingerprint of key directly.
(gpgsm_sign): Likewise.
(set_recipients): Use GpgmeUserID for recipients. Invert invalid
user ID flag.
* key.h: File removed.
* key.c: Completely reworked to use exposed GpgmeKey data types.
* keylist.c: Likewise.
* recipient.c: Completely reworked to use GpgmeUserID.
2003-04-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_get_key): Remove force_update argument.
* key-cache.c: File removed.
* Makefile.am (libgpgme_la_SOURCES): Remove key-cache.c.
* ops.h (_gpgme_key_cache_add, _gpgme_key_cache_get): Remove
prototypes.
* keylist.c (_gpgme_op_keylist_event_cb): Don't call
_gpgme_key_cache_add.
(gpgme_get_key): New function.
* verify.c (gpgme_get_sig_key): Remove last argument to
gpgme_get_key invocation.
* gpgme.h (struct _gpgme_trust_item): New structure.
(GpgmeTrustItem): New type.
(gpgme_trust_item_ref, gpgme_trust_item_unref): New prototypes.
* context.h (struct trust_queue_item_s): Remove structure.
(struct gpgme_context_s): Remove trust_queue member.
* Makefile.am (libgpgme_la_SOURCES): Add trust-item.c.
* trust-item.c: New file.
* trustlist.c: Do not include <stdio.h> or <time.h>, but
"gpgme.h".
(struct trust_queue_item_s): Change to new type op_data_t.
(trust_status_handler): Change first argument to void *.
(trust_colon_handler): Likewise.
(_gpgme_op_trustlist_event_cb): Use op_data_t type.
(gpgme_op_trustlist_start): Use op_data_t and rework error
handling.
(gpgme_op_trustlist_next): Use op_data_t.
(gpgme_trust_item_release): Remove function.
(gpgme_trust_item_get_string_attr): Likewise.
(gpgme_trust_item_get_int_attr): Likewise.
* verify.c (calc_sig_summary): Do not set GPGME_SIGSUM_SYS_ERROR
for bad signatures.
2003-04-28 Marcus Brinkmann <marcus@g10code.de>
* context.h: Remove OPDATA_VERIFY_COLLECTING.
(struct gpgme_context_s): Remove member notation.
* gpgme.h: Make enum for GPGME_KEYLIST_MODE_* values.
* gpgme.h (struct _gpgme_sig_notation): New structure.
(GpgmeSigNotation): New type.
(struct _gpgme_signature): New structure.
(GpgmeSignature): New type.
(struct _gpgme_op_verify_result): New structure.
(GpgmeVerifyResult): New type.
(gpgme_op_verify_result): New prototype.
(gpgme_get_notation): Remove prototype.
* ops.h (_gpgme_op_verify_init_result): New prototype.
(_gpgme_verify_status_handler): Change first argument to void *.
* util.h (_gpgme_decode_percent_string, _gpgme_map_gnupg_error):
New prototypes.
* conversion.c (_gpgme_decode_percent_string): New function.
(gnupg_errors): New static global.
(_gpgme_map_gnupg_error): New function.
* gpgme.c (gpgme_release): Don't release CTX->notation.
(gpgme_get_notation): Remove function.
* decrypt-verify.c (_gpgme_op_decrypt_verify_start): Call
_gpgme_op_verify_init_result.
* verify.c: Do not include <stdio.h>, <assert.h> and "key.h", but
do include "gpgme.h".
(struct verify_result): Replace with ...
(op_data_t): ... this type.
(release_verify_result): Remove function.
(release_op_data): New function.
(is_token): Remove function.
(skip_token): Remove function.
(copy_token): Remove function.
(gpgme_op_verify_result): New function.
(calc_sig_summary): Rewritten.
(finish_sig): Remove function.
(parse_new_sig): New function.
(parse_valid_sig): New function.
(parse_notation): New function.
(parse_trust): New function.
(parse_error): New function.
(_gpgme_verify_status_handler): Rewritten. Change first argument
to void *.
(_gpgme_op_verify_start): Rework error handling. Call
_gpgme_op_verify_init_result.
(gpgme_op_verify): Do not release or clear CTX->notation.
(gpgme_get_sig_status): Rewritten.
(gpgme_get_sig_string_attr): Likewise.
(gpgme_get_sig_ulong_attr): Likewise.
(gpgme_get_sig_key): Likewise.
* gpgme.h (struct _gpgme_op_decrypt_result): New structure.
(GpgmeDecryptResult): New type.
(gpgme_op_decrypt_result): New prototype.
* ops.h (_gpgme_op_decrypt_init_result): New prototype.
(_gpgme_decrypt_status_handler): Fix prototype.
(_gpgme_decrypt_start): Remove prototype.
* decrypt-verify.c: Do not include <stdio.h>, <stdlib.h>,
<string.h> and <assert.h>, "util.h" and "context.h", but
"gpgme.h".
(decrypt_verify_status_handler): Change first argument to void *,
and rework error handling.
(_gpgme_op_decrypt_verify_start): New function.
(gpgme_op_decrypt_verify_start): Rewrite using
_gpgme_op_decrypt_verify_start.
(gpgme_op_decrypt_verify): Likewise.
* decrypt.c: Include <string.h>, "gpgme.h" and "util.h".
(struct decrypt_result): Change to typedef op_data_t, rewritten.
(is_token): Remove function.
(release_op_data): New function.
(skip_token): Remove function.
(gpgme_op_decrypt_result): New function.
(_gpgme_decrypt_status_handler): Change first argument to void *.
Rework error handling.
(_gpgme_decrypt_start): Rename to ...
(decrypt_start): ... this. Call _gpgme_op_decrypt_init_result.
(_gpgme_op_decrypt_init_result): New function.
(gpgme_op_decrypt_start): Use decrypt_start.
(gpgme_op_decrypt): Likewise.
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* encrypt-sign.c: Do not include <stddef.h>, <stdio.h>,
<stdlib.h>, <string.h>, <assert.h> and "util.h", but "gpgme.h".
(_gpgme_op_encrypt_sign_start): Rename to ...
(encrypt_sign_start): ... this.
(gpgme_op_encrypt_sign_start): Use encrypt_sign_start, not
_gpgme_op_encrypt_sign_start.
(gpgme_op_encrypt_sign): Likewise.
* gpgme.h (GpgmeEncryptResult): New data type.
(gpgme_op_encrypt_result): New prototype.
* ops.h (_gpgme_op_encrypt_init_result): New prototype.
(_gpgme_op_encrypt_status_handler): Fix prototype.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Call
_gpgme_op_encrypt_init_result.
* encrypt.c: Do not include <stdio.h>, <assert.h>, "util.h" and
"wait.h". Include <errno.h> and "gpgme.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct encrypt_result): Rename to ...
(op_data_t): ... new data type. Rewrite for user result data.
(append_xml_encinfo): Remove function.
(release_op_data): New function.
(gpgme_op_encrypt_result): New function.
(_gpgme_op_encrypt_status_handler): Change first argument to void *.
Rewrite result parsing.
(_gpgme_op_encrypt_sym_status_handler): Change first argument to
void *.
(_gpgme_op_encrypt_init_result): New function.
(_gpgme_op_encrypt_start): Rename to ...
(encrypt_start): ... this.
(gpgme_op_encrypt_start): Use encrypt_start, not
gpgme_op_encrypt_start.
(gpgme_op_encrypt): Likewise.
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Call
_gpgme_op_sign_init_result.
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Change GPGME_IMPORT_PRIVATE to GPGME_IMPORT_SECRET.
* import.c (parse_import_res): Parse unchanged field.
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key added as new error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
* edit.c: Do not include <assert.h>, "util.h", but "gpgme.h".
(edit_resut): Change to typedef for op_data_t.
(edit_status_handler): Change first argument to void *.
Rework error handling.
(command_handler): Rework error handling.
(_gpgme_op_edit_start): Rename to ...
(edit_start): ... this. Rework error handling.
(gpgme_op_edit_start): Rewrite using edit_start.
(gpgme_op_edit): Likewise.
* ops.h (_gpgme_passphrase_start): Remove prototype.
* passphrase.c: Do not include <assert.h>, "util.h" or
"debug.h", but "gpgme.h".
(struct passphrase_result): Change to typedef for op_data_t.
(release_passphrase_result): Rename to release_op_data.
(_gpgme_passphrase_status_handler): Change first argument to void *.
Use new op_data_t type.
(_gpgme_passphrase_command_handler): Use new op_data_t type.
(_gpgme_passphrase_start): Remove function.
* decrypt.c (_gpgme_decrypt_start): Rewrite error handling. Do
not call _gpgme_passphrase_start, but install command handler.
* encrypt.c (_gpgme_op_encrypt_start): Likewise.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise.
* sign.c (_gpgme_op_sign_start): Likewise.
* context.h (struct gpgme_context_s): Remove member initialized,
use_cms and help_data_1. Add member protocol. Make use_armor and
use_textmode bit flags. Make keylist_mode, include_certs,
signers_len and signers_size unsigned.
* gpgme.c (gpgme_new): Initialize CTX->protocol.
(gpgme_set_protocol): Do not check CTX. Use CTX->protocol.
(gpgme_get_protocol): Likewise.
(gpgme_release): Do not release CTX->help_data_1.
* op-support.c (_gpgme_op_reset): Use CTX->protocol.
* wait-private.c (_gpgme_wait_private_event_cb): Remove variable CTX.
* data.c: Do not include <assert.h>, but "gpgme.h".
(_gpgme_data_inbound_handler): Expand _gpgme_data_append, because
it will go. Do not assert DH.
(_gpgme_data_outbound_handler): Do not assert DH.
* export.c: Do not include <stdlib.h>, "debug.h" and "util.h", but
"gpgme.h".
(export_status_handler): Change type of first argument to void *.
(_gpgme_op_export_start): Rename to ...
(export_start): ... this. Rework error handling.
(gpgme_op_export_start): Rewritten to use export_start instead
_gpgme_op_export_start.
(gpgme_op_export): Likewise.
* gpgme.h (GpgmeError): Add GPGME_Busy, GPGME_No_Request.
(GPGME_No_Recipients, GPGME_Invalid_Recipient,
GPGME_No_Passphrase): New macros.
* key.c (gpgme_key_get_string_attr): Fix validity attribute.
2003-04-24 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (struct _gpgme_op_genkey_result): New structure.
(GpgmeGenKeyResult): New type.
(gpgme_op_genkey): Drop last argument.
(gpgme_op_genkey_result): New function.
* genkey.c: Do not include "util.h", but "gpgme.h".
(struct genkey_result): Replace with ...
(op_data_t): ... this new type.
(release_genkey_result): Replace with ...
(release_op_data): ... this new function.
(gpgme_op_genkey_result): New function.
(genkey_status_handler): Rewritten using new op_data_t type.
(get_key_parameter): New function.
(_gpgme_op_genkey_start): Renamed to
(genkey_start): ... this and rewritten.
(gpgme_op_genkey_start): Use genkey_start instead
_gpgme_op_genkey_start.
(gpgme_op_genkey): Rewritten. Remove FPR argument.
* context.h (struct gpgme_context_s): Remove member verbosity.
* gpgme.c (gpgme_new): Do not set member verbosity.
* engine.h (_gpgme_engine_set_verbosity): Remove prototype.
* engine.c (_gpgme_engine_set_verbosity): Remove function.
* engine-backend.h (struct engine_ops): Remove set_verbosity.
* engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Remove set_verbosity member.
* rungpg.c (_gpgme_engine_ops_gpg): Likewise.
(gpg_set_verbosity): Remove function.
* decrypt.c (_gpgme_decrypt_start): Don't call
_gpgme_engine_set_verbosity.
* delete.c (_gpgme_op_delete_start): Likewise.
* edit.c (_gpgme_op_edit_start): Likewise.
* encrypt.c (_gpgme_op_encrypt_start): Likewise.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise.
* export.c (_gpgme_op_export_start): Likewise.
* genkey.c (_gpgme_op_genkey_start): Likewise.
* import.c (_gpgme_op_import_start): Likewise.
* keylist.c (gpgme_op_keylist_start): Likewise.
(gpgme_op_keylist_ext_start): Likewise.
* sign.c (_gpgme_op_sign_start): Likewise.
* verify.c (_gpgme_op_verify_start): Likewise.
* Makefile.am (libgpgme_la_SOURCES): Add key-cache.c.
* key.c (key_cache_initialized, key_cache_size,
key_cache_max_chain_length, ): Removed.
(struct key_cache_item_s, key_cache_lock, key_cache,
key_cache_unused_items, hash_key, _gpgme_key_cache_add,
_gpgme_key_cache_get, gpgme_get_key): Moved to ...
* key-cache.c: ... here. New file.
* key.h (_gpgme_key_cache_init): Remove prototypes.
(_gpgme_key_cache_add,_gpgme_key_cache_get): Move to ...
* ops.h: ... here.
* version.c: Do not include "key.h".
(do_subsystem_inits): Do not call _gpgme_key_cache_init.
* mkstatus: Strip trailing comma.
* gpgme.h (GpgmeStatus): Pretty print.
* gpgme.h (GpgmeError): Rename GPGME_No_Passphrase to
GPGME_Bad_Passphrase.
* passphrase.c (_gpgme_passphrase_status_handler): Use
GPGME_Bad_Passphrase instead GPGME_No_Passphrase.
* gpgme.h (GpgmeError): Rename GPGME_No_Recipients to
GPGME_No_UserID and GPGME_Invalid_Recipient to
GPGME_Invalid_UserID.
* encrypt.c (_gpgme_encrypt_status_handler): Use GPGME_No_UserID
instead GPGME_No_Recipients and GPGME_Invalid_UserID instead
GPGME_Invalid_Recipient.
(_gpgme_op_encrypt_start): Likewise.
* gpgme.h (GpgmeError): Remove GPGME_Busy and GPGME_No_Request.
* wait-user.c (_gpgme_wait_user_event_cb): Don't clear CTX->pending.
* wait-private.c (_gpgme_wait_private_event_cb): Likewise.
* wait-global.c (gpgme_wait): Likewise.
* verify.c (_gpgme_op_verify_start): Likewise.
(gpgme_get_sig_status): Don't check pending flag.
(gpgme_get_sig_string_attr): Likewise.
(gpgme_get_sig_ulong_attr): Likewise.
(gpgme_get_sig_key): Likewise.
* op-support.c (_gpgme_op_reset): Likewise.
* trustlist.c (gpgme_op_trustlist_start): Don't clear pending flag.
(gpgme_op_trustlist_next): Don't check or clear pending flag.
(gpgme_op_trustlist_end): Likewise.
* sign.c (_gpgme_op_sign_start): Likewise.
* context.h (struct gpgme_context_s): Remove member PENDING.
* decrypt.c (_gpgme_decrypt_start): Likewise.
* delete.c (_gpgme_op_delete_start): Likewise.
* edit.c (_gpgme_op_edit_start): Likewise.
* encrypt.c (_gpgme_op_encrypt_start): Likewise.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise.
* export.c (_gpgme_op_export_start): Likewise.
* genkey.c (_gpgme_op_genkey_start): Likewise.
* import.c (_gpgme_op_import_start): Likewise.
* key.c (gpgme_get_key): Likewise.
* keylist.c (gpgme_op_keylist_start): Likewise.
(gpgme_op_keylist_ext_start): Likewise.
(gpgme_op_keylist_next): Likewise.
(gpgme_op_keylist_end): Likewise.
* data-compat.c (gpgme_error_to_errno): Don't convert EBUSY.
2003-02-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError,
and add argument for returning the result string.
(gpgme_cancel): Remove prototype.
* gpgme.c (gpgme_cancel): Remove function.
* context.h (struct gpgme_context_s): Remove member cancel.
* passphrase.c (_gpgme_passphrase_command_handler): Call the
passphrase callback in the new way.
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* edit.c (_gpgme_edit_status_handler): Call the progress status
handler.
2003-02-05 Marcus Brinkmann <marcus@g10code.de>
* wait-user.c (_gpgme_wait_user_remove_io_cb): Move check for no
I/O handlers left to ...
(_gpgme_user_io_cb_handler): ... here.
2003-02-04 Marcus Brinkmann <marcus@g10code.de>
* trustlist.c (trustlist_colon_handler): Release ITEM if name
could not be allocated.
(gpgme_trust_item_release): Only release name if it is allocated.
Reported by Marc Mutz <Marc.Mutz@uni-bielefeld.de>.
2003-02-04 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (read_status): If he status handler returns an error,
return it.
(status_handler): If read_status fails, just return the error.
2003-02-01 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (start): Handle all errors, not only most of
them.
(xtoi_1, xtoi_2): Remove macro.
(status_handler): Replace use of xtoi_2 with _gpgme_hextobyte.
2003-02-01 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (map_assuan_error): Replace
ASSUAN_Bad_Certificate_Path with ASSUAN_Bad_Certificate_Chain.
(gpgsm_new): Use assuan_pipe_connect instead assuan_pipe_connect2.
* util.h (DIMof): Remove macro.
* ops.h (_gpgme_op_event_cb, _gpgme_op_event_cb_user,
_gpgme_data_unread): Prototypes removed.
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* types.h: File removed.
* Makefile.am (libgpgme_la_SOURCES): Remove types.h.
* io.h (struct spawn_fd_item_s): Do not include "types.h".
* key.h: Likewise.
* context.h: Likewise.
* cengine-gpgsm.h: Likewise.
* engine.h: Include "gpgme.h" instead "types.h". Add prototypes
for EngineStatusHandler, EngineColonLineHandler and
EngineCommandHandler.
(_gpgme_engine_set_status_handler): Change parameter type from
GpgmeStatusHandler to EngineStatusHandler.
(_gpgme_engine_set_command_handler): Change parameter type from
GpgmeCommandHandler to EngineCommandHandler.
(_gpgme_engine_set_colon_line_handler): Change parameter type from
GpgmeColonLineHandler to EngineColonLineHandler.
* engine-backend.h: Include "engine.h" instead "types.h".
(struct engine_ops): Change Gpgme*Handler parameters in members
set_command_handler, set_colon_line_handler and set_status_handler
to Engine*Handler.
* engine.c (_gpgme_engine_set_status_handler): Change parameter
type from GpgmeStatusHandler to EngineStatusHandler.
(_gpgme_engine_set_command_handler): Change parameter type from
GpgmeCommandHandler to EngineCommandHandler.
(_gpgme_engine_set_colon_line_handler): Change parameter type from
GpgmeColonLineHandler to EngineColonLineHandler.
* rungpg.c (struct gpg_object_s): Change type of member status.fnc
from GpgmeStatusHandler to EngineStatusHandler. Change type of
member colon.fnc from GpgmeColonLineHandler to
EngineColonLineHandler. Change type of member cmd.fnc from
GpgmeCommandHandler to EngineCommandHandler.
* engine-gpgsm.c (struct gpgsm_object_s): Likewise.
* rungpg.c (gpg_set_status_handler): Change parameter type from
GpgmeStatusHandler to EngineStatusHandler.
* engine-gpgsm.c (gpgsm_set_status_handler): Likewise.
(assuan_simple_command): Likewise.
* rungpg.c (gpg_set_colon_line_handler): Change parameter type
from GpgmeColonLineHandler to EngineColonLineHandler.
* engine-gpgsm.c (gpgsm_set_colon_line_handler): Likewise.
* rungpg.c (gpg_set_command_handler): Change parameter type from
GpgmeCommandHandler to EngineCommandHandler.
* engine-gpgsm.c (status_handler): Do not close status fd at end
of function.
* ops.h (_gpgme_op_data_lookup): Add prototype.
* op-support.c: Include <stdlib.h>.
(_gpgme_op_data_lookup): New function.
* decrypt.c (_gpgme_release_decrypt_result): Function removed.
(struct decrypt_result_s): Rename to ...
(struct decrypt_resul): ... this.
(DecryptResult): New type.
(_gpgme_decrypt_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
* sign.c (_gpgme_release_sign_result): Function removed.
(release_sign_result): New function.
(struct sign_result_s): Rename to ...
(struct sign_result): ... this.
(SignResult): New type.
(_gpgme_sign_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
* encrypt.c (struct encrypt_result_s): Rename to ...
(struct encrypt_result): ... this.
(_gpgme_release_encrypt_result): Function removed.
(release_encrypt_result): New function.
(_gpgme_encrypt_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
* verify.c (struct verify_result_s): Rename to ...
(struct verify_result): ... this. Remove member next.
(VerifyResult): New type.
(_gpgme_release_verify_result): Function removed.
(release_verify_result): New function.
(finish_sig): Change first argument to type VerifyResult. Diddle
the type of the op_data structure.
(add_notation): Change first argument to type VerifyResult.
(_gpgme_verify_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
* passphrase.c (struct passphrase_result_s): Rename to ...
(struct passphrase_result): ... this. Remove member next.
(PassphraseResult): New type.
(_gpgme_release_passphrase_result): Function removed.
(release_passphrase_result): New function.
(_gpgme_passphrase_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
(_gpgme_passphrase_command_handler): Likewise.
* keylist.c (struct keylist_result_s): Rename to ...
(struct keylist_result): ... this. Remove member next.
(KeylistResult): New type.
(_gpgme_release_keylist_result): Function removed.
(release_keylist_result): New function.
(keylist_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
* edit.c (struct edit_result_s): Rename to ...
(struct edit_result): ... this. Remove member next.
(EditResult): New type.
(_gpgme_release_edit_result): Function removed.
(release_edit_result): New function.
(edit_status_handler): Don't use
test_and_allocate_result, but use _gpgme_op_data_lookup to
retrieve result data object.
(command_handler): Likewise.
* types.h (DecryptResult, SignResult, EncryptResult,
PassphraseResult, ImportResult, DeleteResult, GenKeyResult,
KeylistResult, EditResult): Types removed.
* ops.h: Don't include "types.h", but "gpgme.h" and "context.h".
(test_and_allocate_result): Remove macro.
(_gpgme_release_decrypt_result): Remove prototype.
(_gpgme_decrypt_result): Remove prototype.
(_gpgme_release_sign_result): Remove prototype.
(_gpgme_release_encrypt_result): Remove prototype.
(_gpgme_release_passphrase_result): Remove prototype.
(_gpgme_release_import_result): Remove prototype.
(_gpgme_release_delete_result): Remove prototype.
(_gpgme_release_genkey_result): Remove prototype.
(_gpgme_release_keylist_result): Remove prototype.
(_gpgme_release_edit_result): Remove prototype.
(_gpgme_release_verify_result): Remove prototype.
* gpgme.c (_gpgme_release_result): Rewritten.
* context.h (enum ctx_op_data_type): New enum.
(struct ctx_op_data): New structure.
(struct gpgme_context_s): Replace the member result with a member
op_data.
(fail_on_pending_request): Remove macro.
* op-support.c (_gpgme_op_reset): Expand macro
fail_on_pending_request.
* util.h: Don't include "types.h" or "debug.h", but include "gpgme.h".
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* types.h (EngineObject): Move typedef to ...
* engine.h: ... here.
* types.h (GpgObject): Move typedef to ...
* rungpg.c: ... here.
* types.h (GpgsmObject): Move typedef to ...
* engine-gpgsm.c: ... here.
* util.h (return_if_fail, return_null_if_fail,
return_val_if_fail): Remove macro.
* gpgme.c (gpgme_cancel): Don't use return_if_fail.
* key.c (gpgme_key_ref): Likewise.
* signers.c (gpgme_signers_enum): Likewise.
(gpgme_signers_clear): Likewise.
* engine-backend.h (struct engine_ops): Rename get_path to
get_file_name.
* gpgme.h (struct _gpgme_engine_info): Rename member path to
file_name.
* version.c: Do not include <stdio.h>, <stdlib.h>, context.h and
util.h. Other clean ups.
(parse_version_number): Protect more seriously against
overflow.
(gpgme_get_engine_info): Move to ...
* engine.c (gpgme_get_engine_info): ... here.
(_gpgme_engine_get_info): Function removed.
(_gpgme_engine_get_path): Make static and rename to ...
(engine_get_file_name): .. this.
(_gpgme_engine_get_version): Make static and rename to ...
(engine_get_version): ... this.
(_gpgme_engine_get_req_version): Make static and rename to ...
(engine_get_req_version): ... this.
* engine.h (_gpgme_engine_get_path, _gpgme_engine_get_version,
_gpgme_engine_req_version, _gpgme_engine_get_info.): Remove
prototypes.
* 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.
* util.h (_gpgme_hextobyte): Change prototype to unsigned char
instead byte.
* conversion.c (_gpgme_hextobyte): Change argument to unsigned
char instead byte.
(_gpgme_decode_c_string): Likewise, and beautify. Also support a
few more escaped characters. Be more strict about buffer size.
(_gpgme_data_append_percentstring_for_xml): Change type of SRC,
BUF and DST to unsigned char instead byte.
* progress.c (_gpgme_progress_status_handler): Use unsigned char
instead byte.
* debug.c (trim_spaces): Likewise.
* util.h (mk_error): Remove macro.
* conversion.c, data.c, data-compat.c, decrypt.c, delete.c,
edit.c, encrypt.c, encrypt-sign.c, engine.c, engine-gpgsm.c,
export.c, genkey.c, gpgme.c, import.c, key.c, keylist.c,
passphrase.c, progress.c, recipient.c, rungpg.c, sign.c,
signers.c, trustlist.c, verify.c, wait.c, wait-global.c,
wait-private (literally everywhere): Expand the mk_error macro.
* context.h (wait_on_request_or_fail): Remove macro.
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
* key.c (gpgme_key_sig_get_string_attr): Use validity_to_string
instead otrust_to_string to calculate validity.
2003-01-19 Miguel Coca <mcoca@gnu.org>
* w32-io.c (_gpgme_io_select): Add missing argument in calls to
DEBUG_BEGIN.
* w32-util.c: Include "sema.h".
(find_program_in_registry): Change DEBUG1 to DEBUG2, fixes compilation
error.
2003-01-19 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_engine_ops_gpg): Remove gpg_start.
(gpg_start): Rename to ...
(start): ... this function. Change arguments to GpgObject.
(gpg_decrypt): Call start.
(gpg_edit): Likewise.
(gpg_encrypt): Likewise.
(gpg_encrypt_sign): Likewise.
(gpg_export): Likewise.
(gpg_import): Likewise.
(gpg_keylist): Likewise.
(gpg_keylist_ext): Likewise.
(gpg_trustlist): Likewise.
(gpg_verify): Likewise.
* engine-gpgsm.c (_gpgme_engine_ops_encrypt): Remove gpgsm_start.
(gpgsm_start): Rename to ...
(struct gpgsm_object_s): Remove member command.
(gpgsm_release): Don't free command.
(start): ... this function. Change arguments to GpgsmObject and
const char *.
(gpgsm_decrypt): Call start.
(gpgsm_delete): Likewise.
(gpgsm_encrypt): Likewise.
(gpgsm_export): Likewise.
(gpgsm_genkey): Likewise.
(gpgsm_import): Likewise.
(gpgsm_keylist): Likewise.
(gpgsm_keylist_ext): Likewise.
(gpgsm_verify): Likewise.
* decrypt.c (_gpgme_decrypt_start): Don't call
_gpgme_engine_start.
* delete.c (_gpgme_op_delete_start): Likewise.
* edit.c (_gpgme_op_edit_start): Likewise.
* encrypt.c (_gpgme_op_encrypt_start):
* encrypt-sign.c (_gpgme_op_encrypt_sign_start):
* export.c (_gpgme_op_export_start): Likewise.
* genkey.c (_gpgme_op_genkey_start): Likewise.
* import.c (_gpgme_op_import_start): Likewise.
* keylist.c (gpgme_op_keylist_ext_start): Likewise.
(gpgme_op_keylist_start): Likewise.
* sign.c (_gpgme_op_sign_start): Likewise.
* trustlist.c (gpgme_op_trustlist_start): Likewise.
* verify.c (_gpgme_op_verify_start): Likewise.
* engine-backend.h (struct engine_ops): Remove member start.
* engine.h (_gpgme_engine_start): Remove prototype.
* engine.c (_gpgme_engine_start): Remove function.
2003-01-06 Werner Koch <wk@gnupg.org>
* keylist.c (set_mainkey_capability): Handle 'd' and 'D' used
since gpg 1.3 to denote disabled keys.
2003-01-06 Marcus Brinkmann <marcus@g10code.de>
* data-mem.c: Include <string.h>.
* engine.c: Likewise.
2003-01-06 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_la_DEPENDENCIES): Correct bug in last change.
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_op_verify, gpgme_op_decrypt_verify): Drop R_STAT
argument.
* decrypt-verify.c (gpgme_op_decrypt_verify): Drop R_STAT
argument.
* verify.c (gpgme_op_verify): Drop R_STAT argument.
(_gpgme_intersect_stati): Function removed.
* ops.h (_gpgme_intersect_stati): Remove prototype.
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
* libgpgme.vers: New file.
* Makefile.am (EXTRA_DIST): Add libgpgme.vers.
(libgpgme_version_script_cmd): New variable.
(libgpgme_la_LDFLAGS): Add libgpgme_version_script_cmd here.
(libgpgme_la_DEPENDENCIES): New variable.
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* key.c (gpgme_key_get_string_attr): Don't accept GPGME_ATTR_IS_SECRET.
(otrust_to_string): New function.
(gpgme_key_get_as_xml): Use it.
(validity_to_string): New function.
(gpgme_key_get_string_attr): Beautify using above functions.
(gpgme_key_get_ulong_attr): Likewise.
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* data-mem.c (mem_release): Fix gcc warning.
* data-user.c (user_release): Likewise.
2002-12-06 Marcus Brinkmann <marcus@g10code.de>
* data.h (gpgme_data_release_cb): Change return type to void.
(gpgme_data_read_cb): Change return type to ssize_t.
* data.c (gpgme_data_read): Likewise.
* data-stream.c (stream_read): Likewise.
* data-fd.c (fd_read): Likewise.
* data-mem.c (mem_read): Likewise.
(mem_release): Change return type to void.
* data-user.c (user_read): Change return type to ssize_t.
(user_release): Change return type to void.
* data-compat.c (old_user_read): Change return type to ssize_t.
* gpgme.h (GpgmeDataReadCb): Likewise.
(gpgme_data_read): Likewise.
(GpgmeDataSeekCb): Change return type to off_t.
2002-12-04 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Add prototype for gpgme_get_key.
* key.c (gpgme_get_key): New function.
* verify.c (gpgme_get_sig_key): Rewrite using gpgme_get_key.
* gpgme.h: Add prototypes for new interfaces
gpgme_key_sig_get_string_attr and gpgme_key_get_ulong_attr.
(enum GpgmeAttr): New attribute GPGME_ATTR_SIG_CLASS.
* gpgme.c (gpgme_set_keylist_mode): Allow GPGME_KEYLIST_MODE_SIGS.
* key.h (struct certsig_s): New members ALGO, NAME_PART,
EMAIL_PART, COMMENT_PART, NAME, SIG_STAT and SIG_CLASS.
* conversion.c (_gpgme_decode_c_string): Add new parameter LEN.
Use that to determine if allocation is desired or not.
* util.h: Adjust prototype of _gpgme_decode_c_string.
* keylist.c (keylist_colon_handler): Adjust caller of
_gpgme_decode_c_string.
* key.h (struct gpgme_key_s): New member last_uid.
* key.c (_gpgme_key_append_name): Rewritten using
_gpgme_decode_c_string and the last_uid pointer.
(my_isdigit): Macro removed.
(ALLOC_CHUNK): Likewise.
* keylist.c (set_userid_flags): Use last_uid member of KEY.
* context.h (struct user_id_s): New member last_certsig.
* key.h: Add prototype for _gpgme_key_add_certsig.
* key.c (_gpgme_key_add_certsig): New function.
(set_user_id_part): Move function before _gpgme_key_add_certsig.
(parse_user_id): Change first argument to SRC, add new arguments
NAME, EMAIL and COMMENT. Change code to use these arguments
instead going through UID. Move function before
_gpgme_add_certsig.
(parse_x509_user_id): Likewise.
(_gpgme_key_append_name): Adjust arguments to parse_x509_user_id
and parse_user_id invocation.
(one_certsig_as_xml): New function.
(one_uid_as_xml): Print signatures.
* context.h (struct gpgme_context_s): New member TMP_UID.
* keylist.c (keylist_colon_handler): Rewritten, implement "sig"
record entries.
* key.c (get_certsig): New function.
(gpgme_key_sig_get_string_attr): Likewise.
(gpgme_key_sig_get_ulong_attr): Likewise.
* keylist.c: Include <ctype.h>.
(my_isdigit): Macro removed.
(set_mainkey_trust_info): Use isdigit, not my_isdigit.
(set_userid_flags): Likewise.
(set_subkey_trust_info): Likewise.
(set_ownertrust): Likewise.
(finish_key): Move function up a bit and remove prototype.
* rungpg.c (gpg_keylist_ext): Correct precedence of signature
listing mode.
(gpg_keylist_ext): Implement signature listing mode.
2002-11-25 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_spawn): Do not set parent fds to -1.
* posix-io.c (_gpgme_io_spawn): Call _gpgme_io_close instead close
for parent fds.
* w32-io.c (_gpgme_io_spawn): Call _gpgme_io_close instead
CloseHandle for parent fds.
2002-11-22 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h [_MSC_VER]: Define ssize_t as long.
2002-11-22 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_new): Save the result of a first
setlocale before doing another setlocale.
2002-11-21 Marcus Brinkmann <marcus@g10code.de>
* decrypt.c: Some beautyfication.
* verify.c (_gpgme_verify_status_handler): Treat
GPGME_STATUS_UNEXPECTED like GPGME_STATUS_NODATA.
Reported by Miguel Coca <e970095@zipi.fi.upm.es>.
2002-11-19 Marcus Brinkmann <marcus@g10code.de>
* genkey.c: Only include <config.h> if [HAVE_CONFIG_H].
(struct genkey_result_s): Add new member FPR.
(_gpgme_release_genkey_result): Free RESULT->fpr if set.
(genkey_status_handler): Extract the fingerprint from the status
line.
(gpgme_op_genkey): Add new argument FPR and return the fingerprint
in it.
* gpgme.h: Adjust prototype of gpgme_op_genkey.
2002-11-19 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_keylist): Add --with-fingerprint to gpg invocation
twice, to get fingerprints on subkeys. Suggested by Timo Schulz
<twoaday@freakmail.de>.
(gpg_keylist_ext): Likewise.
2002-11-05 Marcus Brinkmann <marcus@g10code.de>
* import.c (append_xml_impinfo): Use
_gpgme_data_append_string_for_xml rather than
_gpgme_data_append_string for the field content.
Submitted by Miguel Coca <e970095@zipi.fi.upm.es>.
2002-10-10 Marcus Brinkmann <marcus@g10code.de>
* rungpg.h, engine-gpgsm.h: File removed.
* engine-backend.h: New file.
* Makefile.am (gpgsm_components): New variable, set depending on
automake conditional HAVE_GPGSM.
(libgpgme_la_SOURCES): Add engine-backend.h, remove rungpg.h and
engine-gpgsm.h. Replace engine-gpgsm.c with ${gpgsm_components}.
(status-table.h): Depend on gpgme.h, not rungpg.h.
* conversion.c: Include <stdlib.h>.
* engine-gpgsm.c: Do not set ENABLE_GPGSM here. Include
"engine-backend.h" instead "engine-gpgsm.h". Reorder some
functions and remove all function prototypes.
(_gpgme_gpgsm_get_version): Make static and rename to ...
(gpgsm_get_version): ... this.
(_gpgme_gpgsm_check_version): Make static and rename to ...
(gpgsm_check_version): ... this.
(_gpgme_gpgsm_new): Make static. Change argument type from
GpgsmObject * to void **. Call gpgsm_release instead
_gpgme_gpgsm_release.
(_gpgme_gpgsm_op_decrypt): Make static and rename to ...
(gpgsm_check_decrypt): ... this.
(_gpgme_gpgsm_op_delete): Make static and rename to ...
(gpgsm_check_delete): ... this.
(_gpgme_gpgsm_set_recipients): Make static and rename to ...
(gpgsm_check_set_recipients): ... this.
(_gpgme_gpgsm_op_encrypt): Make static and rename to ...
(gpgsm_encrypt): ... this.
(_gpgme_gpgsm_op_export): Make static and rename to ...
(gpgsm_export): ... this.
(_gpgme_gpgsm_op_genkey): Make static and rename to ...
(gpgsm_genkey): ... this.
(_gpgme_gpgsm_op_import): Make static and rename to ...
(gpgsm_import): ... this.
(_gpgme_gpgsm_op_keylist): Make static and rename to ...
(gpgsm_keylist): ... this.
(_gpgme_gpgsm_op_keylist_ext): Make static and rename to ...
(gpgsm_keylist_ext): ... this.
(_gpgme_gpgsm_op_sign): Make static and rename to ...
(gpgsm_sign): ... this.
(_gpgme_gpgsm_op_trustlist): Make static and rename to ...
(gpgsm_trustlist): ... this.
(_gpgme_gpgsm_op_verify): Make static and rename to ...
(gpgsm_verify): ... this.
(gpgsm_status_handler): Rename to ...
(status_handler): ... this.
(_gpgme_gpgsm_set_status_handler): Make static and rename to ...
(gpgsm_set_status_handler): ... this.
(_gpgme_gpgsm_set_colon_line_handler): Make static and rename to ...
(gpgsm_set_colon_line_handler): ... this.
(_gpgme_gpgsm_add_io_cb): Rename to ...
(add_io_cb): ... this.
(_gpgme_gpgsm_start): Make static and rename to ...
(gpgsm_start): ... this.
(_gpgme_gpgsm_set_io_cb): Make static and rename to ...
(gpgsm_set_io_cb): ... this.
(_gpgme_gpgsm_io_event): Make static and rename to ...
(gpgsm_io_event): ... this.
(struct _gpgme_engine_ops_gpgsm): New variable.
[!ENABLE_GPGSM]: Removed.
* engine.c: Do not include <time.h>, <sys/types.h>, <string.h>,
<assert.h>, "io.h", "rungpg.h" and "engine-gpgsm.h". Include
<stdlib.h> and "engine-backend.h".
(struct engine_object_s): Rewritten.
(engine_ops): New variable.
* engine.c (_gpgme_engine_get_path, _gpgme_engine_get_version,
_gpgme_engine_check_version, _gpgme_engine_new,
_gpgme_engine_release, _gpgme_engine_set_verbosity,
_gpgme_engine_set_status_handler,
_gpgme_engine_set_command_handler,
_gpgme_engine_set_colon_line_handler, _gpgme_engine_op_decrypt,
_gpgme_engine_op_delete, _gpgme_engine_op_edit,
_gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign,
_gpgme_engine_op_export, _gpgme_engine_op_genkey,
_gpgme_engine_op_import, _gpgme_engine_op_keylist,
_gpgme_engine_op_keylist_ext, _gpgme_engine_op_sign,
_gpgme_engine_op_trustlist, _gpgme_engine_op_verify,
_gpgme_engine_start, _gpgme_engine_set_io_cbs,
_gpgme_engine_io_event): Reimplement.
* engine.h: Fix a few comments and a variable name in a prototype.
* ops.h: Do not include "rungpg.h".
* passphrase.c: Include config.h only if [HAVE_CONFIG_H]. Do not
include "rungpg.h".
* recipient.c: Likewise.
* signers.c: Likewise.
* version.c: Likewise.
* rungpg.c: Likewise. Include "engine-backend.h". Reorder
functions and remove prototypes.
(_gpgme_gpg_get_version): Make static and rename to ...
(gpg_get_version): ... this.
(_gpgme_gpg_check_version): Make static and rename to ...
(gpg_check_version): ... this.
(_gpgme_gpg_new): Make static. Change argument type from
GpgObject * to void **. Call gpg_release instead
_gpgme_gpg_release.
(_gpgme_gpg_op_decrypt): Make static and rename to ...
(gpg_check_decrypt): ... this.
(_gpgme_gpg_op_delete): Make static and rename to ...
(gpg_check_delete): ... this.
(_gpgme_gpg_set_recipients): Make static and rename to ...
(gpg_check_set_recipients): ... this.
(_gpgme_gpg_op_encrypt): Make static and rename to ...
(gpg_encrypt): ... this.
(_gpgme_gpg_op_export): Make static and rename to ...
(gpg_export): ... this.
(_gpgme_gpg_op_genkey): Make static and rename to ...
(gpg_genkey): ... this.
(_gpgme_gpg_op_import): Make static and rename to ...
(gpg_import): ... this.
(_gpgme_gpg_op_keylist): Make static and rename to ...
(gpg_keylist): ... this.
(_gpgme_gpg_op_keylist_ext): Make static and rename to ...
(gpg_keylist_ext): ... this.
(_gpgme_gpg_op_sign): Make static and rename to ...
(gpg_sign): ... this.
(_gpgme_gpg_op_trustlist): Make static and rename to ...
(gpg_trustlist): ... this.
(_gpgme_gpg_op_verify): Make static and rename to ...
(gpg_verify): ... this.
(gpg_status_handler): Rename to ...
(status_handler): ... this.
(_gpgme_gpg_set_status_handler): Make static and rename to ...
(gpg_set_status_handler): ... this.
(_gpgme_gpg_set_colon_line_handler): Make static and rename to ...
(gpg_set_colon_line_handler): ... this.
(gpgme_gpg_add_io_cb): Rename to ...
(add_io_cb): ... this.
(_gpgme_gpg_start): Make static and rename to ...
(gpg_start): ... this.
(_gpgme_gpg_set_io_cb): Make static and rename to ...
(gpg_set_io_cb): ... this.
(_gpgme_gpg_io_event): Make static and rename to ...
(gpg_io_event): ... this.
(struct _gpgme_engine_ops_gpg): New variable.
2002-10-10 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_verify) [!ENABLE_GPGSM]: Add
missing argument.
2002-10-09 Marcus Brinkmann <marcus@g10code.de>
* data.h, data-user.c, data-stream.c, data-mem.c, data-fd.c,
data-compat.c: New file. Really check them in this time, completes
2002-10-08 change.
* rungpg.h (GpgStatusHandler): Rename type to GpgmeStatusHandler
and move to ...
* types.h (GpgmeStatusHandler): ... here.
* rungpg.h (GpgColonLineHandler): Rename type to GpgmeColonLineHandler.
and move to ...
* types.h (GpgmeColonLineHandler): ... here.
* rungpg.h (GpgCommandHandler): Rename type to GpgmeCommandHandler.
and move to ...
* types.h (GpgmeCommandHandler): ... here.
* engine.h: Don't include "rungpg.h".
(_gpgme_engine_set_status_handler): Change type of
argument from GpgStatusHandler to GpgmeStatusHandler.
(_gpgme_engine_set_colon_line_handler): Change type of
argument from GpgColonLineHandler to GpgmeColonLineHandler.
(_gpgme_engine_set_command_handler): Change type of
argument from GpgCommandHandler to GpgmeCommandHandler.
* engine-gpgsm.h: Don't include "rungpg.h".
(_gpgme_gpgsm_set_status_handler): Change type of
argument from GpgStatusHandler to GpgmeStatusHandler.
(_gpgme_gpgsm_set_colon_line_handler): Change type of
argument from GpgColonLineHandler to GpgmeColonLineHandler.
* engine-gpgsm.c: Do not include "rungpg.h".
(struct gpgsm_object_s): Change type of
status.fnc to GpgmeStatusHandler. Change type of colon.fnc to
GpgmeColonLineHandler.
(gpgsm_assuan_simple_command): Change type of argument from
GpgStatusHandler to GpgmeStatusHandler.
(_gpgme_gpgsm_set_status_handler): Likewise.
(_gpgme_gpgsm_set_colon_line_handler): Change type of argument from
GpgColonLineHandler to GpgmeColonLineHandler.
* rungpg.h (_gpgme_gpg_set_status_handler): Change type of
argument from GpgStatusHandler to GpgmeStatusHandler.
(_gpgme_gpg_set_colon_line_handler): Change type of
argument from GpgColonLineHandler to GpgmeColonLineHandler.
(_gpgme_gpg_set_command_handler): Change type of
argument from GpgCommandHandler to GpgmeCommandHandler.
* rungpg.c (struct gpg_object_s): Change type of status.fnc to
GpgmeStatusHandler. Change type of colon.fnc to
GpgmeColonLineHandler. Change type of cmd.fnc to
GpgmeCommandLineHandler.
(_gpgme_gpg_set_status_handler): Change type of argument FNC to
GpgmeStatusHandler.
(_gpgme_gpg_set_colon_line_handler): Change type of argument FNC
to GpgmeColonLineHandler.
(_gpgme_gpg_set_command_handler): Change type of argument FNC to
GpgmeCommandHandler.
* engine.c (_gpgme_engine_set_status_handler): Change type of
argument FNC to GpgmeStatusHandler.
(_gpgme_engine_set_colon_line_handler): Change type of argument FNC
to GpgmeColonLineHandler.
(_gpgme_engine_set_command_handler): Change type of argument FNC to
GpgmeCommandHandler.
* rungpg.h (_gpgme_gpg_enable_pipemode): Remove prototype.
* rungpg.c (struct gpg_object_s): Remove PM.
(pipemode_cb): Prototype removed.
(add_pm_data): Function removed.
(_gpgme_gpg_enable_pipemode): Likewise.
(pipemode_copy): Likewise.
(pipemode_cb): Likewise.
(add_arg): Don't check for pipemode.
(add_data): Likewise.
(_gpgme_gpg_set_status_handler): Likewise.
(_gpgme_gpg_set_colon_line_handler): Likewise.
(_gpgme_gpg_set_command_handler): Likewise.
(_gpgme_gpg_spawn): Likewise.
(_gpgme_gpg_spawn): Don't set PM.active.
(_gpgme_gpg_op_verify): Remove pipemode case.
* verify.c (_gpgme_op_verify_start): Remove pipemode case.
* rungpg.h (_gpgme_gpg_add_arg, _gpgme_gpg_add_data,
_gpgme_gpg_add_pm_data, _gpgme_gpg_housecleaning,
_gpgme_gpg_set_simple_line_handler): Prototype removed.
(_gpgme_gpg_set_verbosity): New prototype.
* rungpg.c (_gpgme_gpg_add_data): Make static and rename to ...
(add_data): ... this.
(_gpgme_gpg_add_pm_data): Call add_data, not _gpgme_gpg_add_data.
(_gpgme_gpg_set_command_handler): Likewise.
(_gpgme_gpg_op_decrypt, _gpgme_gpg_op_edit, _gpgme_gpg_op_encrypt,
_gpgme_gpg_op_encrypt_sign, _gpgme_gpg_op_export,
_gpgme_gpg_op_genkey, _gpgme_gpg_op_import, _gpgme_gpg_op_sign,
_gpgme_gpg_op_verify): Likewise.
(_gpgme_gpg_add_pm_data): Rename to ...
(add_pm_data): ... this.
(_gpgme_gpg_op_verify): Call add_pm_data, not
_gpgme_gpg_add_pm_data.
(_gpgme_gpg_add_arg): Make static and rename to ...
(add_arg): ... this.
(_gpgme_gpg_set_command_handler, _gpgme_gpg_new,
_gpgme_gpg_op_decrypt, _gpgme_gpg_op_delete,
_gpgme_append_gpg_args_from_signers, _gpgme_gpg_op_edit,
_gpgme_append_gpg_args_from_recipients, _gpgme_gpg_op_encrypt,
_gpgme_gpg_op_encrypt_sign, _gpgme_gpg_op_export,
_gpgme_gpg_op_genkey, _gpgme_gpg_op_import, _gpgme_gpg_op_keylist,
_gpgme_gpg_op_keylist_ext, _gpgme_gpg_op_trustlist,
_gpgme_gpg_op_sign, _gpgme_gpg_op_verify): Use add_arg, not
_gpgme_gpg_add_arg.
(_gpgme_gpg_set_verbosity): New function.
(struct gpg_object_s): Remove member simple from colon.
(_gpgme_gpg_set_colon_line_handler): Don't initialize simple.
(_gpgme_gpg_set_simple_line_handler): Removed function.
(read_colon_line): Don't check the GPG->colon.simple.
* engine.c (_gpgme_engine_set_verbosity): Call
_gpgme_gpg_set_verbosity instead _gpgme_gpg_add_arg.
2002-10-08 Marcus Brinkmann <marcus@g10code.de>
* util.h (_gpgme_malloc, _gpgme_realloc, _gpgme_calloc,
_gpgme_strdup, _gpgme_free): Remove prototypes.
(xtrymalloc, xtrycalloc, xtryrealloc, xtrystrdup, xfree): Remove
macros.
* util.c: File removed.
* Makefile.am (libgpgme_la_SOURCES): Remove util.h.
* conversion.c (_gpgme_decode_c_string): Use malloc instead of
xtrymalloc, realloc instead of xtryrealloc, calloc instead of
xtrycalloc, free instead of xfree.
(_gpgme_data_append_percentstring_for_xml): Likewise.
* data.c (_gpgme_data_new, _gpgme_data_release): Likewise.
* data-compat.c (gpgme_data_new_from_filepart): Likewise.
* data-mem.c (mem_write, mem_release, gpgme_data_new_from_mem,
_gpgme_data_get_as_string): Likewise.
* debug.c (debug_init): Likewise.
* decrypt.c (_gpgme_release_decrypt_result): Likewise.
* delete.c (_gpgme_release_delete_result): Likewise.
* edit.c (_gpgme_release_edit_result, _gpgme_op_edit_start):
Likewise.
* encrypt.c (_gpgme_release_encrypt_result): Likewise.
* engine.c (_gpgme_engine_get_info, _gpgme_engine_new,
_gpgme_engine_release): Likewise.
* engine-gpgsm.c (_gpgme_gpgsm_new, _gpgme_gpgsm_release,
_gpgme_gpgsm_op_decrypt, _gpgme_gpgsm_op_delete,
gpgsm_set_recipients, _gpgme_gpgsm_op_encrypt,
_gpgme_gpgsm_op_export, _gpgme_gpgsm_op_genkey,
_gpgme_gpgsm_op_import, _gpgme_gpgsm_op_keylist,
_gpgme_gpgsm_op_keylist_ext, _gpgme_gpgsm_op_sign,
_gpgme_gpgsm_op_verify, gpgsm_status_handler): Likewise.
* genkey.c (_gpgme_release_genkey_result): Likewise.
* gpgme.c (gpgme_new, gpgme_release): Likewise.
* import.c (_gpgme_release_import_result): Likewise.
* key.c (_gpgme_key_cache_init, _gpgme_key_cache_add, key_new,
add_subkey, gpgme_key_release, _gpgme_key_append_name): Likewise.
* keylist.c (_gpgme_release_keylist_result, keylist_colon_handler,
_gpgme_op_keylist_event_cb, gpgme_op_keylist_next): Likewise.
* ops.h (test_and_allocate_result): Likewise.
* passphrase.c (_gpgme_release_passphrase_result,
_gpgme_passphrase_status_handler,
_gpgme_passphrase_command_handler): Likewise.
* progress.c (_gpgme_progress_status_handler): Likewise.
* recipient.c (gpgme_recipients_new, gpgme_recipients_release,
gpgme_recipients_add_name_with_validity): Likewise.
* rungpg.c (_gpgme_gpg_new, _gpgme_gpg_release,
_gpgme_gpg_add_arg, _gpgme_gpg_add_data,
_gpgme_gpg_set_colon_line_handler, free_argv, free_fd_data_map,
build_argv, _gpgme_gpg_spawn, read_status, read_colon_line):
Likewise.
* sign.c (_gpgme_release_sign_result): Likewise.
* signers.c (_gpgme_signers_add): Likewise.
* trustlist.c (trust_item_new, trustlist_colon_handler,
_gpgme_op_trustlist_event_cb, gpgme_op_trustlist_next,
gpgme_trustitem_release): Likewise.
* verify.c (_gpgme_release_verify_result, finish_sig): Likewise.
* version.c (gpgme_get_engine_info, _gpgme_get_program_version):
Likewise.
* w32-io.c (create_reader, create_writer, destroy_reader,
destroy_writer, build_commandline, _gpgme_io_spawn): Likewise.
* w32-sema.c (critsect_init, _gpgme_sema_cs_destroy): Likewise.
* w32-util.c (read_w32_registry_string): Likewise.
* wait.c (_gpgme_fd_table_deinit, _gpgme_fd_table_put,
_gpgme_wait_event_cb, _gpgme_add_io_cb, _gpgme_remove_io_cb)
* data-compat.c: Include <stdlib.h>.
2002-10-08 Marcus Brinkmann <marcus@g10code.de>
New data object component:
* gpgme.h (GpgmeDataReadCb, GpgmeDataWriteCb, GpgmeDataSeekCb,
GpgmeDataReleaseCb): New types.
(struct GpgmeDataCbs): New structure.
(gpgme_data_read): Changed prototype to match that of read() closely.
(gpgme_data_write): Similar for write().
(gpgme_data_seek, gpgme_data_new_from_cbs, gpgme_data_new_from_fd,
gpgme_data_new_from_stream): New prototypes.
(gpgme_data_get_type, gpgme_check_engine): Prototype removed.
* Makefile.am (libgpgme_la_SOURCES): Add data.h, data-fd.c,
data-stream.c, data-mem.c, data-user.c and data-compat.c.
* data.c: Reimplemented from scratch.
* (data-compat.c, data-fd.c, data.h, data-mem.c, data-stream.c,
data-user.c): New file.
* context.h (struct gpgme_data_s): Removed.
* conversion.c: Include <errno.h> and <sys/types.h>.
(_gpgme_data_append): New function.
* data.c (_gpgme_data_append_string): Move to ...
* conversion.c (_gpgme_data_append_string): ... here.
* data.c (_gpgme_data_append_for_xml): Move to ...
* conversion.c (_gpgme_data_append_for_xml): ... here.
* data.c (_gpgme_data_append_string_for_xml): Move to ...
* conversion.c (_gpgme_data_append_string_for_xml): ... here.
* data.c (_gpgme_data_append_percentstring_for_xml): Move to ...
* conversion.c (_gpgme_data_append_percentstring_for_xml): ... here.
* ops.h (_gpgme_data_get_mode, _gpgme_data_set_mode): Prototype
removed.
* types.h (GpgmeDataMode): Type removed.
* decrypt.c (_gpgme_decrypt_start): Don't check data type or mode.
* edit.c (_gpgme_op_edit_start): Likewise.
* encrypt.c (_gpgme_op_encrypt_start): Likewise.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise.
* export.c (_gpgme_op_export_start): Likewise.
* genkey.c (_gpgme_op_genkey_start): Likewise.
* import.c (_gpgme_op_import_start): Likewise.
* sign.c (_gpgme_op_sign_start): Likewise.
* verify.c (_gpgme_op_verify_start): Likewise.
* encrypt.c (gpgme_op_encrypt): Remove hack that returns invalid
no recipient if no data was returned.
* encrypt-sign.c (gpgme_op_encrypt_sign): Remove hack that returns
no recipient if no data was returned.
* encrypt-sign.c (gpgme_op_encrypt_sign): Remove hack that returns
no recipient if no data was returned.
* engine.c (_gpgme_engine_op_verify): Add new argument to
differentiate detached from normal signatures.
* engine.h (_gpgme_engine_op_verify): Likewise for prototype.
* engine-gpgsm.c (_gpgme_gpgsm_op_verify): Likewise. Don't check
mode of data argument.
* engine-gpgsm.h (_gpgme_gpgsm_op_verify): Likewise for prototype.
* gpgme.h (gpgme_op_verify_start): Likewise for prototype.
(gpgme_op_verify): Likewise for prototype.
* rungpg.c (_gpgme_gpg_op_verify): Likewise.
* rungpg.h (_gpgme_gpg_op_verify): Likewise for prototype.
* verify.c (_gpgme_op_verify_start): Likewise.
(gpgme_op_verify_start): Likewise.
(gpgme_op_verify): Likewise.
* rungpg.c (struct arg_and_data_s): New member INBOUND to hold
direction of data object.
(_gpgme_gpg_add_data): Add new argument INBOUND. Use it to
determine direction of data object.
(_gpgme_gpg_add_pm_data, _gpgme_gpg_set_command_handler,
_gpgme_gpg_op_decrypt, _gpgme_gpg_op_edit, _gpgme_gpg_op_encrypt,
_gpgme_gpg_op_encrypt_sign, _gpgme_gpg_op_export,
_gpgme_gpg_op_genkey, _gpgme_gpg_op_import, _gpgme_gpg_op_sign,
_gpgme_gpg_op_verify): Add new argument to _gpgme_gpg_add_data
invocation.
(build_argv): Use new member INBOUND to determine direction of
file descriptor. Don't check the data type.
* rungpg.h (_gpgme_gpg_add_data): Add new argument to prototype.
* gpgme.c (gpgme_get_op_info): Don't call
_gpgme_data_get_as_string if CTX->op_info is NULL.
* version.c (gpgme_check_engine): Function removed.
2002-09-30 Werner Koch <wk@gnupg.org>
* keylist.c (keylist_colon_handler): Take care when printing a
NULL with the DEBUG.
* engine-gpgsm.c (struct gpgsm_object_s): New member ANY.
(gpgsm_status_handler): Run the colon function to indicate EOF.
(_gpgme_gpgsm_set_colon_line_handler): Better reset ANY here.
2002-09-28 Marcus Brinkmann <marcus@g10code.de>
* conversion.c (_gpgme_hextobyte): Prevent superfluous
multiplication with base. Reported by Stéphane Corthésy.
* keylist.c (gpgme_op_keylist_ext_start): Use private asynchronous
operation type in invocation of _gpgme_op_reset.
2002-09-20 Werner Koch <wk@gnupg.org>
* ath.c: Include sys/time.h if sys/select.h is not available.
2002-09-13 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (keylist_status_handler): Do not call finish_key() here.
(gpgme_op_keylist_ext_start): Set CTX->tmp_key to NULL.
2002-09-03 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (assuan_libobjs): Remove @LTLIBOBJS@ as we link them
into gpgme unconditionally.
(libgpgme_la_LIBADD): Change @LIBOBJS@ into @LTLIBOBJS@.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (assuan_libobjs): Use @LTLIBOBJS@ instead @LIBOBJS@.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
* debug.c (_gpgme_debug_add): Test *LINE, not LINE.
(_gpgme_debug_end): Likewise.
Reported by Dr. Stefan Dalibor <Dr.Stefan.Dalibor@bfa.de>.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
* posix-io.c (_gpgme_io_select): Don't use a non-constant struct
initializer.
* version.c (_gpgme_get_program_version): Likewise.
Reported by Dr. Stefan Dalibor <Dr.Stefan.Dalibor@bfa.de>.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
* conversion.c (_gpgme_decode_c_string): Set DESTP before
modifying DEST.
* conversion.c (_gpgme_decode_c_string): Fix off by one error in
last change.
* rungpg.c (_gpgme_append_gpg_args_from_signers): Move before
_gpgme_op_edit so its prototype is known early on.
* conversion.c: New file.
* util.h: Add prototypes for _gpgme_decode_c_string and
_gpgme_hextobyte.
* keylist.c (keylist_colon_handler): Call _gpgme_decode_c_string
on issuer name.
* Makefile.am (libgpgme_la_SOURCES): Add conversion.c
* key.c (_gpgme_key_append_name): Replace calls to hextobyte by
calls to _gpgme_hextobyte.
(hash_key): Likewise.
2002-09-01 Marcus Brinkmann <marcus@g10code.de>
* op-support.c (_gpgme_op_reset): Set CTX->pending after calling
_gpgme_engine_release, as this will reset pending to zero in the
event done callback on cancelled operations.
2002-08-30 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_op_edit): Add args from signers.
Suggested by Miguel Coca <e970095@zipi.fi.upm.es>.
* rungpg.c (_gpgme_gpg_op_edit): Add bogus ctx argument.
* rungpg.h: Also to prototype.
* engine.c (_gpgme_engine_op_edit): Likewise.
* engine.h: Likewise.
* edit.c (_gpgme_op_edit_start): Likewise.
2002-08-29 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_op_sign): Implement signer
selection.
* vasprintf.c (va_copy): Define macro if not yet defined.
2002-08-29 Marcus Brinkmann <marcus@g10code.de>
* passphrase.c (_gpgme_passphrase_status_handler): Reset
CTX->result.passphrase->no_passphrase if passphrase is given (good
or bad). Submitted by Jean DIRAISON <jean.diraison@free.fr>.
2002-08-28 Marcus Brinkmann <marcus@g10code.de>
* posix-io.c (_gpgme_io_spawn): Use a double-fork approach.
Return 0 on success, -1 on error.
* version.c (_gpgme_get_program_version): Don't wait for the child.
* engine.c (_gpgme_engine_housecleaning): Function removed.
(do_reaping): Likewise.
(_gpgme_engine_add_child_to_reap_list): Likewise.
(struct reap_s): Removed.
(reap_list): Likewise.
(reap_list_lock): Likewise.
* engine.h (_gpgme_engine_io_event): Remove prototypes for
_gpgme_engine_housecleaning and
_gpgme_engine_add_child_to_reap_list.
* rungpg.c (_gpgme_gpg_release): Don't add child to reap list.
(struct gpg_object_s): Remove PID member.
(_gpgme_gpg_new): Don't initialize GPG->pid.
(_gpgme_gpg_spawn): Don't set GPG->pid.
* wait.c (run_idle): Removed.
(gpgme_wait): Run idle_function directly.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
* encrypt-sign.c (encrypt_sign_status_handler): Remove dead
variables encrypt_info and encrypt_info_len.
* trustlist.c (gpgme_op_trustlist_start): Set colon line handler.
* posix-sema.c (sema_fatal): Remove function.
All these reported by Stéphane Corthésy.
2002-08-23 Werner Koch <wk@gnupg.org>
* gpgme-config.in: Made --prefix work for --libs.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
* ath.h: Update list of symbols that get a prefix: Rename the
ath_mutex_*_available symbols to ath_*_available.
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
* stpcpy.c: New file from gnulib.
* Makefile.am (assuan_libobjs): Remove jnlib.
2002-08-20 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Add prototype for gpgme_op_import_ext.
* import.c (struct import_result_s): New member `nr_considered'.
Rename `any_imported' to `nr_imported'.
(import_status_handler): Increment nr_imported. Set nr_considered
if appropriate.
(gpgme_op_import_ext): New function.
(gpgme_op_import): Implement in terms of gpgme_op_import_ext.
2002-08-20 Werner Koch <wk@gnupg.org>
* gpgme.m4: Replaced with a new and faster version. This does not
anymore try to build test programs. If we really need test
programs, we should add an option to gpgme-config to do so.
* vasprintf.c (int_vasprintf): Hack to handle NULL passed for %s.
2002-08-20 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (_gpgme_set_op_info): Append data on subsequent calls.
* encrypt-sign.c (encrypt_sign_status_handler): Remove op_info
handling.
2002-08-19 Werner Koch <wk@gnupg.org>
* decrypt.c (is_token,skip_token): Duplicated from verify.c
(gpgme_op_decrypt): Hack to properly return Decryption_Failed..
(_gpgme_decrypt_status_handler): Create an operation info.
2002-08-14 Werner Koch <wk@gnupg.org>
* key.h (struct certsig_s): New. Use it in gpgme_key_s.
* key.c (gpgme_key_release): Release it. We need to add more code
of course.
(_gpgme_key_append_name): Use memset to intialize the struct.
* gpgme.h (GPGME_KEYLIST_MODE_SIGS): New.
* rungpg.c (_gpgme_gpg_op_keylist): Include sigs in listing depending
non the list mode.
* key.c (gpgme_key_get_string_attr): Use GPGME_ATTR_TYPE to return
information about the key type (PGP or X.509).
(gpgme_key_get_ulong_attr): Likewise.
* keylist.c (keylist_colon_handler): Include 1 in the check for
valid algorithms so that RSA is usable. Store the issuer name and
serial number also for "crs" records. Parse the expire date for
subkeys.
(set_userid_flags): Put them onto the last appended key.
2002-07-29 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_op_edit): Use --with-colons.
2002-07-28 Marcus Brinkmann <marcus@g10code.de>
* data.c (gpgme_data_read): For GPGME_DATA_TYPE_NONE, return EOF
instead an error.
The following changes make it possible to flush an inbound data
pipe before invoking a command handler:
* posix-io.c (_gpgme_io_select): Accept new argument NONBLOCK to
_gpgme_io_select. Set timeout of 0 if this is set.
* w32-io.c (_gpgme_io_select): Likewise.
* io.h: Add new argument NONBLOCK to _gpgme_io_select prototype.
* wait.c (do_select): Add new argument to _gpgme_io_select
invocation.
* rungpg.h (_gpgme_gpg_set_command_handler): Add new argument
linked_data to prototype.
* engine.h (_gpgme_engine_set_command_handler): Likewise.
* engine.c (_gpgme_engine_set_command_handler): Likewise.
* passphrase.c (_gpgme_passphrase_start): Pass NULL as linked_data
argument to _gpgme_engine_set_command_handler.
* rungpg.c (struct gpg_object_s): New members linked_data and
linked_idx in CMD.
(_gpgme_gpg_new): Initialize those new members.
(_gpgme_gpg_set_command_handler): Accept new argument linked_data.
(build_argv): Handle linked_data in the same hack as cb_data.
(read_status): If linked_data is in use, flush the pipe before
activating the command handler.
* gpgme.h: Add prototypes for gpgme_op_edit_start and
gpgme_op_edit.
The next changes export the status codes to the user:
* decrypt.c (_gpgme_decrypt_status_handler): Likewise, also prefix
all STATUS_ with GPGME_.
* delete.c (delete_status_handler): Likewise.
* decrypt-verify.c (decrypt_verify_status_handler): Likewise.
* encrypt.c (_gpgme_encrypt_status_handler): Likewise.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (parse_status): Likewise.
(gpgsm_status_handler): Likewise.
(gpgsm_set_recipients): Likewise.
* export.c (export_status_handler): Likewise.
* genkey.c (genkey_status_handler): Likewise.
* import.c (append_xml_impinfo): Likewise.
(import_status_handler): Likewise.
* keylist.c (keylist_status_handler): Likewise.
* passphrase.c (_gpgme_passphrase_status_handler): Likewise.
(command_handler): Likewise.
* progress.c (_gpgme_progress_status_handler): Likewise.
* sign.c (_gpgme_sign_status_handler): Likewise.
* trustlist.c (trustlist_status_handler): Likewise.
* verify.c (_gpgme_verify_status_handler): Likewise.
* gpgme.h (GpgmeEditCb): New type.
* rungpg.h (GpgStatusCode): Rename and move to ...
* gpgme.h (GpgmeStatusCode): ... this and here.
* Makefile.am (status-table.h): Run mkstatus on gpgme.h, not rungpg.h.
* mkstatus: Prefix STATUS with GPGME_.
* rungpg.h (GpgStatusHandler, GpgCommandHandler): Change type
accordingly.
* ops.h (_gpgme_verify_status_handler,
_gpgme_decrypt_status_handler, _gpgme_sign_status_handler,
_gpgme_encrypt_status_handler, _gpgme_passphrase_status_handler,
_gpgme_progress_status_handler): Likewise.
* rungpg.c (struct gpg_object_s): Likewise for CMD.code.
These changes add an edit operation to GPGME:
* context.h (struct gpgme_context_s): New member RESULT.edit. *
ops.h: Add prototype for _gpgme_release_edit_result and
_gpgme_passphrase_command_handler.
* passphrase.c (command_handler): Make non-static and rename to ...
(_gpgme_passphrase_command_handler): ... this.
(_gpgme_passphrase_start): Use new name for command handler.
* types.h: Add EditResult type.
* gpgme.c (_gpgme_release_result): Release EDIT result.
* edit.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add edit.c.
(libgpgme_la_LDADD): Rename to libgpgme_la_LIBADD, and include
assuan_libobjs.
(assuan_libobjs): New variable, set this instead
libgpgme_la_LIBADD.
* engine.h (_gpgme_engine_op_edit): New prototype.
* engine.c (_gpgme_engine_op_edit): New function.
* rungpg.h (_gpgme_gpg_op_edit): New prototype.
* rungpg.c (_gpgme_gpg_op_edit): New function.
2002-07-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c (delete_problem): New case ambigious specification.
(delete_status_handler): Handle new case (poorly).
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_delete): Implement this.
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_la_LDADD): Add @LIBOBJS@ for vasprintf and
fopencookie.
* vasprintf.c: Update to more recent libiberty version.
* debug.h: Replace #elsif with #elif.
Submitted by Stéphane Corthésy:
* util.h (vasprintf): Correct prototype.
* encrypt-sign.c: Include <stddef.h>.
(encrypt_sign_status_handler): Change type of ENCRYPT_INFO_LEN to
size_t.
* ath-pthread.c: Include <stdlib.h>, not <malloc.h>.
* ath-pth.c: Likewise.
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
* wait.c (fdt_global): Make static. Reported by Stéphane
Corthésy.
* rungpg.c (_gpgme_gpg_op_keylist_ext): Skip empty string
patterns. Reported by Stéphane Corthésy.
* key.c (gpgme_key_get_as_xml): Add OTRUST attribute. Requested
by Stéphane Corthésy.
(gpgme_key_get_string_attr): Add GPGME_ATTR_SIG_SUMMARY case to
silence gcc warning.
* rungpg.c (_gpgme_gpg_new): Always set utf8 as charset.
2002-07-03 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_set_io_cbs): Deal with CTX being NULL.
* gpgme.c (_gpgme_op_event_cb_user): New function.
* op-support.c (_gpgme_op_reset): Support a new mode of operation
for private or user event loop. Use new user event callback
wrapper.
* trustlist.c (gpgme_op_trustlist_start): Use this new mode.
* keylist.c (gpgme_op_keylist_start): Likewise.
* rungpg.c (_gpgme_gpg_io_event): New function.
* rungpg.h (_gpgme_gpg_io_event): New prototype.
* engine-gpgsm.c (_gpgme_gpg_io_event): New function.
* engine-gpgsm.h (_gpgme_gpgsm_io_event): New prototype.
* engine.c (_gpgme_engine_io_event): New function.
* engine.h (_gpgme_engine_io_event): New prototype.
* keylist.c (finish_key): Call _gpgme_engine_io_event, and move
the real work for the default IO callback routines to ...
(_gpgme_op_keylist_event_cb): ... here. New function.
* trustlist.c (trustlist_colon_handler): Signal
GPGME_EVENT_NEXT_TRUSTITEM. Move queue manipulation to ...
(_gpgme_op_trustlist_event_cb): ... here. New function.
* gpgme.c (_gpgme_op_event_cb): Call _gpgme_op_keylist_event_cb
and _gpgme_op_trustlist_event_cb when appropriate.
* ops.h (_gpgme_op_keylist_event_cb): New prototype.
(_gpgme_op_trustlist_event_cb): Likewise.
* op-support.c (_gpgme_op_reset): Add comment why we don't use the
user provided event handler directly.
* gpgme.h (GpgmeRegisterIOCb): Return GpgmeError value, and TAG in
a pointer argument.
* wait.c (_gpgme_add_io_cb): Likewise.
* wait.h (_gpgme_add_io_cb): Likewise for prototype.
* rungpg.c (_gpgme_gpg_add_io_cb): Call IO_CBS->add with new
argument. Fix up error handling.
* engine-gpgsm.c (_gpgme_gpgsm_add_io_cb): Call IO_CBS->add with
new argument, fix up error handling.
2002-07-03 Werner Koch <wk@gnupg.org>
* encrypt.c (status_handler_finish): New.
(_gpgme_encrypt_status_handler): Moved some code out to the new
function and call this function also in case we get into the
status handler with an error which might happen due to a kludge in
engine-gpgsm.c
2002-06-28 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_op_keylist_ext_start): Always use our own FD
table (eg use synchronous mode).
2002-06-28 Marcus Brinkmann <marcus@g10code.de>
* ops.h (_gpgme_wait_on_condition): Remove HANG argument from
prototype and change return type to GpgmeError.
(_gpgme_wait_one): New prototype.
* wait.c (gpgme_wait): Replace with the meat from
_gpgme_wait_on_condition here, and remove the support for
conditions.
(_gpgme_wait_on_condition): Remove HANG argument from prototype
and change return type to GpgmeError. Replace with meat from
_gpgme_wait_one and add support for conditions.
(_gpgme_wait_one): Just call _gpgme_wait_on_condition without
condition.
* keylist.c (gpgme_op_keylist_ext_start): Always use our own FD
table (eg use synchronous mode).
(gpgme_op_keylist_next): Remove HANG argument from
_gpgme_wait_on_condition. Check its return value.
* trustlist.c (gpgme_op_trustlist_start): Always use our own FD
table (eg use synchronous mode).
(gpgme_op_trustlist_next): Remove HANG argument from
_gpgme_wait_on_condition. Check its return value.
2002-06-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Fix documentation of key attribute retrieval functions.
2002-06-26 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (map_assuan_error): Map No_Data_Available to EOF.
* import.c (append_xml_impinfo): Kludge to print fingerprint
instead of keyid for use with gpgsm.
(import_status_handler): Set a flag to know whether any import
occured.
(gpgme_op_import): Reurn -1 if no certificate ewas imported.
2002-06-25 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_set_io_cbs) [ENABLE_GPGSM]: Fixed
function arguments.
2002-06-25 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_export): Only export the keys
listed in RECP.
* export.c (gpgme_op_export): If no data was returned, return
GPGME_No_Recipients.
2002-06-25 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_export): Implement.
2002-06-21 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_assuan_simple_command): Return ERR.
(parse_status): New function.
(gpgsm_status_handler): Use parse_status.
(gpgsm_assuan_simple_command): Accept new arguments STATUS_FNC and
STATUS_FNC_VALUE and process status messages.
(gpgsm_set_recipients): Pass new arugments to gpgsm_assuan_simple_command.
(gpgsm_set_fd): Likewise.
(_gpgme_gpgsm_op_keylist): Likewise.
(_gpgme_gpgsm_op_keylist_ext): Likewise.
(_gpgme_gpgsm_op_sign): Likewise.
2002-06-21 Marcus Brinkmann <marcus@g10code.de>
* wait.c (_gpgme_remove_io_cb): Unlock FDT->lock.
2002-06-20 Werner Koch <wk@gnupg.org>
* rungpg.c (build_argv): Ignore GPG_AGENT_INFO if set but empty.
* verify.c (calc_sig_summary): Set bad policy for wrong key usage.
(skip_token): New.
(_gpgme_verify_status_handler): Watch out for wrong key usage.
(gpgme_get_sig_string_attr): Hack to return info on the key
usage. Does now make use of the former RESERVED argument which
has been renamed to WHATIDX.
(gpgme_get_sig_ulong_attr): Renamed RESERVED to WHATIDX.
2002-06-14 Marcus Brinkmann <marcus@g10code.de>
* wait.c (do_select): Return -1 on error, and 0 if nothing to run.
(_gpgme_wait_one): Only set HANG to zero if do_select returned an
error, or there are no more file descriptors to wait on.
(_gpgme_wait_on_condition): Ignore return value from do_select for
now.
2002-06-13 Werner Koch <wk@gnupg.org>
* verify.c (gpgme_op_verify): Make sure that we never access an
unitialized result structure.
2002-06-12 Werner Koch <wk@gnupg.org>
* keylist.c (struct keylist_result_s): New.
(_gpgme_release_keylist_result): Release it here
(keylist_status_handler): Handle truncated.
(append_xml_keylistinfo): New.
* gpgme.c (_gpgme_release_result): and use it here.
* types.h: Declare the new type here.
* context.h (struct gpgme_context_s): Use it here.
2002-06-11 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_release): Close status_cb.fd.
(_gpgme_gpgsm_new): Duplicate status file descriptor, so we can
use our own close notification mechanism without interfering with
assuan.
2002-06-11 Werner Koch <wk@gnupg.org>
* gpgme.h: Add GPGME_ATTR_SIG_SUMMARY and the GPGME_SIGSUM_
constants.
* verify.c (calc_sig_summary): New.
(gpgme_get_sig_ulong_attr): And use it here.
2002-06-10 Werner Koch <wk@gnupg.org>
* rungpg.h: Add new status codes TRUNCATED and ERROR.
* verify.c (is_token, copy_token): New.
(_gpgme_verify_status_handler): Use copy_token, handle the new
ERROR status and store the errorcode used withgpgsm and trust
status codes.
* gpgme.h: New attribute ERRTOK.
* key.c (gpgme_key_get_string_attr): Add dummy case for it.
(gpgme_get_sig_string_attr): Use it here to return the last error.
2002-06-10 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_start): Move the code that sets the
close notification for the status fd to ...
(_gpgme_gpgsm_new): ... here.
* wait.h: Include "sema.h". Remove prototypes of
_gpgme_remove_proc_from_wait_queue and
_gpgme_register_pipe_handler. Add prototypes of
_gpgme_fd_table_init, _gpgme_fd_table_deinit, _gpgme_fd_table_put,
_gpgme_add_io_cb, _gpgme_remove_io_cb, _gpgme_wait_event_cb and
_gpgme_wait_one..
* wait.c: Remove global variables PROC_QUEUE, PROC_QUEUE_LOCK,
FD_TABLE_SIZE, FD_TABLE, FD_TABLE_LOCK. New global variables
FDT_GLOBAL, CTX_DONE_LIST, CTX_DONE_LIST_SIZE,
CTX_DONE_LIST_LENGTH and CTX_DONE_LIST_LOCK. Remove struct
proc_s. Replace struct wait_item_s.
(_gpgme_fd_table_init): New function.
(_gpgme_fd_table_deinit): Likewise.
(_gpgme_fd_table_put): Likewise.
(set_process_done): Remove function.
(do_select): Take argument FDT. Use that to decide which fds to
select on.
(_gpgme_remove_proc_from_wait_queue): Remove function.
(_gpgme_wait_event_cb): New function.
(_gpgme_wait_one): Likewise.
(_gpgme_register_pipe_hanldler): Remove function.
(_gpgme_add_io_cb): New function.
(_gpgme_remove_io_cb): Likewise.
(_gpgme_freeze_fd): Remove function.
(_gpgme_thaw_fd): Remove function.
* rungpg.c (struct fd_data_map_s): Add new member TAG.
(struct gpg_object_s): Likewise for STATUS and COLON. Add member
IDX to CMD. Add new member IO_CBS.
(close_notify_handler): New variables POSSIBLY_DONE and NOT_DONE.
For each I/O callback, check if it should be unregistered. If all
callbacks have been unregistered, trigger GPGME_EVENT_DONE.
Remove member RUNNING.
(_gpgme_gpg_new): Initialize new members.
(_gpgme_gpg_release): Check PID not RUNNING. Don't call
_gpgme_remove_proc_from_wait_queue. Close GPG->CMD.FD if set.
(build_argv): Store away the index instead the file descriptor for
CMD.
(_gpgme_gpg_add_io_cb): New function.
(_gpgme_gpg_spawn): Use _gpgme_gpg_add_io_cb to register IO
callbacks.
(gpg_status_handler): Change return type to void, remove PID
argument, close filedescriptor if EOF or error occurs.
(read_status): Use _gpgme_gpg_add_io_cb instead _gpgme_thaw_fd.
Use IO_CBS->remove instead _gpgme_freeze_fd.
(gpg_colon_line_handler): Change return type to void, remove PID
argument, close filedescriptor if EOF or error occurs.
(command_cb): Use IO_CBS->remove instead _gpgme_freeze_fd.
(_gpgme_gpg_set_io_cbs): New function.
* rungpg.h (_gpgme_gpg_set_io_cbs): Prototype for
_gpgme_gpg_set_io_cbs.
* gpgme.h (GpgmeIOCb): New type.
(GpgmeRegisterIOCb): Likewise.
(GpgmeRemoveIOCb): Likewise.
(GpgmeEventIO): Likewise.
(GpgmeEventIOCb): Likewise.
(struct GpgmeIOCbs): New structure to hold I/O callbacks.
(gpgme_set_op_io_cbs): New prototype.
(gpgme_get_op_io_cbs): Likewise.
* ops.h: New prototype for _gpgme_op_event_cb. Remove prototypes
for _gpgme_freeze_fd and _gpgme_thaw_fd. Remove PID argument from
_gpgme_data_inbound_handler and _gpgme_data_outbound_handler
prototype. Add prototype for _gpgme_op_reset.
Add synchronous argument to _gpgme_decrypt_start prototype.
* io.h: Beautification.
* gpgme.c: Include "wait.h".
(gpgme_new): Initialize FDT.
(gpgme_set_io_cbs): New function.
(gpgme_get_io_cbs): Likewise.
(_gpgme_op_event_cb): Likewise.
* data.c (_gpgme_data_inbound_handler): Change return type to
void. Drop PID argument. Close FD on error and EOF.
(write_mem_data): Don't close FD here ...
(write_cb_data): ... or here ...
(_gpgme_data_outbound_handler): ... but here. Change return type
to void. Drop PID argument.
* context.h: Include "wait.h".
(struct gpgme_context_s): New members FDT and IO_CBS.
* op-support.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add op-support.c.
* ops.h: Add prototype for _gpgme_op_reset().
* decrypt.c (_gpgme_decrypt_start): New argument SYNCHRONOUS. Use
_gpgme_op_reset.
(gpgme_op_decrypt_start): Add synchronous argument.
(gpgme_op_decrypt): Likewise. Use _gpgme_wait_one instead
gpgme_wait.
* delete.c (gpgme_op_delete_start): Rename to ...
(_gpgme_op_delete_start): ... this. New argument SYNCHRONOUS.
Use _gpgme_op_reset. Make function static.
(gpgme_op_delete_start): Just a wrapper around
_gpgme_op_delete_start now.
(gpgme_op_delete): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* encrypt.c: Include "wait.h".
(ggpgme_op_encrypt_start): Rename to ...
(_gpgme_op_encrypt_start): ... this. New argument SYNCHRONOUS.
Use _gpgme_op_reset. Make function static.
(gpgme_op_encrypt_start): Just a wrapper around
_gpgme_op_encrypt_start now.
(gpgme_op_encrypt): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* encrypt_sign.c (gpgme_op_encrypt_sign_start): Rename to ...
(_gpgme_op_encrypt_sign_start): ... this. New argument
SYNCHRONOUS. Use _gpgme_op_reset. Make function static.
(gpgme_op_encrypt_sign_start): Just a wrapper around
_gpgme_op_encrypt_sign_start now.
(gpgme_op_encrypt_sign): Add synchronous argument. Use
_gpgme_wait_one instead gpgme_wait.
* export.c (gpgme_op_export_start): Rename to ...
(_gpgme_op_export_start): ... this. New argument SYNCHRONOUS.
Use _gpgme_op_reset. Make function static.
(gpgme_op_export_start): Just a wrapper around
_gpgme_op_export_start now.
(gpgme_op_export): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* genkey.c (gpgme_op_genkey_start): Rename to ...
(_gpgme_op_genkey_start): ... this. New argument SYNCHRONOUS.
Use _gpgme_op_reset. Make function static.
(gpgme_op_genkey_start): Just a wrapper around
_gpgme_op_genkey_start now.
(gpgme_op_genkey): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* import.c (gpgme_op_import_start): Rename to ...
(_gpgme_op_import_start): ... this. New argument SYNCHRONOUS.
Use _gpgme_op_reset. Make function static.
(gpgme_op_import_start): Just a wrapper around
_gpgme_op_import_start now.
(gpgme_op_import): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* keylist.c (gpgme_op_keylist_start): Use _gpgme_op_reset.
(gpgme_op_keylist_ext_start): Likewise.
* sign.c (gpgme_op_sign_start): Rename to ...
(_gpgme_op_sign_start): ... this. New argument SYNCHRONOUS. Use
_gpgme_op_reset. Make function static.
(gpgme_op_sign_start): Just a wrapper around _gpgme_op_sign_start
now.
(gpgme_op_sign): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* trustlist.c (gpgme_op_trustlist_start): Use _gpgme_op_reset.
* verify.c (gpgme_op_verify_start): Rename to ...
(_gpgme_op_verify_start): ... this. New argument SYNCHRONOUS.
Use _gpgme_op_reset. Make function static.
(gpgme_op_verify_start): Just a wrapper around
_gpgme_op_verify_start now.
(gpgme_op_verify): Add synchronous argument. Use _gpgme_wait_one
instead gpgme_wait.
* engine-gpgsm.c (iocb_data_t): New type.
(struct gpgsm_object_s): New member status_cb. Replace input_fd
and input_data with input_cb. Replace output_fd and output_data
with output_cb. Replace message_fd and message_data with
message_cb. New member io_cbs.
(_gpgme_gpgsm_new): Initialize all new members (and drop the old
ones).
(close_notify_handler): New variable POSSIBLY_DONE. For each I/O
callback, check if it should be unregistered. If all callbacks
have been unregistered, trigger GPGME_EVENT_DONE.
(_gpgme_gpgsm_release): Remove variable PID. Use new variable
names to close the file descriptors.
(_gpgme_gpgsm_op_decrypt): Use new variable names,
(_gpgme_gpgsm_op_encrypt): Likewise.
(_gpgme_gpgsm_op_genkey): Likewise.
(_gpgme_gpgsm_op_import): Likewise.
(_gpgme_gpgsm_op_keylist): Likewise.
(_gpgme_gpgsm_op_keylist_ext): Likewise.
(_gpgme_gpgsm_op_sign): Likewise.
(_gpgme_gpgsm_op_verify): Likewise.
(gpgsm_status_handler): Drop argument PID. Change return type to
void. Close status pipe before returning because of EOF or error.
(_gpgme_gpgsm_add_io_cb): New function.
(_gpgme_gpgsm_start): Use _gpgme_gpgsm_add_io_cb to register
callback function.
(_gpgme_gpgsm_set_io_cbs): New function.
* engine-gpgsm.h: New prototype for _gpgme_gpgsm_set_io_cbs.
* engine.c (_gpgme_engine_set_io_cbs): New function.
* engine.h: New prototype for _gpgme_engine_set_io_cbs.
2002-06-04 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_la_SOURCES): Remove mutex.h.
2002-06-03 Marcus Brinkmann <marcus@g10code.de>
* key.c: Include <ctype.h>.
(_gpgme_key_append_name): Skip one more char when
processing escaped char. Submitted by Marc Mutz <mutz@kde.org>.
Handle hexadecimal encodings. Also reported by Marc. Thanks!
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* ath.h: Enable the _gpgme_ prefix. Fix all those prefix macros.
* posix-sema.c: Use that prefix here.
* posix-io.c: Include "ath.h".
(_gpgme_io_read): Use _gpgme_ath_read instead read.
(_gpgme_io_write): Use _gpgme_ath_write instead write.
(_gpgme_io_waitpid): Use _gpgme_ath_waitpid instead waitpid.
(_gpgme_io_select): Use _gpgme_ath_select instead select.
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (ath_components): New variable.
(ath_components_pthread): Likewise.
(ath_components_pth): Likewise.
(system_components): Add ath_componentes.
* ath.h: New file.
* ath.c: Likewise.
* ath-pthread.c: Likewise.
* ath-pth.c: Likewise.
* posix-sema.c (_gpgme_sema_cs_enter): Rework to use the ATH
interface.
* mutex.h: Remove file.
2002-05-30 Werner Koch <wk@gnupg.org>
* key.c (gpgme_key_get_string_attr): Return NULL when asking for
an issuer with IDX > 0. We don't support altIssuerNames for now.
2002-05-22 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist_ext): Aehmm, added
missing variable definition. Oohh - Marcus was faster.
2002-05-22 Marcus Brinkmann <marcus@gnu.org>
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist_ext): Fix last change.
2002-05-21 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist)
(_gpgme_gpgsm_op_keylist_ext): Pass the keylist mode to gpgsm.
2002-05-10 Werner Koch <wk@gnupg.org>
* key.h (gpgme_key_s): Add OTRUST.
* keylist.c (set_ownertrust): New.
(keylist_colon_handler): Get the ownertrust value
* key.c (gpgme_key_get_string_attr,gpgme_key_get_ulong_attr):
Return that value.
2002-05-08 Marcus Brinkmann <marcus@g10code.de>
* w32-util.c: New static variable GET_PATH_LOCK.
(_gpgme_get_gpg_path): Remove superfluous NULL initializer.
Take lock while determining path.
(_gpgme_get_gpgsm_path): Likewise.
* version.c (do_subsystem_inits): Set DONE to 1 after
initialization.
(gpgme_get_engine_info): New variable ENGINE_INFO_LOCK. Take lock
while determining engine info.
* rungpg.c (_gpgme_gpg_get_version): New variable
GPG_VERSION_LOCK. Take the lock while determining the program
version.
* posix-io.c: Include "sema.h".
(_gpgme_io_spawn): New variable FIXED_SIGNALS_LOCK. Take the lock
while fixing the signals.
(_gpgme_io_select): Make READFDS and WRITEFDS non-static.
* key.c: Include "sema.h". New globals KEY_CACHE_LOCK and
KEY_REF_LOCK.
(capabilities_to_string): Make STRINGS very const.
(_gpgme_key_cache_add): Lock the key cache.
(_gpgme_key_cache_get): Likewise.
(gpgme_key_ref, gpgme_key_release): Lock the key_ref_lock.
* import.c (append_xml_impinfo): Make IMPORTED_FIELDS and
IMPORT_RES_FIELDS very const. Make FIELD and FIELD_NAME a litle
const.
* engine.c (_gpgme_engine_get_info): New variable
ENGINE_INFO_LOCK. Take lock while determining engine info.
* engine-gpgsm.c: Include "sema.h".
(_gpgme_gpgsm_get_version): New variable GPGSM_VERSION_LOCK. Take
lock while getting program version.
2002-05-08 Marcus Brinkmann <marcus@g10code.de>
* debug.h: New file.
* Makefile.am (libgpgme_la_SOURCES): Add debug.h.
* util.h: Removed all prototypes and declarations related to
debugging. Include "debug.h".
* debug.c (debug_level): Comment variable and remove superfluous
zero initializer.
(errfp): Likewise.
(_gpgme_debug_enabled): Function removed.
(struct debug_control_s): Definition removed.
(_gpgme_debug_level): Function removed.
(_gpgme_debug_begin): Rewritten to use vasprintf. Accept a
pritnf-style format specification and a variable number of
arguments.
(_gpgme_debug_add): Rewritten using vasprintf. Expect that format
starts out with "%s" for simplicity.
(_gpgme_debug_end): Rewritten using vasprintf. Do not accept a
TEXT argument anymore.
* posix-io.c (_gpgme_io_select): Use new level argument for
DEBUG_BEGIN instead explicit if construct.
* debug.c (debug_init): Remove superfluous zero initializer,
remove volatile flag of INITIALIZED. Do not use the
double-checked locking algorithm, it is fundamentally flawed and
will empty your fridge (on a more serious note, despite the
volatile flag it doesn't give you the guarantee you would expect,
for example on a DEC Alpha or an SMP machine. The volatile only
serializes accesses to the volatile variable, but not to the other
variables).
2002-05-03 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_new): Redirect any gpgsm error
output to /dev/null.
* verify.c (gpgme_get_sig_key): Set the protocol of the listctx.
* gpgme.c (gpgme_get_protocol): New.
* data.c (gpgme_data_write): Changed type of BUFFER to void*.
(gpgme_data_read): Ditto.
* verify.c (_gpgme_verify_status_handler): Handle TRUST_* status
lines so that a claim can be made without looking up the key.
(gpgme_get_sig_string_attr): New.
(gpgme_get_sig_ulong_attr): New.
* gpgme.h (GpgmeAttr): Added GPGME_ATTR_SIG_STATUS.
* rungpg.h: Add new status codes from gpg 1.0.7 and formatted the
list to align with the status.h file from gnupg.
* gpgme.h (GpgmeSigStat): Add _GOOD_EXP and _GOOD_EXPKEY.
* verify.c (_gpgme_verify_status_handler, finish_sig): Handle
these new status codes. Store the expiration time
2002-04-27 Werner Koch <wk@gnupg.org>
* gpgme.h (GpgmeData_Encoding): New.
* data.c (gpgme_data_get_encoding,gpgme_data_set_encoding): New.
* engine-gpgsm.c (map_input_enc): New. Use it in all local
functions where the INPUT command gets send.
2002-04-27 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_verify): Close the output
descriptor only when we don't need it anymore. Close the message
descriptor if we don't need it.
2002-04-26 Werner Koch <wk@gnupg.org>
* Makefile.am (libgpgme_la_LIBADD): Use libtool libraries.
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_release): Call gpgme_data_release on
GPG->cmd.cb_data, not xfree.
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_new): Set the display, ttyname,
ttytype, lc_ctype and lc_messages options in the server.
2002-04-24 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (map_assuan_error): Add new error codes.
2002-04-23 Werner Koch <wk@gnupg.org>
* key.c (gpgme_key_get_ulong_attr): Swapped use of can_encrypt and
can_certify to return the requested values.
2002-04-23 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_get_progress_cb): Allow either return parameter
to be NULL.
(gpgme_get_passphrase_cb): Likewise.
2002-04-22 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_get_passphrase_cb): New function.
(gpgme_get_progress_cb): New function.
* gpgme.h: Add new prototypes for gpgme_get_passphrase_cb and
gpgme_get_progress_cb.
2002-03-28 Werner Koch <wk@gnupg.org>
* gpgme.h (GpgmeAttr): Add values for issuer and chaining.
* key.h (gpgme_key_s): Add issuer and chaining elements for X509.
* keylist.c (keylist_colon_handler): Store them.
* key.c (gpgme_key_release): Free them.
(gpgme_key_get_as_xml,gpgme_key_get_string_attr): Print them.
2002-03-26 Werner Koch <wk@gnupg.org>
* Makefile.am (libgpgme_la_SOURCES): Add mutex.h
2002-03-21 Werner Koch <wk@gnupg.org>
* util.h [!HAVE_FOPENCOOKIE]: Make sure off_t and ssize_t are
defined.
2002-03-18 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (system_components): New variable, set depending on
HAVE_DOSISH_SYSTEM.
(libgpgme_la_SOURCES): Use system_components. Remove `syshdr.h'.
* syshdr.h: File removed.
* posix-io.c: Remove !HAVE_DOSISH_SYSTEM safeguard. Clean up source.
* posix-sema.c: Likewise.
* posix-util.c: Likewise.
* w32-io.c: Remove HAVE_DOSISH_SYSTEM safeguard.
* w32-sema.c: Likewise.
* w32-util.c: Likewise.
* posix-io.c: Include `unistd.h', do not include `syshdr.h'.
* posix-sema.c: Likewise.
* w32-io.c: Include `io.h', do not include `syshdr.h'
* w32-sema.c: Likewise.
* w32-util.c: Likewise.
* data.c: Do not include `syshdr.h'.
* wait.c: Likewise.
* wait.h: Code cleanup.
* mutex.h: New file.
* posix-sema.c: Implement.
2002-03-08 Werner Koch <wk@gnupg.org>
* util.h [!HAVE_FOPENCOOKIE]: Fixed type. Thanks to Frank Heckenbach.
2002-03-07 Werner Koch <wk@gnupg.org>
* gpgme.h (gpgme_op_keylist_ext_start): Add prototype.
2002-03-06 Marcus Brinkmann <marcus@g10code.de>
* encrypt.c (_gpgme_encrypt_sym_status_handler): New function.
(gpgme_op_encrypt_start): New variable SYMMETRIC, set it if RECP
is null, and if it is set, use _gpgme_encrypt_sym_status_handler
as status handler and run _gpgme_passphrase_start.
* rungpg.c (_gpgme_gpg_op_encrypt): If RECP is zero, do symmetric
encryption.
* engine-gpgsm.c (_gpgme_gpgsm_op_encrypt): If RECP is zero,
return error value.
* rungpg.c (_gpgme_gpg_op_verify): Add "--" argument.
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
* passphrase.c (_gpgme_passphrase_status_handler): Also set the
error No_Passphrase if only a bad passphrase was provided.
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_op_verify): If TEXT is of mode
GPGME_DATA_MODE_IN, construct a command line that stores the
plaintext in TEXT.
* verify.c (gpgme_op_verify_start): Accept TEXT being
uninitialized, and in this case interpret SIG as a normal or
cleartext signature and TEXT as a return data object.
* engine-gpgsm.c (_gpgme_gpgsm_op_verify): Likewise.
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist_ext) [!ENABLE_GPGSM]:
Add stub function.
2002-02-28 Werner Koch <wk@gnupg.org>
* key.h (subkey_s): New member expires_at.
* keylist.c (keylist_colon_handler): Set it here
* key.c (gpgme_key_get_as_xml,gpgme_key_get_ulong_attr): Return it.
2002-02-27 Marcus Brinkmann <marcus@g10code.de>
* rungpg.h (_gpgme_gpg_op_keylist_ext): New prototype.
* rungpg.c (_gpgme_gpg_op_keylist_ext): New function.
* engine-gpgsm.h (_gpgme_gpgsm_op_keylist_ext): New prototype.
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist_ext): New function.
* engine.h (_gpgme_engine_op_keylist_ext): New prototype.
* engine.c (_gpgme_engine_op_keylist_ext): New function.
* keylist.c (gpgme_op_keylist_ext_start): New function.
2002-02-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Add new error code GPGME_Invalid_Recipient.
* encrypt.c (struct encrypt_result_s): New member invalid_recipients,
rename no_recipients to no_valid_recipients.
(_gpgme_encrypt_status_handler): Include error for invalid
recipients.
* engine-gpgsm.c (gpgsm_set_recipients): Change type of first
argument to GpgsmObject. Use that to report back the status about
the recipients.
2002-02-26 Marcus Brinkmann <marcus@g10code.de>
* verify.c (_gpgme_verify_status_handler): Fix the last change.
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* engine.c (_gpgme_engine_op_encrypt_sign): New function.
* engine.h (_gpgme_engine_op_encrypt_sign): New prototype.
* rungpg.c (_gpgme_append_gpg_args_from_signers): New function.
(_gpgme_gpg_op_sign): Use that new function.
(_gpgme_gpg_op_encrypt_sign): New function.
* rungpg.h (_gpgme_gpg_op_encrypt_sign): New prototype.
* gpgme.h (gpgme_op_encrypt_sign_start): New prototype.
(gpgme_op_encrypt_sign): Likewise.
* Makefile.am (libgpgme_la_SOURCES): Add encrypt-sign.c.
* ops.h (_gpgme_encrypt_status_handler): Add prototype.
(_gpgme_sign_status_handler): Add prototype.
* sign.c (sign_status_handler): Rename to ...
(_gpgme_sign_status_handler): ... this and make non-static.
* encrypt.c (encrypt_status_handler): Rename to ...
(_gpgme_encrypt_status_handler): ... this and make non-static.
* encrypt.c (gpgme_op_encrypt_start): Use new status handler name.
* sign.c (gpgme_op_sign_start): Likewise.
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* verify.c (_gpgme_verify_status_handler): Parse the args line to
see if the problem is due to a missing key, and report that back
to the user.
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* context.h (struct gpgme_context_s): New member include_certs.
* gpgme.h (gpgme_set_include_certs): Add prototype.
(gpgme_get_include_certs): Likewise.
* gpgme.c (gpgme_set_include_certs): New function.
(gpgme_get_include_certs): Likewise.
(gpgme_new): Set include_certs to 1 (the default).
* engine.c (_gpgme_engine_op_sign): Accept new argument include_certs,
and pass it to _gpgme_gpgsm_op_sign.
* engine.h (_gpgme_engine_op_sign): Likewise for prototype.
* engine-gpgsm.c (_gpgme_gpgsm_op_sign): Accept new argument
include_certs and handle it.
* engine-gpgsm.h (_gpgme_gpgsm_start): Add new argument include_certs.
* sign.c (gpgme_op_sign_start): Add new argument to
_gpgme_engine_op_sign call.
2002-02-14 Werner Koch <wk@gnupg.org>
* keylist.c (gpgme_op_keylist_start): Do not use a verbose listing.
2002-02-13 Werner Koch <wk@gnupg.org>
* vasprintf.c, fopencookie.c: Add replacement functions.
* util.h: Add prototypes for them.
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_assuan_simple_command): Return 0 if we
reach the end of the function.
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
* genkey.c (gpgme_op_genkey_start): Fix logic in validity check.
(gpgme_op_genkey_start): Skip newlines after opening tag.
* engine-gpgsm.c (_gpgme_gpgsm_start): Remove cruft.
2002-02-08 Marcus Brinkmann <marcus@g10code.de>
* genkey.c (gpgme_op_genkey_start): Allow PUBKEY and SECKEY to be
set, and pass them down to the crypto engine.
* engine-gpgsm.h (_gpgme_gpgsm_start): New arguments PUBKEY and SECKEY.
* engine.h: Likewise.
* rungpg.h (_gpgme_gpg_spawn): Likewise.
* engine.c (_gpgme_engine_op_genkey): Likewise. Use those
arguments.
* rungpg.c (_gpgme_gpg_op_genkey): Likewise. Complain if those
arguments are set.
* engine-gpgsm.c (_gpgme_gpgsm_op_genkey): Likewise. Implement
function.
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Beautify comment.
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_op_keylist): Remove handling of keylist
mode (for now).
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
* wait.c (gpgme_wait): Add new argument STATUS, in which the
status of the returned context is returned.
(_gpgme_wait_on_condition): Rework the function a bit, to make it
aware of cancelled processes, and to allow to use gpgme_wait with
CTX being NULL (as documented in the source).
(struct proc_s): New member REPORTED.
* gpgme.h: Fix prototype.
* verify.c (gpgme_op_verify): Fix use of gpgme_wait.
* sign.c (gpgme_op_sign): Likewise.
* import.c (gpgme_op_import): Likewise.
* genkey.c (gpgme_op_genkey): Likewise.
* export.c (gpgme_op_export): Likewise.
* encrypt.c (gpgme_op_encrypt): Likewise.
* delete.c (gpgme_op_delete): Likewise.
* decrypt-verify.c (gpgme_op_decrypt_verify): Likewise.
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_set_keylist_mode): Possibly return an error
value.
(gpgme_get_keylist_mode): New function.
(gpgme_new): Set the default for keylist_mode member of CTX.
* gpgme.h (gpgme_set_keylist_mode): Fix prototype.
(gpgme_get_keylist_mode): New prototype.
(GPGME_KEYLIST_MODE_LOCAL): New macro.
(GPGME_KEYLIST_MODE_EXTERN): Likewise..
2002-02-02 Marcus Brinkmann <marcus@g10code.de>
This patch has gotten a bit large... mmh. The main thing that
happens here is that error values are now not determined in the
operation function after gpgme_wait completed, but in the status
handler when EOF is received. It should always be the case that
either an error is flagged or EOF is received, so that after a
gpgme_wait you should never have the situation that no error is
flagged and EOF is not received. One problem is that the engine
status handlers don't have access to the context, a horrible
kludge works around this for now. All errors that happen during a
pending operation should be catched and reported in ctx->error,
including out-of-core and cancellation. This rounds up neatly a
couple of loose ends, and makes it possible to pass up any errors
in the communication with the backend as well. As a bonus, there
will be a function to access gpgme->wait, so that the operations
can truly be implemented with their _start function.
* engine-gpgsm.c (gpgsm_status_handler): Horrible kludge to report
error back to the context.
* rungpg.c (gpg_status_handler): Same horrible kludge applied here.
* engine-gpgsm.c (gpgsm_assuan_simple_command): Add error checking.
* wait.c (_gpgme_wait_on_condition): If canceled, set CTX->error
to a value indication that.
* verify.c (add_notation): Set error, not out_of_core.
(finish_sig): Likewise.
(gpgme_op_verify_start): Don't clear out_of_core.
(_gpgme_verify_status_handler): At EOF, clean up the notation data.
(gpgme_op_verify): And don't do it here.
* trustlist.c (trustlist_status_handler): Check error, not out_of_core.
(gpgme_op_trustlist_start): Don't clear out_of_core.
(gpgme_op_trustlist_next): Check error, not out_of_core.
(gpgme_op_trustlist_end): Likewise.
* ops.h (test_and_allocate_result): New macro.
(_gpgme_passphrase_result): Remove prototype.
* delete.c (gpgme_op_delete): Return error from context.
(delete_status_handler): Use macro test_and_allocate_result.
Perform error checking at EOF.
(gpgme_op_delete_start): Release result.
* passphrase.c (_gpgme_passphrase_status_handler): Use macro
test_and_allocate_result, and perform error checking here.
(_gpgme_passphrase_result): Function removed.
* sign.c (gpgme_op_sign_start): Do not set out_of_core to zero.
(gpgme_op_sign): Just return the error value from the context.
(sign_status_handler): Only progress if no error is set yet. If
we process an EOF, set the resulting error value (if any).
* decrypt.c (_gpgme_decrypt_result): Function removed.
(create_result_struct): Function removed.
(_gpgme_decrypt_status_handler): Use macro test_and_allocate_result,
caclulate error on EOF, do not progress with errors.
(_gpgme_decrypt_start): Do not set out_of_core to zero.
(gpgme_op_decrypt): Just return the error value from the context.
* encrypt.c (encrypt_status_handler): Perform the error checking
here.
(gpgme_op_encrypt_start): Do not clear out_of_core.
* export.c (export_status_handler): Return if error is set in context.
(gpgme_op_export_start): Release result.
(gpgme_op_export): Return error from context.
* decrypt-verify.c (gpgme_op_decrypt_verify): Return the error in
the context.
* genkey.c (genkey_status_handler): Use macro
test_and_allocate_result. Perform error checking at EOF.
(gpgme_op_genkey): Just return the error from context.
* import.c (gpgme_op_import): Return the error from context.
(import_status_handler): Use macro test_and_allocate_result.
* keylist.c (gpgme_op_keylist_start): Do not clear out_of_core.
(gpgme_op_keylist_next): Return error of context.
(keylist_colon_handler): Set error instead out_of_code.
(finish_key): Likewise.
* context.h: Remove member out_of_core, add member error.
* gpgme.c (_gpgme_release_result): Clear error flag.
* engine.h (_gpgme_engine_get_error): New prototype.
* engine.c (_gpgme_engine_get_error): New function.
* engine-gpgsm.c (_gpgme_gpgsm_get_error): New function.
* engine-gpgsm.c (map_assuan_error): New function.
(gpgsm_assuan_simple_command): Change return type to GpgmeError,
use the new function to map error values.
(gpgsm_set_fd): Change return type tp GpgmeError.
(_gpgme_gpgsm_op_decrypt): Change type of ERR to GpgmeError.
(gpgsm_set_recipients): Likewise. Change type of return value
equivalently. Adjust error values.
(_gpgme_gpgsm_op_import): Likewise.
(_gpgme_gpgsm_op_sign): Likewise.
(struct gpgsm_object_s): New member error.
(gpgsm_status_handler): Set error if error occurs. Determine
error number from ERR line received. If assuan_read_line fails,
terminate the connection.
2002-02-01 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (MOSTLYCLEANFILES): New variable.
2002-02-01 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_status_handler): At error, terminate the
connection to the server.
2002-01-31 Marcus Brinkmann <marcus@g10code.de>
* rungpg.h: Add STATUS_KEY_CREATED.
* progress.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add progress.c.
* genkey.c (genkey_status_handler): Use
_gpgme_progress_status_handler. Add check for status.
(struct genkey_result_s): New structure.
(_gpgme_release_genkey_result): New function.
(gpgme_op_genkey): Check for error.
* gpgme.c (_gpgme_release_result): Call
_gpgme_release_genkey_result.
* ops.h (_gpgme_release_genkey_result): Add prototype.
* types.h (GenKeyResult): New type.
* context.h (gpgme_context_s): Add GenKeyResult to member result.
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (_gpgme_release_result): Call
_gpgme_release_delete_result.
* ops.h (_gpgme_release_delete_result): Add prototype.
* types.h (DeleteResult): New type.
* context.h (gpgme_context_s): Add DeleteResult to member result.
* delete.c (enum delete_problem): New type.
(struct delete_result_s): New structure.
(_gpgme_release_delete_result): New function.
(delete_status_handler): Implement more status codes.
(gpgme_op_delete): Return error on failure.
* import.c (MAX_IMPORTED_FIELDS): Bump up to 14.
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
* import.c (struct import_result_s): New structure.
(_gpgme_release_import_result): New function.
(append_xml_impinfo): Likewise.
(import_status_handler): Implement.
* gpgme.c (_gpgme_release_result): Add call to
_gpgme_release_import_result.
* ops.h (_gpgme_release_import_result): Add prototype.
* types.h (ImportResult): New type.
* context.h (gpgme_context_s): Add ImportResult to member result.
* encrypt.c (gpgme_op_encrypt): Code clean up.
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Add lots of comment and fix the formatting. Add
gpgme_trustlist_end prototype.
2002-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Add new type GpgmeIdleFunc. Change type of
gpgme_register_idle to return and accept this type.
* wait.c (gpgme_register_idle): Fix type.
Save and return old value of idle_function.
2002-01-29 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Implement secret only mode.
* keylist.c (keylist_colon_handler): Add support for the new "crs"
record type.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_release): Call assuan_disconnect,
not assuan_pipe_disconnect.
* Makefile.am (libgpgme_la_LIBADD): Change to link assuan and
jnlib (needed by assuan) statically into libgpgme. Linking a
static library into a shared library this way is not portable.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePassphraseCb): Change type of R_HD from void* to
void**.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* data.c (gpgme_data_new_from_filepart): Change type of LENGTH
from off_t to size_t.
* gpgme.h: Likewise.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* wait.c (_gpgme_wait_on_condition): If the process finished,
reset the pending flag. Also if the operation was cancelled.
(struct proc_s): Rename READY to DONE.
(wait_item_s): Likewise.
(set_process_ready): Rename to ...
(set_process_done): ... this.
(_gpgme_remove_proc_from_wait_queue): Call set_process_done
instead set_process_ready.
(_gpgme_wait_on_condition): Likewise.
(do_select): Rename READY to DONE.
* verify.c (gpgme_op_verify): Do not set pending to zero here.
* sign.c (gpgme_op_sign): Likewise.
* import.c (gpgme_op_import): Likewise.
* genkey.c (gpgme_op_genkey): Likewise.
* export.c (gpgme_op_export): Likewise.
* encrypt.c (gpgme_op_encrypt): Likewise.
* delete.c (gpgme_op_delete): Likewise.
* decrypt-verify.c (gpgme_op_decrypt_verify): Likewise.
* decrypt.c (gpgme_op_decrypt): Likewise.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* export.c: Cleanup.
2002-01-15 Marcus Brinkmann <marcus@g10code.de>
* trustlist.c: Various source clean ups.
(my_isdigit): Removed.
(gpgme_op_trustlist_end): New function.
2002-01-13 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c: Various source clean ups, like renaming C to CTX where
appropriate.
(gpgme_new): Clear R_CTX before starting the work.
(my_isdigit): Removed.
(my_isxdigit): Likewise.
* data.c: Various source clean ups.
(gpgme_data_new_from_mem): Check BUFFER after clearing R_DH.
(gpgme_data_new_with_read_cb): Similar for READ_CB.
(gpgme_data_new_from_file): Loop over fread while EINTR.
(gpgme_data_new_from_filepart): Rediddled a bit. Allow LENGTH to
be zero. Loop over fread while EINTR.
(my_isdigit): Removed.
(my_isxdigit): Likewise.
2001-12-21 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_new): Replace General_Error with
Pipe_Error where appropriate.
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
* engine.c: Include `string.h'. Reported by Stéphane Corthésy.
* version.c (get_engine_info): Remove prototype.
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_new): New variable CHILD_FDS.
Fill it with the servers fds, and pass it to assuan_pipe_connect.
2001-12-18 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_op_keylist_end): New function.
* gpgme.h (gpgme_op_keylist_end): New prototype.
* engine.h (gpgme_engine_check_version): Move prototype to ...
* gpgme.h (gpgme_engine_check_version): ... here.
* genkey.c (gpgme_op_genkey_start): Remove unused variable.
2001-12-18 Marcus Brinkmann <marcus@g10code.de>
* version.c (gpgme_get_engine_info): Reimplemented.
(gpgme_check_engine): Reimplemented.
(_gpgme_compare_versions): Return NULL if MY_VERSION is NULL.
* engine.c: Include `io.h'.
(gpgme_engine_get_info): New function.
* engine.h (gpgme_engine_check_version, _gpgme_engine_get_info):
Add prototype.
2001-12-18 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (struct reap_s, reap_list, reap_list_lock): Moved to ...
* engine.c (struct reap_s, reap_list, reap_list_lock): ... here.
Include `time.h', `sys/types.h', `assert.h', and `sema.h'.
* rungpg.c (_gpgme_engine_add_child_to_reap_list): New function.
(do_reaping, _gpgme_gpg_housecleaning): Moved to ...
* engine.c (do_reaping, _gpgme_engine_housecleaning): ... here.
* rungpg.c (_gpgme_gpg_release): Replace code that is now in its
own function by call to _gpgme_engine_add_child_to_reap_list().
* wait.c: Include `engine.h'.
(run_idle): Call _gpgme_engine_housecleaning(), not
_gpgme_gpg_housecleaning().
2001-12-18 Marcus Brinkmann <marcus@g10code.de>
* key.c (_gpgme_key_append_name): Append, not prepend, the uid.
Initialize the next field of the uid structure.
(gpgme_key_get_as_xml): Do not list last uid first.
2001-12-17 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_set_colon_line_handler): New
function [!ENABLE_GPGSM].
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_verify): Put TEXT into
message_data, not SIG.
(_gpgme_gpgsm_op_sign): Use `--detached', not `--detach'.
* sign.c (sign_status_handler): Call
_gpgme_passphrase_status_handler early.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c: Revert last change.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_status_handler): Freeze the output file
handler when ending this operation, otherwise the wait function
will sit on it.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (struct gpgsm_object_s): New member colon.attic.
(_gpgme_gpgsm_new): Initialize some more members.
(_gpgme_gpgsm_release): Free the colon line handler's attic line.
(gpgsm_status_handler): Rework the inline-data processing.
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_spawn): Do not add the fds to the child
list that are not dup'ed, for those the close-on-exec flag is set
now.
* version.c (_gpgme_get_program_version): Remove first entry in
CFD, as the close-on-exec flag is now set for this fd.
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_encrypt): Do not add `armor'
option to `ENCRYPT'.
* engine-gpgsm.c (gpgsm_set_recipients): Free LINE when returning
successfully.
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (close_notify_handler): New function.
(_gpgme_gpgsm_new): Manage the file descriptors a
bit differently. Do not set close-on-exec flags.
(_gpgme_gpgsm_op_decrypt): Do not set message_fd
to -1, this is done by the close handler.
(_gpgme_gpgsm_op_encrypt): Likewise.
(_gpgme_gpgsm_op_import): Likewise (also for output_fd).
(_gpgme_gpgsm_op_keylist): Likewise (also for input_fd and output_fd).
(_gpgme_gpgsm_op_sign): Likewise.
(_gpgme_gpgsm_op_verify): Likewise, but for output_fd.
* posix-io.c (_gpgme_io_pipe): Set the close-on-exec flag for the
non-inherited file descriptor index of the pipe.
2001-12-13 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (_gpgme_gpgsm_set_colon_line_handler): New.
(gpgsm_status_handler): Pass datalines to a colon handler
* engine.c (_gpgme_engine_set_colon_line_handler): Set the colon
handler for gpgsm.
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Allow NULL for
pattern.
(gpgsm_assuan_simple_command): Removed underscore from
assuan_write_line.
(_gpgme_gpgsm_start): Ditto.
(gpgsm_assuan_simple_command): Replaced interal Assuan read
function by the new assuan_read_line. Removed the use of the
internal header.
(gpgsm_status_handler): Ditto. Use the new assuan_pending_line.
(_gpgme_gpgsm_start): Use the documented way to get an fd from
assuan.
* keylist.c (keylist_colon_handler): Handle "crt" records
* key.h (gpgme_key_s): Add an x509 flag.
* key.c (parse_x509_user_id): New.
(_gpgme_key_append_name): Handle x.509 names.
2001-12-05 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_status_handler): Make it work with current
version of assuan.
2001-12-05 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_set_fd): Accept one more argument OPT.
(_gpgme_gpgsm_op_encrypt): Pass armor argument to gpgsm_set_fd for
output descriptor.
(_gpgme_gpgsm_op_sign): Likewise.
2001-12-05 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_op_keylist_next): Set pending to 0 if EOF
occurs.
2001-11-26 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_sign): Fix stupid typo.
2001-11-24 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_status_handler): Don't break if bsearch fails.
Deal with assuan read line returning more than one line (for now).
2001-11-23 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_sign): Implement it according to
the current protocol definition.
2001-11-23 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_new): Set CLOEXEC flag for parent
ends of the pipe.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c: Include stdlib.h and string.h. Also include,
for now, rungpg.h and status-table.h.
(gpgsm_status_handler): Implement more of the status handler.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* engine.c (_gpgme_engine_op_decrypt): Implement CMS case.
(_gpgme_engine_op_delete): Likewise.
(_gpgme_engine_op_encrypt): Likewise.
(_gpgme_engine_op_export): Likewise.
(_gpgme_engine_op_genkey): Likewise.
(_gpgme_engine_op_keylist): Likewise.
(_gpgme_engine_op_sign): Likewise.
(_gpgme_engine_op_trustlist): Likewise.
* engine-gpgsm.c (_gpgme_gpgsm_op_encrypt): New function.
(gpgsm_assuan_simple_command): Likewise.
(gpgsm_set_recipients): Likewise.
(gpgsm_set_fd): Reimplement using gpgsm_assuan_simple_command.
(_gpgme_gpgsm_op_delete): New function.
(_gpgme_gpgsm_op_export): Likewise.
(_gpgme_gpgsm_op_genkey): Likewise.
(_gpgme_gpgsm_op_sign): Likewise.
(_gpgme_gpgsm_op_keylist): Likewise.
(_gpgme_gpgsm_op_trustlist): Likewise.
(_gpgme_gpgsm_release): Release command.
(_gpgme_gpgsm_op_decrypt): Allocate command.
(_gpgme_gpgsm_op_import): Likewise.
(gpgsm_status_handler): Also treat `ERR' strings as EOF.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_set_protocol): New prototype.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_decrypt): New function.
(_gpgme_gpgsm_op_import): Likewise.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c: Shuffle around header inclusion a bit, to still
keep them seperate.
(_gpgme_set_status_handler) [!ENABLE_GPGSM]: New function.
2001-11-22 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c: Include more headers so that NULL and mk_error
is defined even with an undefined GPGSM_PATH.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_inbound_handler, write_mem_data, write_cb_data,
gpg_outbound_handler): Moved to ...
* data.c (_gpgme_data_inbound_handler, write_mem_data,
write_cb_data, _gpgme_data_outbound_handler): ... here. Make the
_gpgme_* ones non-static.
* data.c: Include io.h.
* ops.h (_gpgme_data_inbound_handler): New prototype.
(_gpgme_data_outbound_handler): Likewise.
(_gpgme_gpg_spawn): Use these new functions.
* engine-gpgsm.h (_gpgme_gpgsm_op_decrypt, _gpgme_gpgsm_op_delete,
_gpgme_gpgsm_op_encrypt, _gpgme_gpgsm_op_export,
_gpgme_gpgsm_op_genkey, _gpgme_gpgsm_op_import,
_gpgme_gpgsm_op_keylist, _gpgme_gpgsm_op_sign,
_gpgme_gpgsm_op_trustlist, _gpgme_gpgsm_op_verify,
_gpgme_gpgsm_start, _gpgme_gpgsm_set_status_handler): New prototype.
Include <rungpg.h> for status handler function.
* engine-gpgsm.c (struct gpgsm_object_s): New members input_fd,
input_data, output_fd, output_data, message_fd, message_data, command
and status.
(_gpgme_gpgsm_new): Open input, output and message pipes before
connecting to the client. Close server's ends afterwards.
(_gpgme_gpgsm_release): Close open file descriptors. Remove
server process from wait queue.
(_gpgme_gpgsm_op_verify, _gpgme_gpgsm_start,
_gpgme_gpgsm_set_status_handler, gpgms_status_handler): New function.
* engine.c (_gpgme_engine_start): Implement for GPGME_PROTOCOL_CMS.
(_gpgme_engine_set_status_handler): Likewise.
(_gpgme_engine_op_verify): Likewise.
2001-11-21 Marcus Brinkmann <marcus@g10code.de>
* context.h: Do not include rungpg.h, but engine.h.
(struct gpgme_context_s): Replace member gpg with engine.
* gpgme.c (gpgme_release): Release engine, not gpg.
* recipient.c (_gpgme_append_gpg_args_from_recifgpients): Function
moved ...
* rungpg.c (_gpgme_append_gpg_args_from_recipients): ... here.
Make static, change order of arguments, and return an error value.
* ops.h (_gpgme_append_gpg_args_from_recipients): Removed prototype.
* rungpg.h (_gpgme_gpg_op_verify): Add prototype.
(_gpgme_gpg_op_encrypt): Likewise.
(_gpgme_gpg_op_decrypt): Likewise.
(_gpgme_gpg_op_delete): Likewise.
(_gpgme_gpg_op_export): Likewise.
(_gpgme_gpg_op_genkey): Likewise.
(_gpgme_gpg_op_import): Likewise.
(_gpgme_gpg_op_keylist): Likewise.
(_gpgme_gpg_op_sign): Likewise.
(_gpgme_gpg_op_trustlist): Likewise.
* rungpg.c (_gpgme_gpg_op_verify): New function.
(_gpgme_gpg_op_encrypt): Likewise.
(_gpgme_gpg_op_decrypt): Likewise.
(_gpgme_gpg_op_delete): Likewise.
(_gpgme_gpg_op_export): Likewise.
(_gpgme_gpg_op_genkey): Likewise.
(_gpgme_gpg_op_import): Likewise.
(_gpgme_gpg_op_keylist): Likewise.
(_gpgme_gpg_op_sign): Likewise.
(_gpgme_gpg_op_trustlist): Likewise.
* engine.h (_gpgme_engine_set_status_handler): Add prototype.
(_gpgme_engine_set_command_handler): Likewise.
(_gpgme_engine_set_colon_line_handler): Likewise.
(_gpgme_engine_op_decrypt): Likewise.
(_gpgme_engine_op_delete): Likewise.
(_gpgme_engine_op_encrypt): Likewise.
(_gpgme_engine_op_export): Likewise.
(_gpgme_engine_op_genkey): Likewise.
(_gpgme_engine_op_import): Likewise.
(_gpgme_engine_op_keylist): Likewise.
(_gpgme_engine_op_sign): Likewise.
(_gpgme_engine_op_trustlist): Likewise.
(_gpgme_engine_op_verify): Likewise.
(_gpgme_engine_start): Likewise.
* engine.c (_gpgme_engine_set_status_handler): New function.
(_gpgme_engine_set_command_handler): Likewise.
(_gpgme_engine_set_colon_line_handler): Likewise.
(_gpgme_engine_op_decrypt): Likewise.
(_gpgme_engine_op_delete): Likewise.
(_gpgme_engine_op_encrypt): Likewise.
(_gpgme_engine_op_export): Likewise.
(_gpgme_engine_op_genkey): Likewise.
(_gpgme_engine_op_import): Likewise.
(_gpgme_engine_op_keylist): Likewise.
(_gpgme_engine_op_sign): Likewise.
(_gpgme_engine_op_trustlist): Likewise.
(_gpgme_engine_op_verify): Likewise.
(_gpgme_engine_start): Likewise.
* verify.c (gpgme_op_verify_start): Reimplement in terms of above
functions.
* encrypt.c (gpgme_op_encrypt_start): Likewise.
* decrypt.c (_gpgme_decrypt_start): Likewise.
* passphrase.c (_gpgme_passphrase_start): Likewise.
* keylist.c (gpgme_op_keylist_start): Likewise.
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* types.h: Add types EngineObject and GpgsmObject.
* Makefile.am (libgpgme_la_SOURCES): Add engine-gpgsm.h,
engine-gpgsm.c, engine.h and engine.c.
* engine.h: New file.
* engine.c: Likewise.
* engine-gpgsm.h: Likewise.
* engine-gpgsm.c: Likewise.
* rungpg.c (_gpgme_gpg_get_version): New function.
(_gpgme_gpg_check_version): Likewise.
* rungpg.h: Add prototypes for _gpgme_gpg_get_version and
_gpgme_gpg_check_version.
* version.c (compare_versions): Rename to ...
(_gpgme_compare_versions): ... this. Make non-static.
(gpgme_check_version): Use _gpgme_compare_versions rather than
compare_versions.
(gpgme_check_engine): Likewise.
* ops.h (_gpgme_get_program_version): Add prototype.
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (libgpgme_la_INCLUDES): Remove obsolete directive.
(AM_CPPFLAGS): New directive [BUILD_ASSUAN].
(libgpgme_la_LIBADD): Likewise.
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
* version.c: Remove global variables lineno and
tmp_engine_version.
(version_handler): Removed.
(_gpgme_get_program_version): New function.
(get_engine_info): Don't use context and version_handler,
but _gpgme_get_program_version.
* ops.h (_gpgme_get_program_version): Add prototype for
_gpgme_get_program_version (we expect to use it elsewhere soon).
2001-11-18 Marcus Brinkmann <marcus@g10code.de>
* version.c (get_engine_info): If GnuPG is not available, return
an error message.
* posix-util.c (_gpgme_get_gpg_path): Allow GPG_PATH to be
undefined.
(_gpgme_get_gpgsm_path): New function.
* w32-util.c (find_program_in_registry): New static function.
(_gpgme_get_gpg_path): Allow GPG_PATH to be undefined. Rework
to use find_program_in_registry.
(_gpgme_get_gpgsm_path): New function.
(util.h): Prototype _gpgme_get_gpgsm_path).
* rungpg.c (_gpgme_gpg_spawn): Verify that _gpgme_get_gpg_path()
returns non-null.
2001-11-16 Marcus Brinkmann <marcus@g10code.de>
* decrypt-verify.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add decrypt-verify.c.
* types.h: Add decrypt-verify types.
* ops.h: Likewise.
* context.h: Add result type for decrypt-verify.
* gpgme.h: Add decrypt-verify prototypes.
* decrypt.c (decrypt_status_handler): Renamed to ...
(_gpgme_decrypt_status_handler): ... this. Make non-static.
(_gpgme_decrypt_start): New function, derived from
gpgme_op_decrypt_start.
(gpgme_op_decrypt_start): Reimplement in terms of
_gpgme_decrypt_start.
(_gpgme_decrypt_result): New function to retrieve error value.
(gpgme_op_decrypt): Use _gpgme_decrypt_result.
* ops.h: Add prototypes for new functions.
* verify.c (verify_status_handler): Renamed to ...
(_gpgme_verify_status_handler): ... this. Make non-static.
(gpgme_op_verify_start): Use new function name.
(intersect_stati): Renamed to ...
(_gpgme_intersect_stati): ... this. Make non-static.
(gpgme_op_verify): Use new name.
* ops.h: Add prototypes for new functions.
2001-11-16 Marcus Brinkmann <marcus@g10code.de>
* passphrase.c: New file.
* Makefile.am (libgpgme_la_SOURCES): Add passphrase.c.
* ops.h (_gpgme_passphrase_result): Add prototypes from
passphrase.c.
* types.h: Likewise.
* context.h: Add member passphrase to result.
* gpgme.c (_gpgme_release_result): Release passphrase member.
* decrypt.c: Some formatting and variable name changes (like
CTX instead C).
(struct decrypt_result_s): Remove members now found in
passphrase result.
(_gpgme_release_decrypt_result): Don't release removed members.
(decrypt_status_handler): Call _gpgme_passphrase_status_handler,
and don't handle the cases catched there.
(command_handler): Removed.
(gpgme_op_decrypt_start): Don't set command handler, but invoke
_gpgme_passphrase_start which does it.
(gpgme_op_decrypt): Invoke _gpgme_passphrase_result and drop the
cases covered by it.
* sign.c Some formatting and variable name changes (like
CTX instead C).
(struct sign_result_s): Remove members now found in
passphrase result.
(_gpgme_release_sign_result): Don't release removed members.
(sign_status_handler): Call _gpgme_passphrase_status_handler,
and don't handle the cases catched there.
(command_handler): Removed.
(gpgme_op_sign_start): Don't set command handler, but invoke
_gpgme_passphrase_start which does it.
(gpgme_op_sign): Invoke _gpgme_passphrase_result and drop the
cases covered by it.
2001-11-15 Marcus Brinkmann <marcus@g10code.de>
* decrypt.c (command_handler): Fix last change.
2001-11-15 Marcus Brinkmann <marcus@g10code.de>
* verify.c (_gpgme_release_verify_result): Rename RES to RESULT.
Rename R2 to NEXT_RESULT.
(intersect_stati): Rename RES to RESULT.
(gpgme_get_sig_status): Likewise. Do not check return_type, but
the member verify of result.
(gpgme_get_sig_key): Likewise.
* sign.c (_gpgme_release_sign_result): Rename RES to RESULT. If
RESULT is zero, return.
(sign_status_handler, command_handler): Do not check return_type,
but the member sign of result.
(gpgme_op_sign): Likewise. Drop assertion.
* encrypt.c (_gpgme_release_encrypt_result): Rename RES to RESULT.
If RESULT is zero, return.
(encrypt_status_handler): Do not check return_type, but the member
encrypt of result.
(gpgme_op_encrypt): Likewise. Drop assertion.
* decrypt.c (_gpgme_release_decrypt_result): Rename RES to RESULT.
(create_result_struct): Do not set result_type.
(command_handler, decrypt_status_handler): Do not check
return_type, but the member decrypt of result.
(gpgme_op_decrypt): Likewise. Drop assertion.
* context.h (enum ResultType): Removed.
(struct gpgme_context_s): Remove member result_type.
(struct result): Replaces union result.
* gpgme.c: Include string.h.
(_gpgme_release_result): Release all members of c->result, which
is now a struct. Zero out all members of the struct afterwards.
2001-11-11 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_release): Release GPG->cmd.cb_data.
Release all members of the list GPG->arglist.
Reported by Michael Schmidt <mschmidt@cs.uni-sb.de>.
2001-11-02 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (pipemode_copy): Change type of NBYTES to size_t.
* key.c: Include string.h.
* data.c: Likewise.
* recipient.c: Likewise.
2001-10-29 Marcus Brinkmann <marcus@g10code.de>
* context.h: New member signers_len.
* signers.c (gpgme_signers_clear): Require that signers are
non-NULL with assertion. Use signers_len to determine how much
keys to release. Add documentation.
(gpgme_signers_add): Use signers_len to determine if the buffer is
large enough. Use xtryrealloc rather than xtrymalloc and copying.
Add documentation.
(gpgme_signers_enum): Use signers_len to determine if key is
available. Add documentation.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* data.c (_gpgme_data_append): Check if LENGTH is smaller than
ALLOC_CHUNK, not DH->length.
2001-10-17 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (gpgme_set_protocol): Fix last change.
2001-10-15 Werner Koch <wk@gnupg.org>
* gpgme.h (GpgmeProtocol): New.
* gpgme.c (gpgme_set_protocol): New.
2001-09-26 Werner Koch <wk@gnupg.org>
* gpgme.c (gpgme_set_passphrase_cb): Ignore a NULL context.
(gpgme_set_progress_cb): Ditto. Suggested by Mark Mutz.
2001-09-17 Werner Koch <wk@gnupg.org>
* keylist.c (finish_key): Shortcut for no tmp_key. Changed all
callers to use this function without a check for tmp_key.
* keylist.c (gpgme_op_keylist_next): Reset the key_cond after
emptying the queue. Bug reported by Stéphane Corthésy.
2001-09-12 Werner Koch <wk@gnupg.org>
* data.c (gpgme_data_rewind): Allow rewind for callbacks.
2001-09-07 Werner Koch <wk@gnupg.org>
* rungpg.h: Add NO_RECP.
* encrypt.c (encrypt_status_handler): Take on No_RECP.
(gpgme_op_encrypt): Better error return.
* verify.c (verify_status_handler): Take on NODATA.
2001-09-03 Werner Koch <wk@gnupg.org>
* rungpg.h: Added STATUS_INV_RECP.
* gpgme.c (_gpgme_release_result): Add support for new
EncryptResult object.
* encrypt.c (append_xml_encinfo): New.
(encrypt_status_handler): Add some status parsing.
(_gpgme_release_encrypt_result): New.
2001-08-29 Werner Koch <wk@gnupg.org>
* recipient.c (gpgme_recipients_release): Free the list. By Timo.
* keylist.c (keylist_colon_handler): Do a finish key if we receive
an EOF here. This is probably the reason for a lot of bugs
related to keylisting. It is so obvious. Kudos to Enno Cramer
for pointing that out.
2001-08-28 Werner Koch <wk@gnupg.org>
* gpgme.c, gpgme.h (gpgme_get_op_info): New.
(_gpgme_set_op_info): New.
(_gpgme_release_result): Reset the op_info here.
* sign.c (append_xml_siginfo): New.
(sign_status_handler): Store the sig create information.
2001-07-31 Werner Koch <wk@gnupg.org>
* encrypt.c (gpgme_op_encrypt): Hack to detect no valid recipients.
2001-07-30 Werner Koch <wk@gnupg.org>
* gpgme.c (gpgme_get_armor,gpgme_get_textmode): New.
* rungpg.c (build_argv): Disable armor comments
* w32-io.c (build_commandline): Need to add quotes here
2001-07-24 Werner Koch <wk@gnupg.org>
* data.c (gpgme_data_read): Add a a way to return the available bytes.
2001-07-23 Werner Koch <wk@gnupg.org>
* util.c: Removed stpcpy() because we use the version from jnlib.
2001-07-19 Werner Koch <wk@gnupg.org>
* mkstatus: Define the collating sequence for sort.
2001-06-26 Werner Koch <wk@gnupg.org>
* rungpg.h: Add STATUS_UNEXPECTED as suggested by Timo.
2001-06-15 Werner Koch <wk@gnupg.org>
* keylist.c (set_userid_flags): Fixed the assigned values. Kudos
to Timo for pointing this out.
2001-06-01 Werner Koch <wk@gnupg.org>
* debug.c (_gpgme_debug_begin): Fixed a /tmp race. Noted by
Johannes Poehlmann.
2001-05-28 Werner Koch <wk@gnupg.org>
* version.c (gpgme_check_engine): Stop version number parsing at
the opening angle and not the closing one. By Tommy Reynolds.
2001-05-01 José Carlos García Sogo <jose@jaimedelamo.eu.org>
* encrypt.c (gpgme_op_encrypt_start): Deleted the assert ( !c->gpg )
line, because it gave an error if another operation had been made
before using the same context.
* decrypt.c (gpgme_op_decrypt_start): The same as above. Also added
one line to release the gpg object in the context (if any).
2001-04-26 Werner Koch <wk@gnupg.org>
* key.c, key.h (_gpgme_key_cache_init): New.
(_gpgme_key_cache_add): New.
(_gpgme_key_cache_get): New.
* version.c (do_subsystem_inits): Init the cache.
* keylist.c (finish_key): Put key into the cache
* verify.c (gpgme_get_sig_key): First look into the cache.
2001-04-19 Werner Koch <wk@gnupg.org>
* keylist.c (parse_timestamp): Adjusted for the changed
--fixed-list-mode of gpg 1.0.4h.
2001-04-05 Werner Koch <wk@gnupg.org>
* verify.c (gpgme_op_verify_start): Enabled pipemode for detached sigs.
2001-04-04 Werner Koch <wk@gnupg.org>
* w32-io.c (_gpgme_io_select): Don't select on the writer if there
are still bytes pending. Timo found this not easy to track down
race condition.
2001-04-02 Werner Koch <wk@gnupg.org>
* gpgme.h: Add GPGME_ATTR_KEY_{EXPIRED,DISABLED}.
* key.c (gpgme_key_get_ulong_attr): And return those attribs.
* verify.c (gpgme_get_sig_key): Set keyliosting mode depending on
the mode set in the current context. Suggested by Timo.
* key.c (gpgme_key_get_ulong_attr): Return can_certify and not
can_encrypt. By Timo.
2001-03-30 Werner Koch <wk@gnupg.org>
* debug.c (debug_init): Allow to specify a debug file.
(_gpgme_debug_level): New.
* posix-io.c (_gpgme_io_read, _gpgme_io_write): Print output.
(_gpgme_io_select): Debug only with level > 2.
2001-03-15 Werner Koch <wk@gnupg.org>
* rungpg.c: Included time.h.
* key.h: New keyflags for capabilities.
* keylist.c (set_mainkey_capability, set_subkey_capability): New.
(keylist_colon_handler): Parse them.
* gpgme.h: New attribute values for capabilties.
* key.c (gpgme_key_get_string_attr): Return them.
(capabilities_to_string): New.
(gpgme_key_get_ulong_attr): Return the global caps.
2001-03-14 Werner Koch <wk@gnupg.org>
* w32-io.c (destroy_reader,destroy_writer): Fixed syntax error.
Thanks to Jan Oliver Wagner.
2001-03-13 Werner Koch <wk@gnupg.org>
* context.h: Add invalid and revoke flags to user_id structure.
* keylist.c (gpgme_op_keylist_start): Use --fixed-list-mode.
(keylist_colon_handler): Adjust for that.
(set_userid_flags): New.
(set_mainkey_trust_info): Handle new key invalid flag
(set_subkey_trust_info): Ditto.
* gpgme.h: Add new attributes for key and user ID flags.
* key.c (_gpgme_key_append_name): Init these flags
(gpgme_key_get_as_xml): Print them.
(one_uid_as_xml): New helper for above.
(gpgme_key_get_string_attr, gpgme_key_get_ulong_attr):
Return the new attributes. Enhanced, so that subkey information
can be returned now.
2001-02-28 Werner Koch <wk@gnupg.org>
* w32-io.c (destroy_reader): Set stop_me flag.
(writer,create_writer,destroy_writer,find_writer,kill_writer): New.
(_gpgme_io_write): Use a writer thread to avaoid blocking.
(_gpgme_io_close): Cleanup a writer thread
(_gpgme_io_select): Repalce tthe faked wait on writing by a real
waiting which is now possible due to the use of a writer thread.
2001-02-20 Werner Koch <wk@gnupg.org>
* w32-io.c (destroy_reader,kill_reader): New.
(create_reader, reader): Add a new event to stop the thread.
(_gpgme_io_close): Kill the reader thread.
* posix-io.c (_gpgme_io_select): Handle frozen fds here.
* 32-io.c (_gpgme_io_select): Ditto. Removed a bunch of unused code.
* wait.c: Reworked the whole thing.
* rungpg.c (_gpgme_gpg_new): Init pid to -1.
(_gpgme_gpg_release): Remove the process from the wait queue.
2001-02-19 Werner Koch <wk@gnupg.org>
* w32-io.c (_gpgme_io_set_close_notify): New.
(_gpgme_io_close): Do the notification.
* posix-io.c (_gpgme_io_select): Use a 1 sec timeout and not 200
microseconds.
* wait.c (remove_process): Don't close the fd here.
(do_select): Set the fd to -1 and remove the is_closed flag everywhere.
(_gpgme_wait_on_condition): Remove the assert on the queue and
break out if we could not find the queue. The whole thing should
be reworked.
* posix-io.c (_gpgme_io_set_close_notify): New.
(_gpgme_io_close): Do the notification.
* rungpg.c (close_notify_handler): New.
(_gpgme_gpg_new): Register a callback for the fd.
(_gpgme_gpg_set_colon_line_handler): Ditto.
(build_argv): Ditto
2001-02-13 Werner Koch <wk@gnupg.org>
* rungpg.c (struct reap_s): Replaced pid_t by int.
* types.h: Add ulong typedef.
* rungpg.c (do_reaping,_gpgme_gpg_housecleaning): New.
(_gpgme_gpg_release): Reap children.
* io.h, posix-io.c (_gpgme_io_kill): New.
* w32-io.c (_gpgme_io_kill): New (dummy).
* keylist.c (gpgme_op_keylist_start): Cancel a pending request.
* posix-io.c (_gpgme_io_read): Add some debug output.
(_gpgme_io_write): Ditto.
(_gpgme_io_select): Increased the timeout.
2001-02-12 Werner Koch <wk@gnupg.org>
Enhanced the signature verification, so that it can how handle
more than one signature and is able to return more information on
the signatures.
* verify.c (gpgme_get_sig_key): New.
(gpgme_get_sig_status): New.
* gpgme.h: Add stdio.h.
(GpgmeSigStat): New status DIFF.
2001-02-01 Werner Koch <wk@gnupg.org>
* w32-io.c (set_synchronize): Add EVENT_MODIFY_STATE. Add Debug
code to all Set/ResetEvent().
* rungpg.c (read_status): Check for end of stream only if we have
an r. By Timo.
2001-01-31 Werner Koch <wk@gnupg.org>
* wait.c (_gpgme_wait_on_condition): Removed all exit code processing.
(propagate_term_results,clear_active_fds): Removed.
(count_active_fds): Renamed to ..
(count_active_and_thawed_fds): .. this and count only thawed fds.
* rungpg.c (gpg_colon_line_handler): Return colon.eof and not
status.eof ;-)
2001-01-30 Werner Koch <wk@gnupg.org>
* w32-io.c (_gpgme_io_spawn): Use the supplied path arg.
* version.c (get_engine_info): Return better error information.
* posix-util.c, w32-util.c: New.
(_gpgme_get_gpg_path): New, suggested by Jan-Oliver.
* rungpg.c (_gpgme_gpg_spawn): Use new function to get GPG's path.
* signers.c (gpgme_signers_add): Ooops, one should test code and
not just write it; the newarr was not assigned. Thanks to José
for pointing this out. Hmmm, still not tested, why shoudl a coder
test his fix :-)
* w32-io.c: Does now use reader threads, so that we can use
WaitForMultipleObjects.
* sema.h, posix-sema.c, w32-sema.c: Support for Critcial sections.
Does currently only work for W32.
* debug.c, util.h : New. Changed all fprintfs to use this new
set of debugging functions.
2001-01-23 Werner Koch <wk@gnupg.org>
* data.c (_gpgme_data_release_and_return_string): Fixed string
termination.
2001-01-22 Werner Koch <wk@gnupg.org>
* delete.c: New.
* signers.c: New.
* key.c (gpgme_key_ref, gpgme_key_unref): New.
* sign.c (gpgme_op_sign_start): Allow the use of other keys.
* version.c (gpgme_get_engine_info,gpgme_check_engine): New.
* rungpg.c (_gpgme_gpg_set_simple_line_handler): New.
2001-01-05 Werner Koch <wk@gnupg.org>
* data.c (gpgme_data_rewind): Allow to rewind data_type_none.
Copyright 2001,2002,2003,2004,2005,2006,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
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/gpgme/Makefile.am b/gpgme/Makefile.am
index f74dffef..bd0191ae 100644
--- a/gpgme/Makefile.am
+++ b/gpgme/Makefile.am
@@ -1,220 +1,227 @@
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
# Note: moc_kdpipeiodevice should actually be a dependcy below.
EXTRA_DIST = gpgme-config.in gpgme.m4 mkstatus libgpgme.vers \
versioninfo.rc.in gpgme.def moc_kdpipeiodevice.cpp
BUILT_SOURCES = status-table.h
MOSTLYCLEANFILES = status-table.h
bin_SCRIPTS = gpgme-config
m4datadir = $(datadir)/aclocal
m4data_DATA = gpgme.m4
include_HEADERS = gpgme.h
if HAVE_PTHREAD
ltlib_gpgme_pthread = libgpgme-pthread.la
else
ltlib_gpgme_pthread =
endif
if HAVE_PTH
ltlib_gpgme_pth = libgpgme-pth.la
else
ltlib_gpgme_pth =
endif
if BUILD_W32_GLIB
ltlib_gpgme_glib = libgpgme-glib.la
else
ltlib_gpgme_glib =
endif
if BUILD_W32_QT
ltlib_gpgme_qt = libgpgme-qt.la
else
ltlib_gpgme_qt =
endif
lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \
$(ltlib_gpgme_pthread) $(ltlib_gpgme_pth)
if HAVE_LD_VERSION_SCRIPT
libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers
else
libgpgme_version_script_cmd =
endif
if BUILD_ASSUAN
assuan_cppflags = -I$(top_srcdir)/assuan
assuan_libobjs = ../assuan/libassuan.la
else
assuan_cppflags =
assuan_libobjs =
endif
if HAVE_DOSISH_SYSTEM
system_components = w32-util.c w32-sema.c
system_components_not_extra = w32-io.c
else
system_components = ath.h posix-util.c posix-sema.c posix-io.c
system_components_not_extra =
endif
if HAVE_GPGSM
gpgsm_components = engine-gpgsm.c
else
gpgsm_components =
endif
+if HAVE_GPGCONF
+gpgconf_components = engine-gpgconf.c
+else
+gpgconf_components =
+endif
+
# These are the source files common to all library versions. We used
# to build a non-installed library for that, but that does not work
# correctly on all platforms (in particular, one can not specify the
# right linking order with libtool, as the non-installed version has
# unresolved symbols to the thread module.
main_sources = \
gpgme.h util.h conversion.c get-env.c context.h ops.h \
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
data-compat.c \
signers.c sig-notation.c \
wait.c wait-global.c wait-private.c wait-user.c wait.h \
op-support.c \
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 getauditlog.c \
engine.h engine-backend.h engine.c rungpg.c status-table.h \
- $(gpgsm_components) sema.h priv-io.h $(system_components) \
+ $(gpgsm_components) $(gpgconf_components) gpgconf.c \
+ sema.h priv-io.h $(system_components) \
debug.c debug.h gpgme.c version.c error.c
libgpgme_la_SOURCES = $(main_sources) \
ath.h ath.c $(system_components_not_extra)
libgpgme_pthread_la_SOURCES = $(main_sources) \
ath.h ath-pthread.c $(system_components_not_extra)
libgpgme_pth_la_SOURCES = $(main_sources) \
ath.h ath-pth.c $(system_components_not_extra)
if BUILD_W32_GLIB
libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c
endif
if BUILD_W32_QT
libgpgme_qt_la_SOURCES = $(main_sources) ath.h ath.c w32-qt-io.cpp \
kdpipeiodevice.h kdpipeiodevice.cpp kdpipeiodevice.moc
# FIXME: Add extra depedency: moc_kdpipeiodevice.cpp
# These are built sources (normally).
# moc_kdpipeiodevice.cpp: kdpipeiodevice.h
# $(MOC4) -o $@ $<
#
# kdpipeiodevice.moc: kdpipeiodevice.cpp
# $(MOC4) -o $@ $<
endif
# We use a global CFLAGS and CPPFLAGS setting for all library
# versions, because then every object file is only compiled once.
AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@ @PTH_CPPFLAGS@ \
@QT4_CORE_CFLAGS@
AM_CFLAGS = @PTH_CFLAGS@ @GLIB_CFLAGS@ @QT4_CORE_CFLAGS@
if HAVE_W32_SYSTEM
LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
`echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
SUFFIXES: .rc .lo
.rc.lo:
$(LTRCCOMPILE) -i $< -o $@
gpgme_res = versioninfo.lo
gpgme_res_ldflag = -Wl,.libs/versioninfo.o
no_undefined = -no-undefined
export_symbols = -export-symbols $(srcdir)/gpgme.def
install-def-file:
$(INSTALL) $(srcdir)/gpgme.def $(DESTDIR)$(libdir)/gpgme.def
uninstall-def-file:
-rm $(DESTDIR)$(libdir)/gpgme.def
gpgme_deps = $(gpgme_res) gpgme.def
else
gpgme_res =
gpgme_res_ldflag =
no_undefined =
export_symbols =
install-def-file:
uninstall-def-file:
gpgme_deps =
endif
libgpgme_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) $(export_symbols) \
$(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_la_DEPENDENCIES = $(assuan_libobjs) \
@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
libgpgme_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
@GPG_ERROR_LIBS@ @NETLIBS@
libgpgme_pthread_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_pthread_la_DEPENDENCIES = $(assuan_libobjs) \
@LTLIBOBJS@ $(srcdir)/libgpgme.vers
libgpgme_pthread_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
-lpthread @GPG_ERROR_LIBS@ @NETLIBS@
libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \
$(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_pth_la_DEPENDENCIES = $(assuan_libobjs) \
@LTLIBOBJS@ $(srcdir)/libgpgme.vers
libgpgme_pth_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
@PTH_LIBS@ @GPG_ERROR_LIBS@ @NETLIBS@
if BUILD_W32_GLIB
libgpgme_glib_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) \
$(export_symbols) $(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_glib_la_DEPENDENCIES = $(assuan_libobjs) \
@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
libgpgme_glib_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
@GPG_ERROR_LIBS@ @GLIB_LIBS@ @NETLIBS@
endif
if BUILD_W32_QT
libgpgme_qt_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) \
$(export_symbols) $(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_qt_la_DEPENDENCIES = $(assuan_libobjs) \
@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
libgpgme_qt_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
@GPG_ERROR_LIBS@ @QT4_CORE_LIBS@ @NETLIBS@
endif
status-table.h : gpgme.h
$(srcdir)/mkstatus < $(srcdir)/gpgme.h > status-table.h
install-data-local: install-def-file
uninstall-local: uninstall-def-file
diff --git a/gpgme/engine-backend.h b/gpgme/engine-backend.h
index f1b4dc00..2e2ef5ec 100644
--- a/gpgme/engine-backend.h
+++ b/gpgme/engine-backend.h
@@ -1,112 +1,118 @@
/* engine-backend.h - A crypto backend for the engine interface.
Copyright (C) 2002, 2003, 2004 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef ENGINE_BACKEND_H
#define ENGINE_BACKEND_H
#include "engine.h"
/* FIXME: Correct check? */
#ifdef GPGSM_PATH
#define ENABLE_GPGSM 1
#endif
struct engine_ops
{
/* Static functions. */
/* Return the default file name for the binary of this engine. */
const char *(*get_file_name) (void);
/* Returns a malloced string containing the version of the engine
with the given binary file name (or the default if FILE_NAME is
NULL. */
char *(*get_version) (const char *file_name);
/* Returns a statically allocated string containing the required
version. */
const char *(*get_req_version) (void);
gpgme_error_t (*new) (void **r_engine,
const char *file_name, const char *home_dir);
/* Member functions. */
void (*release) (void *engine);
gpgme_error_t (*reset) (void *engine);
void (*set_status_handler) (void *engine, engine_status_handler_t fnc,
void *fnc_value);
gpgme_error_t (*set_command_handler) (void *engine,
engine_command_handler_t fnc,
void *fnc_value, gpgme_data_t data);
gpgme_error_t (*set_colon_line_handler) (void *engine,
engine_colon_line_handler_t fnc,
void *fnc_value);
gpgme_error_t (*set_locale) (void *engine, int category, const char *value);
gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,
gpgme_data_t plain);
gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret);
gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key,
gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t (*encrypt) (void *engine, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph,
int use_armor);
gpgme_error_t (*encrypt_sign) (void *engine, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph,
int use_armor, gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t (*export) (void *engine, const char *pattern,
unsigned int reserved, gpgme_data_t keydata,
int use_armor);
gpgme_error_t (*export_ext) (void *engine, const char *pattern[],
unsigned int reserved, gpgme_data_t keydata,
int use_armor);
gpgme_error_t (*genkey) (void *engine, gpgme_data_t help_data, int use_armor,
gpgme_data_t pubkey, gpgme_data_t seckey);
gpgme_error_t (*import) (void *engine, gpgme_data_t keydata);
gpgme_error_t (*keylist) (void *engine, const char *pattern,
int secret_only, gpgme_keylist_mode_t mode);
gpgme_error_t (*keylist_ext) (void *engine, const char *pattern[],
int secret_only, int reserved,
gpgme_keylist_mode_t mode);
gpgme_error_t (*sign) (void *engine, gpgme_data_t in, gpgme_data_t out,
gpgme_sig_mode_t mode, int use_armor,
int use_textmode,
int include_certs, gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t (*trustlist) (void *engine, const char *pattern);
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);
+ gpgme_error_t (*conf_load) (void *engine, gpgme_conf_comp_t *conf_p);
+ gpgme_error_t (*conf_save) (void *engine, gpgme_conf_comp_t conf);
+
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);
gpgme_error_t (*cancel) (void *engine);
};
extern struct engine_ops _gpgme_engine_ops_gpg; /* OpenPGP. */
#ifdef ENABLE_GPGSM
extern struct engine_ops _gpgme_engine_ops_gpgsm; /* CMS. */
#endif
+#ifdef ENABLE_GPGCONF
+extern struct engine_ops _gpgme_engine_ops_gpgconf; /* gpg-conf. */
+#endif
#endif /* ENGINE_BACKEND_H */
diff --git a/gpgme/engine-gpgconf.c b/gpgme/engine-gpgconf.c
new file mode 100644
index 00000000..ee545f88
--- /dev/null
+++ b/gpgme/engine-gpgconf.c
@@ -0,0 +1,877 @@
+// Check protocol.
+// IMPLEMENT NO_ARG_DESC!!!!
+
+/* engine-gpgconf.c - gpg-conf engine.
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <unistd.h>
+#include <locale.h>
+#include <fcntl.h> /* FIXME */
+#include <errno.h>
+
+#include "gpgme.h"
+#include "util.h"
+#include "ops.h"
+#include "wait.h"
+#include "priv-io.h"
+#include "sema.h"
+
+#include "assuan.h"
+#include "debug.h"
+
+#include "engine-backend.h"
+
+
+struct engine_gpgconf
+{
+ char *file_name;
+ char *home_dir;
+};
+
+typedef struct engine_gpgconf *engine_gpgconf_t;
+
+
+static char *
+gpgconf_get_version (const char *file_name)
+{
+ return _gpgme_get_program_version (file_name ? file_name
+ : _gpgme_get_gpgconf_path ());
+}
+
+
+static const char *
+gpgconf_get_req_version (void)
+{
+ return NEED_GPGCONF_VERSION;
+}
+
+
+static void
+gpgconf_release (void *engine)
+{
+ engine_gpgconf_t gpgconf = engine;
+
+ if (!gpgconf)
+ return;
+
+ if (gpgconf->file_name)
+ free (gpgconf->file_name);
+ if (gpgconf->home_dir)
+ free (gpgconf->home_dir);
+
+ free (gpgconf);
+}
+
+
+static gpgme_error_t
+gpgconf_new (void **engine, const char *file_name, const char *home_dir)
+{
+ gpgme_error_t err = 0;
+ engine_gpgconf_t gpgconf;
+
+ gpgconf = calloc (1, sizeof *gpgconf);
+ if (!gpgconf)
+ return gpg_error_from_errno (errno);
+
+ gpgconf->file_name = strdup (file_name ? file_name
+ : _gpgme_get_gpgconf_path ());
+ if (!gpgconf->file_name)
+ err = gpg_error_from_syserror ();
+
+ if (!err && home_dir)
+ {
+ gpgconf->home_dir = strdup (home_dir);
+ if (!gpgconf->home_dir)
+ err = gpg_error_from_syserror ();
+ }
+
+ if (err)
+ gpgconf_release (gpgconf);
+ else
+ *engine = gpgconf;
+
+ return err;
+}
+
+
+static void
+release_arg (gpgme_conf_arg_t arg, gpgme_conf_type_t alt_type)
+{
+ while (arg)
+ {
+ gpgme_conf_arg_t next = arg->next;
+
+ if (alt_type == GPGME_CONF_STRING)
+ free (arg->value.string);
+ free (arg);
+ arg = next;
+ }
+}
+
+
+static void
+release_opt (gpgme_conf_opt_t opt)
+{
+ if (opt->name)
+ free (opt->name);
+ if (opt->description)
+ free (opt->description);
+ if (opt->argname)
+ free (opt->argname);
+
+ release_arg (opt->default_value, opt->alt_type);
+ if (opt->default_description)
+ free (opt->default_description);
+
+ release_arg (opt->no_arg_value, opt->alt_type);
+ release_arg (opt->value, opt->alt_type);
+ release_arg (opt->new_value, opt->alt_type);
+
+ free (opt);
+}
+
+
+static void
+release_comp (gpgme_conf_comp_t comp)
+{
+ gpgme_conf_opt_t opt;
+
+ if (comp->name)
+ free (comp->name);
+ if (comp->description)
+ free (comp->description);
+ if (comp->program_name)
+ free (comp->program_name);
+
+ opt = comp->options;
+ while (opt)
+ {
+ gpgme_conf_opt_t next = opt->next;
+ release_opt (opt);
+ opt = next;
+ }
+
+ free (comp);
+}
+
+
+static void
+gpgconf_config_release (gpgme_conf_comp_t conf)
+{
+ while (conf)
+ {
+ gpgme_conf_comp_t next = conf->next;
+ release_comp (conf);
+ conf = next;
+ }
+}
+
+
+static gpgme_error_t
+gpgconf_read (void *engine, char *arg1, char *arg2,
+ gpgme_error_t (*cb) (void *hook, char *line),
+ void *hook)
+{
+ struct engine_gpgconf *gpgconf = engine;
+ gpgme_error_t err = 0;
+#define LINELENGTH 1024
+ char line[LINELENGTH] = "";
+ int linelen = 0;
+ char *argv[] = { NULL /* file_name */, arg1, arg2, 0 };
+ int rp[2];
+ struct spawn_fd_item_s pfd[] = { {0, -1}, {-1, -1} };
+ struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */}, {-1, -1} };
+ int status;
+ int nread;
+ char *mark = NULL;
+
+ /* FIXME: Deal with engine->home_dir. */
+
+ /* _gpgme_engine_new guarantees that this is not NULL. */
+ argv[0] = gpgconf->file_name;
+
+ if (_gpgme_io_pipe (rp, 1) < 0)
+ return gpg_error_from_syserror ();
+
+ pfd[0].fd = rp[1];
+ cfd[0].fd = rp[1];
+
+ status = _gpgme_io_spawn (gpgconf->file_name, argv, cfd, pfd);
+ if (status < 0)
+ {
+ _gpgme_io_close (rp[0]);
+ _gpgme_io_close (rp[1]);
+ return gpg_error_from_syserror ();
+ }
+
+ do
+ {
+ nread = _gpgme_io_read (rp[0], &line[linelen], LINELENGTH - linelen - 1);
+ if (nread > 0)
+ {
+ line[linelen + nread] = '\0';
+ linelen += nread;
+
+ while ((mark = strchr (line, '\n')))
+ {
+ char *eol = mark;
+
+ if (eol > &line[0] && *eol == '\r')
+ eol--;
+ *eol = '\0';
+
+ /* Got a full line. */
+ err = (*cb) (hook, line);
+ if (err)
+ break;
+
+ linelen -= mark - line;
+ memmove (line, eol + 1, linelen);
+ }
+ }
+ }
+ while (nread > 0 && linelen < LINELENGTH - 1);
+
+ if (!err && nread < 0)
+ err = gpg_error_from_syserror ();
+ if (!err && nread > 0)
+ err = gpg_error (GPG_ERR_LINE_TOO_LONG);
+
+ _gpgme_io_close (rp[0]);
+
+ return err;
+}
+
+
+static gpgme_error_t
+gpgconf_config_load_cb (void *hook, char *line)
+{
+ gpgme_conf_comp_t *comp_p = hook;
+ gpgme_conf_comp_t comp = *comp_p;
+#define NR_FIELDS 16
+ char *field[NR_FIELDS];
+ int fields = 0;
+
+ while (line && fields < NR_FIELDS)
+ {
+ field[fields++] = line;
+ line = strchr (line, ':');
+ if (line)
+ *(line++) = '\0';
+ }
+
+ /* We require at least the first 3 fields. */
+ if (fields < 2)
+ return gpg_error (GPG_ERR_INV_ENGINE);
+
+ /* Find the pointer to the new component in the list. */
+ while (comp && comp->next)
+ comp = comp->next;
+ if (comp)
+ comp_p = &comp->next;
+
+ comp = calloc (1, sizeof (*comp));
+ if (!comp)
+ return gpg_error_from_syserror ();
+ /* Prepare return value. */
+ comp->_last_opt_p = &comp->options;
+ *comp_p = comp;
+
+ comp->name = strdup (field[0]);
+ if (!comp->name)
+ return gpg_error_from_syserror ();
+
+ comp->description = strdup (field[1]);
+ if (!comp->description)
+ return gpg_error_from_syserror ();
+
+ if (fields >= 3)
+ {
+ comp->description = strdup (field[2]);
+ if (!comp->description)
+ return gpg_error_from_syserror ();
+ }
+
+ return 0;
+}
+
+
+static gpgme_error_t
+gpgconf_parse_option (gpgme_conf_opt_t opt,
+ gpgme_conf_arg_t *arg_p, char *line)
+{
+ gpgme_error_t err;
+ char *mark;
+
+ if (!line[0])
+ return 0;
+
+ mark = strchr (line, ',');
+ if (mark)
+ *mark = '\0';
+
+ while (line)
+ {
+ gpgme_conf_arg_t arg = calloc (1, sizeof (*arg));
+ if (!arg)
+ return gpg_error_from_syserror ();
+ *arg_p = arg;
+ arg_p = &arg->next;
+
+ if (*line == '\0')
+ arg->no_arg = 1;
+ else
+ {
+ switch (opt->alt_type)
+ {
+ /* arg->value.count is an alias for arg->value.uint32. */
+ case GPGME_CONF_NONE:
+ case GPGME_CONF_UINT32:
+ arg->value.uint32 = strtoul (line, NULL, 0);
+ break;
+
+ case GPGME_CONF_INT32:
+ arg->value.uint32 = strtol (line, NULL, 0);
+ break;
+
+ case GPGME_CONF_STRING:
+ case GPGME_CONF_PATHNAME:
+ case GPGME_CONF_LDAP_SERVER:
+ /* Skip quote character. */
+ line++;
+
+ err = _gpgme_decode_percent_string (line, &arg->value.string,
+ 0, 0);
+ if (err)
+ return err;
+ break;
+ }
+ }
+
+ /* Find beginning of next value. */
+ if (mark++ && *mark)
+ line = mark;
+ else
+ line = NULL;
+ }
+
+ return 0;
+}
+
+
+static gpgme_error_t
+gpgconf_config_load_cb2 (void *hook, char *line)
+{
+ gpgme_error_t err;
+ gpgme_conf_comp_t comp = hook;
+ gpgme_conf_opt_t *opt_p = comp->_last_opt_p;
+ gpgme_conf_opt_t opt;
+#define NR_FIELDS 16
+ char *field[NR_FIELDS];
+ int fields = 0;
+
+ while (line && fields < NR_FIELDS)
+ {
+ field[fields++] = line;
+ line = strchr (line, ':');
+ if (line)
+ *(line++) = '\0';
+ }
+
+ /* We require at least the first 10 fields. */
+ if (fields < 10)
+ return gpg_error (GPG_ERR_INV_ENGINE);
+
+ opt = calloc (1, sizeof (*opt));
+ if (!opt)
+ return gpg_error_from_syserror ();
+
+ comp->_last_opt_p = &opt->next;
+ *opt_p = opt;
+
+ if (field[0][0])
+ {
+ opt->name = strdup (field[0]);
+ if (!opt->name)
+ return gpg_error_from_syserror ();
+ }
+
+ opt->flags = strtoul (field[1], NULL, 0);
+
+ opt->level = strtoul (field[2], NULL, 0);
+
+ if (field[3][0])
+ {
+ opt->description = strdup (field[3]);
+ if (!opt->description)
+ return gpg_error_from_syserror ();
+ }
+
+ opt->type = strtoul (field[4], NULL, 0);
+
+ opt->alt_type = strtoul (field[5], NULL, 0);
+
+ if (field[6][0])
+ {
+ opt->argname = strdup (field[6]);
+ if (!opt->argname)
+ return gpg_error_from_syserror ();
+ }
+
+ if (opt->flags & GPGME_CONF_DEFAULT)
+ {
+ err = gpgconf_parse_option (opt, &opt->default_value, field[7]);
+ if (err)
+ return err;
+ }
+ else if ((opt->flags & GPGME_CONF_DEFAULT_DESC) && field[7][0])
+ {
+ opt->default_description = strdup (field[7]);
+ if (!opt->default_description)
+ return gpg_error_from_syserror ();
+ }
+
+ err = gpgconf_parse_option (opt, &opt->no_arg_value, field[8]);
+ if (err)
+ return err;
+
+ err = gpgconf_parse_option (opt, &opt->value, field[9]);
+ if (err)
+ return err;
+
+ return 0;
+}
+
+
+static gpgme_error_t
+gpgconf_conf_load (void *engine, gpgme_conf_comp_t *comp_p)
+{
+ gpgme_error_t err;
+ gpgme_conf_comp_t comp = NULL;
+ gpgme_conf_comp_t cur_comp;
+
+ *comp_p = NULL;
+
+ err = gpgconf_read (engine, "--list-components", NULL,
+ gpgconf_config_load_cb, &comp);
+ if (err)
+ {
+ gpgconf_release (comp);
+ return err;
+ }
+
+ cur_comp = comp;
+ while (!err && cur_comp)
+ {
+ err = gpgconf_read (engine, "--list-options", cur_comp->name,
+ gpgconf_config_load_cb2, cur_comp);
+ cur_comp = cur_comp->next;
+ }
+
+ if (err)
+ {
+ gpgconf_release (comp);
+ return err;
+ }
+
+ *comp_p = comp;
+ return 0;
+}
+
+
+
+gpgme_error_t
+_gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
+ gpgme_conf_type_t type, void *value)
+{
+ gpgme_conf_arg_t arg;
+
+ arg = calloc (1, sizeof (*arg));
+ if (!arg)
+ return gpg_error_from_syserror ();
+
+ if (!value)
+ arg->no_arg = 1;
+ else
+ {
+ switch (type)
+ {
+ case GPGME_CONF_NONE:
+ case GPGME_CONF_UINT32:
+ arg->value.uint32 = *((unsigned int *) value);
+ break;
+
+ case GPGME_CONF_INT32:
+ arg->value.int32 = *((int *) value);
+ break;
+
+ case GPGME_CONF_STRING:
+ case GPGME_CONF_PATHNAME:
+ case GPGME_CONF_LDAP_SERVER:
+ arg->value.string = strdup (value);
+ if (!arg->value.string)
+ {
+ free (arg);
+ return gpg_error_from_syserror ();
+ }
+ break;
+
+ default:
+ free (arg);
+ return gpg_error (GPG_ERR_INV_VALUE);
+ }
+ }
+
+ *arg_p = arg;
+ return 0;
+}
+
+
+void
+_gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
+{
+ switch (type)
+ {
+ case GPGME_CONF_NONE:
+ case GPGME_CONF_UINT32:
+ case GPGME_CONF_INT32:
+ case GPGME_CONF_STRING:
+ default:
+ break;
+
+ case GPGME_CONF_PATHNAME:
+ case GPGME_CONF_LDAP_SERVER:
+ type = GPGME_CONF_STRING;
+ break;
+ }
+
+ release_arg (arg, type);
+}
+
+
+gpgme_error_t
+_gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
+{
+ if (opt->new_value)
+ release_arg (opt->new_value, opt->alt_type);
+
+ if (reset)
+ {
+ opt->new_value = NULL;
+ opt->change_value = 0;
+ }
+ else
+ {
+ opt->new_value = arg;
+ opt->change_value = 1;
+ }
+ return 0;
+}
+
+
+/* FIXME: Major problem: We don't get errors from gpgconf. */
+
+static gpgme_error_t
+gpgconf_write (void *engine, char *arg1, char *arg2, gpgme_data_t conf)
+{
+ struct engine_gpgconf *gpgconf = engine;
+ gpgme_error_t err = 0;
+#define BUFLEN 1024
+ char buf[BUFLEN];
+ int buflen = 0;
+ char *argv[] = { NULL /* file_name */, arg1, arg2, 0 };
+ int rp[2];
+ struct spawn_fd_item_s pfd[] = { {1, -1}, {-1, -1} };
+ struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, {-1, -1} };
+ int status;
+ int nwrite;
+
+ /* FIXME: Deal with engine->home_dir. */
+
+ /* _gpgme_engine_new guarantees that this is not NULL. */
+ argv[0] = gpgconf->file_name;
+ argv[0] = "/home/marcus/g10/install/bin/gpgconf";
+
+ if (_gpgme_io_pipe (rp, 0) < 0)
+ return gpg_error_from_syserror ();
+
+ pfd[0].fd = rp[0];
+ cfd[0].fd = rp[0];
+
+ status = _gpgme_io_spawn (gpgconf->file_name, argv, cfd, pfd);
+ if (status < 0)
+ {
+ _gpgme_io_close (rp[0]);
+ _gpgme_io_close (rp[1]);
+ return gpg_error_from_syserror ();
+ }
+
+ for (;;)
+ {
+ if (buflen == 0)
+ {
+ do
+ {
+ buflen = gpgme_data_read (conf, buf, BUFLEN);
+ }
+ while (buflen < 0 && errno == EAGAIN);
+
+ if (buflen < 0)
+ {
+ err = gpg_error_from_syserror ();
+ _gpgme_io_close (rp[1]);
+ return err;
+ }
+ else if (buflen == 0)
+ {
+ /* All is written. */
+ _gpgme_io_close (rp[1]);
+ return 0;
+ }
+ }
+
+ do
+ {
+ nwrite = _gpgme_io_write (rp[1], buf, buflen);
+ }
+ while (nwrite < 0 && errno == EAGAIN);
+
+ if (nwrite > 0)
+ {
+ buflen -= nwrite;
+ if (buflen > 0)
+ memmove (&buf[0], &buf[nwrite], buflen);
+ }
+ else if (nwrite < 0)
+ {
+ _gpgme_io_close (rp[1]);
+ return gpg_error_from_syserror ();
+ }
+ }
+
+ return 0;
+}
+
+
+static gpgme_error_t
+arg_to_data (gpgme_data_t conf, gpgme_conf_opt_t option, gpgme_conf_arg_t arg)
+{
+ gpgme_error_t err = 0;
+ int amt = 0;
+ char buf[16];
+
+ while (amt >= 0 && arg)
+ {
+ switch (option->alt_type)
+ {
+ case GPGME_CONF_NONE:
+ case GPGME_CONF_UINT32:
+ default:
+ snprintf (buf, sizeof (buf), "%u", arg->value.uint32);
+ buf[sizeof (buf) - 1] = '\0';
+ amt = gpgme_data_write (conf, buf, strlen (buf));
+ break;
+
+ case GPGME_CONF_INT32:
+ snprintf (buf, sizeof (buf), "%i", arg->value.uint32);
+ buf[sizeof (buf) - 1] = '\0';
+ amt = gpgme_data_write (conf, buf, strlen (buf));
+ break;
+
+ case GPGME_CONF_STRING:
+ case GPGME_CONF_PATHNAME:
+ case GPGME_CONF_LDAP_SERVER:
+ /* One quote character, and three times to allow
+ for percent escaping. */
+ {
+ char *ptr = arg->value.string;
+ amt = gpgme_data_write (conf, "\"", 1);
+ if (amt < 0)
+ break;
+
+ while (!err && *ptr)
+ {
+ switch (*ptr)
+ {
+ case '%':
+ amt = gpgme_data_write (conf, "%25", 3);
+ break;
+
+ case ':':
+ amt = gpgme_data_write (conf, "%3a", 3);
+ break;
+
+ case ',':
+ amt = gpgme_data_write (conf, "%2c", 3);
+ break;
+
+ default:
+ amt = gpgme_data_write (conf, ptr, 1);
+ }
+ ptr++;
+ }
+ }
+ break;
+ }
+
+ if (amt < 0)
+ break;
+
+ arg = arg->next;
+ /* Comma separator. */
+ if (arg)
+ amt = gpgme_data_write (conf, ",", 1);
+ }
+
+ if (amt < 0)
+ return gpg_error_from_syserror ();
+
+ return 0;
+}
+
+
+static gpgme_error_t
+gpgconf_conf_save (void *engine, gpgme_conf_comp_t comp)
+{
+ gpgme_error_t err;
+ int amt = 0;
+ /* We use a data object to store the new configuration. */
+ gpgme_data_t conf;
+ gpgme_conf_opt_t option;
+ int something_changed = 0;
+
+ err = gpgme_data_new (&conf);
+ if (err)
+ return err;
+
+ option = comp->options;
+ while (!err && amt >= 0 && option)
+ {
+ if (option->change_value)
+ {
+ unsigned int flags = 0;
+ char buf[16];
+
+ something_changed = 1;
+
+ amt = gpgme_data_write (conf, option->name, strlen (option->name));
+ if (amt >= 0)
+ amt = gpgme_data_write (conf, ":", 1);
+ if (amt < 0)
+ break;
+
+ if (!option->new_value)
+ flags |= GPGME_CONF_DEFAULT;
+ snprintf (buf, sizeof (buf), "%u", flags);
+ buf[sizeof (buf) - 1] = '\0';
+
+ amt = gpgme_data_write (conf, buf, strlen (buf));
+ if (amt >= 0)
+ amt = gpgme_data_write (conf, ":", 1);
+ if (amt < 0)
+ break;
+
+ if (option->new_value)
+ {
+ err = arg_to_data (conf, option, option->new_value);
+ if (err)
+ break;
+ }
+ amt = gpgme_data_write (conf, "\n", 1);
+ }
+ option = option->next;
+ }
+ if (!err && amt < 0)
+ err = gpg_error_from_syserror ();
+ if (err || !something_changed)
+ goto bail;
+
+ err = gpgme_data_seek (conf, 0, SEEK_SET);
+ if (err)
+ goto bail;
+
+ err = gpgconf_write (engine, "--change-options", comp->name, conf);
+ bail:
+ gpgme_data_release (conf);
+ return err;
+}
+
+
+static void
+gpgconf_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
+{
+ /* Nothing to do. */
+}
+
+
+/* Currently, we do not use the engine interface for the various
+ operations. */
+void
+_gpgme_conf_release (gpgme_conf_comp_t conf)
+{
+ gpgconf_config_release (conf);
+}
+
+
+struct engine_ops _gpgme_engine_ops_gpgconf =
+ {
+ /* Static functions. */
+ _gpgme_get_gpgconf_path,
+ gpgconf_get_version,
+ gpgconf_get_req_version,
+ gpgconf_new,
+
+ /* Member functions. */
+ gpgconf_release,
+ NULL, /* reset */
+ NULL, /* set_status_handler */
+ NULL, /* set_command_handler */
+ NULL, /* set_colon_line_handler */
+ NULL, /* set_locale */
+ NULL, /* decrypt */
+ NULL, /* delete */
+ NULL, /* edit */
+ NULL, /* encrypt */
+ NULL, /* encrypt_sign */
+ NULL, /* export */
+ NULL, /* export_ext */
+ NULL, /* genkey */
+ NULL, /* import */
+ NULL, /* keylist */
+ NULL, /* keylist_ext */
+ NULL, /* sign */
+ NULL, /* trustlist */
+ NULL, /* verify */
+ NULL, /* getauditlog */
+ gpgconf_conf_load,
+ gpgconf_conf_save,
+ gpgconf_set_io_cbs,
+ NULL, /* io_event */
+ NULL /* cancel */
+ };
diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c
index 3815613e..1e9ddd23 100644
--- a/gpgme/engine-gpgsm.c
+++ b/gpgme/engine-gpgsm.c
@@ -1,1891 +1,1893 @@
/* engine-gpgsm.c - GpgSM engine.
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2005, 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
#include <locale.h>
#include <fcntl.h> /* FIXME */
#include <errno.h>
#include "gpgme.h"
#include "util.h"
#include "ops.h"
#include "wait.h"
#include "priv-io.h"
#include "sema.h"
#include "assuan.h"
#include "status-table.h"
#include "debug.h"
#include "engine-backend.h"
typedef struct
{
int fd; /* FD we talk about. */
int server_fd;/* Server FD for this connection. */
int dir; /* Inbound/Outbound, maybe given implicit? */
void *data; /* Handler-specific data. */
void *tag; /* ID from the user for gpgme_remove_io_callback. */
char server_fd_str[15]; /* Same as SERVER_FD but as a string. We
need this because _gpgme_io_fd2str can't
be used on a closed descriptor. */
} iocb_data_t;
struct engine_gpgsm
{
assuan_context_t assuan_ctx;
int lc_ctype_set;
int lc_messages_set;
iocb_data_t status_cb;
/* Input, output etc are from the servers perspective. */
iocb_data_t input_cb;
iocb_data_t output_cb;
iocb_data_t message_cb;
struct
{
engine_status_handler_t fnc;
void *fnc_value;
} status;
struct
{
engine_colon_line_handler_t fnc;
void *fnc_value;
struct
{
char *line;
int linesize;
int linelen;
} attic;
int any; /* any data line seen */
} colon;
gpgme_data_t inline_data; /* Used to collect D lines. */
struct gpgme_io_cbs io_cbs;
};
typedef struct engine_gpgsm *engine_gpgsm_t;
static void gpgsm_io_event (void *engine,
gpgme_event_io_t type, void *type_data);
static char *
gpgsm_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
: _gpgme_get_gpgsm_path ());
}
static const char *
gpgsm_get_req_version (void)
{
return NEED_GPGSM_VERSION;
}
static void
close_notify_handler (int fd, void *opaque)
{
engine_gpgsm_t gpgsm = opaque;
assert (fd != -1);
if (gpgsm->status_cb.fd == fd)
{
if (gpgsm->status_cb.tag)
(*gpgsm->io_cbs.remove) (gpgsm->status_cb.tag);
gpgsm->status_cb.fd = -1;
gpgsm->status_cb.tag = NULL;
}
else if (gpgsm->input_cb.fd == fd)
{
if (gpgsm->input_cb.tag)
(*gpgsm->io_cbs.remove) (gpgsm->input_cb.tag);
gpgsm->input_cb.fd = -1;
gpgsm->input_cb.tag = NULL;
}
else if (gpgsm->output_cb.fd == fd)
{
if (gpgsm->output_cb.tag)
(*gpgsm->io_cbs.remove) (gpgsm->output_cb.tag);
gpgsm->output_cb.fd = -1;
gpgsm->output_cb.tag = NULL;
}
else if (gpgsm->message_cb.fd == fd)
{
if (gpgsm->message_cb.tag)
(*gpgsm->io_cbs.remove) (gpgsm->message_cb.tag);
gpgsm->message_cb.fd = -1;
gpgsm->message_cb.tag = NULL;
}
}
static gpgme_error_t
map_assuan_error (gpg_error_t err)
{
if (!err)
return 0;
if (err == -1)
return gpg_error (GPG_ERR_INV_ENGINE);
/* New code will use gpg_error_t values. */
if (gpg_err_source (err))
return (gpgme_error_t) err;
/* Legacy code will use old values. */
switch (err)
{
case ASSUAN_No_Error:
return gpg_error (GPG_ERR_NO_ERROR);
case ASSUAN_General_Error:
return gpg_error (GPG_ERR_GENERAL);
case ASSUAN_Out_Of_Core:
return gpg_error (GPG_ERR_ENOMEM);
case ASSUAN_Invalid_Value:
return gpg_error (GPG_ERR_INV_VALUE);
case ASSUAN_Timeout:
return gpg_error (GPG_ERR_ETIMEDOUT);
case ASSUAN_Read_Error:
return gpg_error (GPG_ERR_GENERAL);
case ASSUAN_Write_Error:
return gpg_error (GPG_ERR_GENERAL);
case ASSUAN_Problem_Starting_Server:
case ASSUAN_Not_A_Server:
case ASSUAN_Not_A_Client:
case ASSUAN_Nested_Commands:
case ASSUAN_No_Data_Callback:
case ASSUAN_No_Inquire_Callback:
case ASSUAN_Connect_Failed:
case ASSUAN_Accept_Failed:
case ASSUAN_Invalid_Command:
case ASSUAN_Unknown_Command:
case ASSUAN_Syntax_Error:
case ASSUAN_Parameter_Error:
case ASSUAN_Parameter_Conflict:
case ASSUAN_No_Input:
case ASSUAN_No_Output:
case ASSUAN_No_Data_Available:
case ASSUAN_Too_Much_Data:
case ASSUAN_Inquire_Unknown:
case ASSUAN_Inquire_Error:
case ASSUAN_Invalid_Option:
case ASSUAN_Unexpected_Status:
case ASSUAN_Unexpected_Data:
case ASSUAN_Invalid_Status:
return gpg_error (GPG_ERR_ASSUAN);
case ASSUAN_Invalid_Response:
return gpg_error (GPG_ERR_INV_RESPONSE);
case ASSUAN_Not_Implemented:
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
case ASSUAN_Line_Too_Long:
return gpg_error (GPG_ERR_LINE_TOO_LONG);
case ASSUAN_Line_Not_Terminated:
return gpg_error (GPG_ERR_INCOMPLETE_LINE);
case ASSUAN_Canceled:
return gpg_error (GPG_ERR_CANCELED);
case ASSUAN_Unsupported_Algorithm:
return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
case ASSUAN_Server_Resource_Problem:
return gpg_error (GPG_ERR_RESOURCE_LIMIT);
case ASSUAN_Server_IO_Error:
return gpg_error (GPG_ERR_GENERAL);
case ASSUAN_Server_Bug:
return gpg_error (GPG_ERR_BUG);
case ASSUAN_Invalid_Data:
return gpg_error (GPG_ERR_INV_DATA);
case ASSUAN_Invalid_Index:
return gpg_error (GPG_ERR_INV_INDEX);
case ASSUAN_Not_Confirmed:
return gpg_error (GPG_ERR_NOT_CONFIRMED);
case ASSUAN_Bad_Certificate:
return gpg_error (GPG_ERR_BAD_CERT);
case ASSUAN_Bad_Certificate_Chain:
return gpg_error (GPG_ERR_BAD_CERT_CHAIN);
case ASSUAN_Missing_Certificate:
return gpg_error (GPG_ERR_MISSING_CERT);
case ASSUAN_Bad_Signature:
return gpg_error (GPG_ERR_BAD_SIGNATURE);
case ASSUAN_No_Agent:
return gpg_error (GPG_ERR_NO_AGENT);
case ASSUAN_Agent_Error:
return gpg_error (GPG_ERR_AGENT);
case ASSUAN_No_Public_Key:
return gpg_error (GPG_ERR_NO_PUBKEY);
case ASSUAN_No_Secret_Key:
return gpg_error (GPG_ERR_NO_SECKEY);
case ASSUAN_Invalid_Name:
return gpg_error (GPG_ERR_INV_NAME);
case ASSUAN_Cert_Revoked:
return gpg_error (GPG_ERR_CERT_REVOKED);
case ASSUAN_No_CRL_For_Cert:
return gpg_error (GPG_ERR_NO_CRL_KNOWN);
case ASSUAN_CRL_Too_Old:
return gpg_error (GPG_ERR_CRL_TOO_OLD);
case ASSUAN_Not_Trusted:
return gpg_error (GPG_ERR_NOT_TRUSTED);
case ASSUAN_Card_Error:
return gpg_error (GPG_ERR_CARD);
case ASSUAN_Invalid_Card:
return gpg_error (GPG_ERR_INV_CARD);
case ASSUAN_No_PKCS15_App:
return gpg_error (GPG_ERR_NO_PKCS15_APP);
case ASSUAN_Card_Not_Present:
return gpg_error (GPG_ERR_CARD_NOT_PRESENT);
case ASSUAN_Invalid_Id:
return gpg_error (GPG_ERR_INV_ID);
default:
return gpg_error (GPG_ERR_GENERAL);
}
}
static gpgme_error_t
gpgsm_cancel (void *engine)
{
engine_gpgsm_t gpgsm = engine;
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
if (gpgsm->status_cb.fd != -1)
_gpgme_io_close (gpgsm->status_cb.fd);
if (gpgsm->input_cb.fd != -1)
_gpgme_io_close (gpgsm->input_cb.fd);
if (gpgsm->output_cb.fd != -1)
_gpgme_io_close (gpgsm->output_cb.fd);
if (gpgsm->message_cb.fd != -1)
_gpgme_io_close (gpgsm->message_cb.fd);
if (gpgsm->assuan_ctx)
{
assuan_disconnect (gpgsm->assuan_ctx);
gpgsm->assuan_ctx = NULL;
}
return 0;
}
static void
gpgsm_release (void *engine)
{
engine_gpgsm_t gpgsm = engine;
if (!gpgsm)
return;
gpgsm_cancel (engine);
free (gpgsm->colon.attic.line);
free (gpgsm);
}
static gpgme_error_t
gpgsm_new (void **engine, const char *file_name, const char *home_dir)
{
gpgme_error_t err = 0;
engine_gpgsm_t gpgsm;
const char *argv[5];
int argc;
#if !USE_DESCRIPTOR_PASSING
int fds[2];
int child_fds[4];
#endif
char *dft_display = NULL;
char dft_ttyname[64];
char *dft_ttytype = NULL;
char *optstr;
gpgsm = calloc (1, sizeof *gpgsm);
if (!gpgsm)
return gpg_error_from_errno (errno);
gpgsm->status_cb.fd = -1;
gpgsm->status_cb.dir = 1;
gpgsm->status_cb.tag = 0;
gpgsm->status_cb.data = gpgsm;
gpgsm->input_cb.fd = -1;
gpgsm->input_cb.dir = 0;
gpgsm->input_cb.tag = 0;
gpgsm->input_cb.server_fd = -1;
*gpgsm->input_cb.server_fd_str = 0;
gpgsm->output_cb.fd = -1;
gpgsm->output_cb.dir = 1;
gpgsm->output_cb.tag = 0;
gpgsm->output_cb.server_fd = -1;
*gpgsm->output_cb.server_fd_str = 0;
gpgsm->message_cb.fd = -1;
gpgsm->message_cb.dir = 0;
gpgsm->message_cb.tag = 0;
gpgsm->message_cb.server_fd = -1;
*gpgsm->message_cb.server_fd_str = 0;
gpgsm->status.fnc = 0;
gpgsm->colon.fnc = 0;
gpgsm->colon.attic.line = 0;
gpgsm->colon.attic.linesize = 0;
gpgsm->colon.attic.linelen = 0;
gpgsm->colon.any = 0;
gpgsm->inline_data = NULL;
gpgsm->io_cbs.add = NULL;
gpgsm->io_cbs.add_priv = NULL;
gpgsm->io_cbs.remove = NULL;
gpgsm->io_cbs.event = NULL;
gpgsm->io_cbs.event_priv = NULL;
#if !USE_DESCRIPTOR_PASSING
if (_gpgme_io_pipe (fds, 0) < 0)
{
err = gpg_error_from_errno (errno);
goto leave;
}
gpgsm->input_cb.fd = fds[1];
gpgsm->input_cb.server_fd = fds[0];
_gpgme_io_fd2str (gpgsm->input_cb.server_fd_str,
sizeof gpgsm->input_cb.server_fd_str,
gpgsm->input_cb.server_fd);
if (_gpgme_io_pipe (fds, 1) < 0)
{
err = gpg_error_from_errno (errno);
goto leave;
}
gpgsm->output_cb.fd = fds[0];
gpgsm->output_cb.server_fd = fds[1];
_gpgme_io_fd2str (gpgsm->output_cb.server_fd_str,
sizeof gpgsm->output_cb.server_fd_str,
gpgsm->output_cb.server_fd);
if (_gpgme_io_pipe (fds, 0) < 0)
{
err = gpg_error_from_errno (errno);
goto leave;
}
gpgsm->message_cb.fd = fds[1];
gpgsm->message_cb.server_fd = fds[0];
_gpgme_io_fd2str (gpgsm->message_cb.server_fd_str,
sizeof gpgsm->message_cb.server_fd_str,
gpgsm->message_cb.server_fd);
child_fds[0] = gpgsm->input_cb.server_fd;
child_fds[1] = gpgsm->output_cb.server_fd;
child_fds[2] = gpgsm->message_cb.server_fd;
child_fds[3] = -1;
#endif
argc = 0;
argv[argc++] = "gpgsm";
if (home_dir)
{
argv[argc++] = "--homedir";
argv[argc++] = home_dir;
}
argv[argc++] = "--server";
argv[argc++] = NULL;
#if USE_DESCRIPTOR_PASSING
err = assuan_pipe_connect_ext
(&gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
argv, NULL, NULL, NULL, 1);
#else
err = assuan_pipe_connect
(&gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
argv, child_fds);
#endif
if (err)
goto leave;
err = _gpgme_getenv ("DISPLAY", &dft_display);
if (err)
goto leave;
if (dft_display)
{
if (asprintf (&optstr, "OPTION display=%s", dft_display) < 0)
{
free (dft_display);
err = gpg_error_from_errno (errno);
goto leave;
}
free (dft_display);
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL,
NULL, NULL, NULL);
free (optstr);
if (err)
{
err = map_assuan_error (err);
goto leave;
}
}
if (isatty (1))
{
int rc;
rc = ttyname_r (1, dft_ttyname, sizeof (dft_ttyname));
if (rc)
{
err = gpg_error_from_errno (rc);
goto leave;
}
else
{
if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0)
{
err = gpg_error_from_errno (errno);
goto leave;
}
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL,
NULL, NULL, NULL);
free (optstr);
if (err)
{
err = map_assuan_error (err);
goto leave;
}
err = _gpgme_getenv ("TERM", &dft_ttytype);
if (err)
goto leave;
if (dft_ttytype)
{
if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0)
{
free (dft_ttytype);
err = gpg_error_from_errno (errno);
goto leave;
}
free (dft_ttytype);
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
NULL, NULL, NULL, NULL);
free (optstr);
if (err)
{
err = map_assuan_error (err);
goto leave;
}
}
}
}
/* 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,
close_notify_handler, gpgsm)
|| _gpgme_io_set_close_notify (gpgsm->output_cb.fd,
close_notify_handler, gpgsm)
|| _gpgme_io_set_close_notify (gpgsm->message_cb.fd,
close_notify_handler, gpgsm)))
{
err = gpg_error (GPG_ERR_GENERAL);
goto leave;
}
#endif
leave:
/* Close the server ends of the pipes (because of this, we must use
the stored server_fd_str in the function start). Our ends are
closed in gpgsm_release(). */
#if !USE_DESCRIPTOR_PASSING
if (gpgsm->input_cb.server_fd != -1)
_gpgme_io_close (gpgsm->input_cb.server_fd);
if (gpgsm->output_cb.server_fd != -1)
_gpgme_io_close (gpgsm->output_cb.server_fd);
if (gpgsm->message_cb.server_fd != -1)
_gpgme_io_close (gpgsm->message_cb.server_fd);
#endif
if (err)
gpgsm_release (gpgsm);
else
*engine = gpgsm;
return err;
}
static gpgme_error_t
gpgsm_set_locale (void *engine, int category, const char *value)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
char *optstr;
char *catstr;
/* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. GPGSM needs support
for this. */
if (category == LC_CTYPE)
{
catstr = "lc-ctype";
if (!value && gpgsm->lc_ctype_set)
return gpg_error (GPG_ERR_INV_VALUE);
if (value)
gpgsm->lc_ctype_set = 1;
}
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
catstr = "lc-messages";
if (!value && gpgsm->lc_messages_set)
return gpg_error (GPG_ERR_INV_VALUE);
if (value)
gpgsm->lc_messages_set = 1;
}
#endif /* LC_MESSAGES */
else
return gpg_error (GPG_ERR_INV_VALUE);
if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0)
err = gpg_error_from_errno (errno);
else
{
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
NULL, NULL, NULL, NULL);
free (optstr);
if (err)
err = map_assuan_error (err);
}
return err;
}
/* Forward declaration. */
static gpgme_status_code_t parse_status (const char *name);
static gpgme_error_t
gpgsm_assuan_simple_command (assuan_context_t ctx, char *cmd,
engine_status_handler_t status_fnc,
void *status_fnc_value)
{
gpg_error_t err;
char *line;
size_t linelen;
err = assuan_write_line (ctx, cmd);
if (err)
return map_assuan_error (err);
do
{
err = assuan_read_line (ctx, &line, &linelen);
if (err)
return map_assuan_error (err);
if (*line == '#' || !linelen)
continue;
if (linelen >= 2
&& line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' '))
return 0;
else if (linelen >= 4
&& line[0] == 'E' && line[1] == 'R' && line[2] == 'R'
&& line[3] == ' ')
err = map_assuan_error (atoi (&line[4]));
else if (linelen >= 2
&& line[0] == 'S' && line[1] == ' ')
{
char *rest;
gpgme_status_code_t r;
rest = strchr (line + 2, ' ');
if (!rest)
rest = line + linelen; /* set to an empty string */
else
*(rest++) = 0;
r = parse_status (line + 2);
if (r >= 0 && status_fnc)
err = status_fnc (status_fnc_value, r, rest);
else
err = gpg_error (GPG_ERR_GENERAL);
}
else
err = gpg_error (GPG_ERR_GENERAL);
}
while (!err);
return err;
}
typedef enum { INPUT_FD, OUTPUT_FD, MESSAGE_FD } fd_type_t;
static void
gpgsm_clear_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type)
{
#if !USE_DESCRIPTOR_PASSING
switch (fd_type)
{
case INPUT_FD:
_gpgme_io_close (gpgsm->input_cb.fd);
break;
case OUTPUT_FD:
_gpgme_io_close (gpgsm->output_cb.fd);
break;
case MESSAGE_FD:
_gpgme_io_close (gpgsm->message_cb.fd);
break;
}
#endif
}
#define COMMANDLINELEN 40
static gpgme_error_t
gpgsm_set_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type, const char *opt)
{
gpg_error_t err = 0;
char line[COMMANDLINELEN];
char *which;
iocb_data_t *iocb_data;
int dir;
switch (fd_type)
{
case INPUT_FD:
which = "INPUT";
iocb_data = &gpgsm->input_cb;
break;
case OUTPUT_FD:
which = "OUTPUT";
iocb_data = &gpgsm->output_cb;
break;
case MESSAGE_FD:
which = "MESSAGE";
iocb_data = &gpgsm->message_cb;
break;
default:
return gpg_error (GPG_ERR_INV_VALUE);
}
dir = iocb_data->dir;
#if USE_DESCRIPTOR_PASSING
/* We try to short-cut the communication by giving GPGSM direct
access to the file descriptor, rather than using a pipe. */
iocb_data->server_fd = _gpgme_data_get_fd (iocb_data->data);
if (iocb_data->server_fd < 0)
{
int fds[2];
if (_gpgme_io_pipe (fds, 0) < 0)
return gpg_error_from_errno (errno);
iocb_data->fd = dir ? fds[0] : fds[1];
iocb_data->server_fd = dir ? fds[1] : fds[0];
if (_gpgme_io_set_close_notify (iocb_data->fd,
close_notify_handler, gpgsm))
{
err = gpg_error (GPG_ERR_GENERAL);
goto leave_set_fd;
}
}
err = assuan_sendfd (gpgsm->assuan_ctx, iocb_data->server_fd);
if (err)
goto leave_set_fd;
_gpgme_io_close (iocb_data->server_fd);
iocb_data->server_fd = -1;
if (opt)
snprintf (line, COMMANDLINELEN, "%s FD %s", which, opt);
else
snprintf (line, COMMANDLINELEN, "%s FD", which);
#else
if (opt)
snprintf (line, COMMANDLINELEN, "%s FD=%s %s",
which, iocb_data->server_fd_str, opt);
else
snprintf (line, COMMANDLINELEN, "%s FD=%s",
which, iocb_data->server_fd_str);
#endif
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, line, NULL, NULL);
#if USE_DESCRIPTOR_PASSING
leave_set_fd:
if (err)
{
_gpgme_io_close (iocb_data->fd);
iocb_data->fd = -1;
if (iocb_data->server_fd != -1)
{
_gpgme_io_close (iocb_data->server_fd);
iocb_data->server_fd = -1;
}
}
#endif
return err;
}
static const char *
map_input_enc (gpgme_data_t d)
{
switch (gpgme_data_get_encoding (d))
{
case GPGME_DATA_ENCODING_NONE:
break;
case GPGME_DATA_ENCODING_BINARY:
return "--binary";
case GPGME_DATA_ENCODING_BASE64:
return "--base64";
case GPGME_DATA_ENCODING_ARMOR:
return "--armor";
default:
break;
}
return NULL;
}
static int
status_cmp (const void *ap, const void *bp)
{
const struct status_table_s *a = ap;
const struct status_table_s *b = bp;
return strcmp (a->name, b->name);
}
static gpgme_status_code_t
parse_status (const char *name)
{
struct status_table_s t, *r;
t.name = name;
r = bsearch (&t, status_table, DIM(status_table) - 1,
sizeof t, status_cmp);
return r ? r->code : -1;
}
static gpgme_error_t
status_handler (void *opaque, int fd)
{
gpg_error_t assuan_err;
gpgme_error_t err = 0;
engine_gpgsm_t gpgsm = opaque;
char *line;
size_t linelen;
do
{
assuan_err = assuan_read_line (gpgsm->assuan_ctx, &line, &linelen);
if (assuan_err)
{
/* Try our best to terminate the connection friendly. */
/* assuan_write_line (gpgsm->assuan_ctx, "BYE"); */
err = map_assuan_error (assuan_err);
TRACE3 (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: error from assuan (%d) getting status line : %s",
fd, assuan_err, gpg_strerror (err));
}
else if (linelen >= 3
&& line[0] == 'E' && line[1] == 'R' && line[2] == 'R'
&& (line[3] == '\0' || line[3] == ' '))
{
if (line[3] == ' ')
err = map_assuan_error (atoi (&line[4]));
else
err = gpg_error (GPG_ERR_GENERAL);
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: ERR line - mapped to: %s",
fd, err ? gpg_strerror (err) : "ok");
/* Try our best to terminate the connection friendly. */
// assuan_write_line (gpgsm->assuan_ctx, "BYE");
}
else if (linelen >= 2
&& line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' '))
{
if (gpgsm->status.fnc)
err = gpgsm->status.fnc (gpgsm->status.fnc_value,
GPGME_STATUS_EOF, "");
if (!err && gpgsm->colon.fnc && gpgsm->colon.any )
{
/* We must tell a colon function about the EOF. We do
this only when we have seen any data lines. Note
that this inlined use of colon data lines will
eventually be changed into using a regular data
channel. */
gpgsm->colon.any = 0;
err = gpgsm->colon.fnc (gpgsm->colon.fnc_value, NULL);
}
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: OK line - final status: %s",
fd, err ? gpg_strerror (err) : "ok");
_gpgme_io_close (gpgsm->status_cb.fd);
return err;
}
else if (linelen > 2
&& line[0] == 'D' && line[1] == ' '
&& gpgsm->colon.fnc)
{
/* We are using the colon handler even for plain inline data
- strange name for that function but for historic reasons
we keep it. */
/* FIXME We can't use this for binary data because we
assume this is a string. For the current usage of colon
output it is correct. */
char *src = line + 2;
char *end = line + linelen;
char *dst;
char **aline = &gpgsm->colon.attic.line;
int *alinelen = &gpgsm->colon.attic.linelen;
if (gpgsm->colon.attic.linesize < *alinelen + linelen + 1)
{
char *newline = realloc (*aline, *alinelen + linelen + 1);
if (!newline)
err = gpg_error_from_errno (errno);
else
{
*aline = newline;
gpgsm->colon.attic.linesize += linelen + 1;
}
}
if (!err)
{
dst = *aline + *alinelen;
while (!err && src < end)
{
if (*src == '%' && src + 2 < end)
{
/* Handle escaped characters. */
++src;
*dst = _gpgme_hextobyte (src);
(*alinelen)++;
src += 2;
}
else
{
*dst = *src++;
(*alinelen)++;
}
if (*dst == '\n')
{
/* Terminate the pending line, pass it to the colon
handler and reset it. */
gpgsm->colon.any = 1;
if (*alinelen > 1 && *(dst - 1) == '\r')
dst--;
*dst = '\0';
/* FIXME How should we handle the return code? */
err = gpgsm->colon.fnc (gpgsm->colon.fnc_value, *aline);
if (!err)
{
dst = *aline;
*alinelen = 0;
}
}
else
dst++;
}
}
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: D line; final status: %s",
fd, err? gpg_strerror (err):"ok");
}
else if (linelen > 2
&& line[0] == 'D' && line[1] == ' '
&& gpgsm->inline_data)
{
char *src = line + 2;
char *end = line + linelen;
char *dst = src;
ssize_t nwritten;
linelen = 0;
while (src < end)
{
if (*src == '%' && src + 2 < end)
{
/* Handle escaped characters. */
++src;
*dst++ = _gpgme_hextobyte (src);
src += 2;
}
else
*dst++ = *src++;
linelen++;
}
src = line + 2;
while (linelen > 0)
{
nwritten = gpgme_data_write (gpgsm->inline_data, src, linelen);
if (!nwritten || (nwritten < 0 && errno != EINTR)
|| nwritten > linelen)
{
err = gpg_error_from_errno (errno);
break;
}
src += nwritten;
linelen -= nwritten;
}
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: D inlinedata; final status: %s",
fd, err? gpg_strerror (err):"ok");
}
else if (linelen > 2
&& line[0] == 'S' && line[1] == ' ')
{
char *rest;
gpgme_status_code_t r;
rest = strchr (line + 2, ' ');
if (!rest)
rest = line + linelen; /* set to an empty string */
else
*(rest++) = 0;
r = parse_status (line + 2);
if (r >= 0)
{
if (gpgsm->status.fnc)
err = gpgsm->status.fnc (gpgsm->status.fnc_value, r, rest);
}
else
fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest);
TRACE3 (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: S line (%s) - final status: %s",
fd, line+2, err? gpg_strerror (err):"ok");
}
}
while (!err && assuan_pending_line (gpgsm->assuan_ctx));
return err;
}
static gpgme_error_t
add_io_cb (engine_gpgsm_t gpgsm, iocb_data_t *iocbd, gpgme_io_cb_t handler)
{
gpgme_error_t err;
TRACE_BEG2 (DEBUG_ENGINE, "engine-gpgsm:add_io_cb", gpgsm,
"fd %d, dir %d", iocbd->fd, iocbd->dir);
err = (*gpgsm->io_cbs.add) (gpgsm->io_cbs.add_priv,
iocbd->fd, iocbd->dir,
handler, iocbd->data, &iocbd->tag);
if (err)
return TRACE_ERR (err);
if (!iocbd->dir)
/* FIXME Kludge around poll() problem. */
err = _gpgme_io_set_nonblocking (iocbd->fd);
return TRACE_ERR (err);
}
static gpgme_error_t
start (engine_gpgsm_t gpgsm, const char *command)
{
gpgme_error_t err;
int fdlist[5];
int nfds;
/* We need to know the fd used by assuan for reads. We do this by
using the assumption that the first returned fd from
assuan_get_active_fds() is always this one. */
nfds = assuan_get_active_fds (gpgsm->assuan_ctx, 0 /* read fds */,
fdlist, DIM (fdlist));
if (nfds < 1)
return gpg_error (GPG_ERR_GENERAL); /* FIXME */
/* We "duplicate" the file descriptor, so we can close it here (we
can't close fdlist[0], as that is closed by libassuan, and
closing it here might cause libassuan to close some unrelated FD
later). Alternatively, we could special case status_fd and
register/unregister it manually as needed, but this increases
code duplication and is more complicated as we can not use the
close notifications etc. A third alternative would be to let
Assuan know that we closed the FD, but that complicates the
Assuan interface. */
gpgsm->status_cb.fd = _gpgme_io_dup (fdlist[0]);
if (gpgsm->status_cb.fd < 0)
return gpg_error_from_syserror ();
if (_gpgme_io_set_close_notify (gpgsm->status_cb.fd,
close_notify_handler, gpgsm))
{
_gpgme_io_close (gpgsm->status_cb.fd);
gpgsm->status_cb.fd = -1;
return gpg_error (GPG_ERR_GENERAL);
}
err = add_io_cb (gpgsm, &gpgsm->status_cb, status_handler);
if (!err && gpgsm->input_cb.fd != -1)
err = add_io_cb (gpgsm, &gpgsm->input_cb, _gpgme_data_outbound_handler);
if (!err && gpgsm->output_cb.fd != -1)
err = add_io_cb (gpgsm, &gpgsm->output_cb, _gpgme_data_inbound_handler);
if (!err && gpgsm->message_cb.fd != -1)
err = add_io_cb (gpgsm, &gpgsm->message_cb, _gpgme_data_outbound_handler);
if (!err)
err = map_assuan_error (assuan_write_line (gpgsm->assuan_ctx, command));
if (!err)
gpgsm_io_event (gpgsm, GPGME_EVENT_START, NULL);
return err;
}
#if USE_DESCRIPTOR_PASSING
static gpgme_error_t
gpgsm_reset (void *engine)
{
engine_gpgsm_t gpgsm = engine;
/* We must send a reset because we need to reset the list of
signers. Note that RESET does not reset OPTION commands. */
return gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "RESET", NULL, NULL);
}
#endif
static gpgme_error_t
gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
gpgsm->input_cb.data = ciph;
err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data));
if (err)
return gpg_error (GPG_ERR_GENERAL); /* FIXME */
gpgsm->output_cb.data = plain;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, 0);
if (err)
return gpg_error (GPG_ERR_GENERAL); /* FIXME */
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (engine, "DECRYPT");
return err;
}
static gpgme_error_t
gpgsm_delete (void *engine, gpgme_key_t key, int allow_secret)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
char *fpr = key->subkeys ? key->subkeys->fpr : NULL;
char *linep = fpr;
char *line;
int length = 8; /* "DELKEYS " */
if (!fpr)
return gpg_error (GPG_ERR_INV_VALUE);
while (*linep)
{
length++;
if (*linep == '%' || *linep == ' ' || *linep == '+')
length += 2;
linep++;
}
length++;
line = malloc (length);
if (!line)
return gpg_error_from_errno (errno);
strcpy (line, "DELKEYS ");
linep = &line[8];
while (*fpr)
{
switch (*fpr)
{
case '%':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = '5';
break;
case ' ':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = '0';
break;
case '+':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = 'B';
break;
default:
*(linep++) = *fpr;
break;
}
fpr++;
}
*linep = '\0';
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, line);
free (line);
return err;
}
static gpgme_error_t
set_recipients (engine_gpgsm_t gpgsm, gpgme_key_t recp[])
{
gpgme_error_t err = 0;
assuan_context_t ctx = gpgsm->assuan_ctx;
char *line;
int linelen;
int invalid_recipients = 0;
int i = 0;
linelen = 10 + 40 + 1; /* "RECIPIENT " + guess + '\0'. */
line = malloc (10 + 40 + 1);
if (!line)
return gpg_error_from_errno (errno);
strcpy (line, "RECIPIENT ");
while (!err && recp[i])
{
char *fpr;
int newlen;
if (!recp[i]->subkeys || !recp[i]->subkeys->fpr)
{
invalid_recipients++;
continue;
}
fpr = recp[i]->subkeys->fpr;
newlen = 11 + strlen (fpr);
if (linelen < newlen)
{
char *newline = realloc (line, newlen);
if (! newline)
{
int saved_errno = errno;
free (line);
return gpg_error_from_errno (saved_errno);
}
line = newline;
linelen = newlen;
}
strcpy (&line[10], fpr);
err = gpgsm_assuan_simple_command (ctx, line, gpgsm->status.fnc,
gpgsm->status.fnc_value);
/* FIXME: This requires more work. */
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY)
invalid_recipients++;
else if (err)
{
free (line);
return err;
}
i++;
}
free (line);
return gpg_error (invalid_recipients
? GPG_ERR_UNUSABLE_PUBKEY : GPG_ERR_NO_ERROR);
}
static gpgme_error_t
gpgsm_encrypt (void *engine, gpgme_key_t recp[], gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph, int use_armor)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
if (!recp)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
gpgsm->input_cb.data = plain;
err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data));
if (err)
return err;
gpgsm->output_cb.data = ciph;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0);
if (err)
return err;
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = set_recipients (gpgsm, recp);
if (!err)
err = start (gpgsm, "ENCRYPT");
return err;
}
static gpgme_error_t
gpgsm_export (void *engine, const char *pattern, unsigned int reserved,
gpgme_data_t keydata, int use_armor)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err = 0;
char *cmd;
if (!gpgsm || reserved)
return gpg_error (GPG_ERR_INV_VALUE);
if (!pattern)
pattern = "";
cmd = malloc (7 + strlen (pattern) + 1);
if (!cmd)
return gpg_error_from_errno (errno);
strcpy (cmd, "EXPORT ");
strcpy (&cmd[7], pattern);
gpgsm->output_cb.data = keydata;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0);
if (err)
return err;
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, cmd);
free (cmd);
return err;
}
static gpgme_error_t
gpgsm_export_ext (void *engine, const char *pattern[], unsigned int reserved,
gpgme_data_t keydata, int use_armor)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err = 0;
char *line;
/* Length is "EXPORT " + p + '\0'. */
int length = 7 + 1;
char *linep;
if (!gpgsm || reserved)
return gpg_error (GPG_ERR_INV_VALUE);
if (pattern && *pattern)
{
const char **pat = pattern;
while (*pat)
{
const char *patlet = *pat;
while (*patlet)
{
length++;
if (*patlet == '%' || *patlet == ' ' || *patlet == '+')
length += 2;
patlet++;
}
pat++;
length++;
}
}
line = malloc (length);
if (!line)
return gpg_error_from_errno (errno);
strcpy (line, "EXPORT ");
linep = &line[7];
if (pattern && *pattern)
{
while (*pattern)
{
const char *patlet = *pattern;
while (*patlet)
{
switch (*patlet)
{
case '%':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = '5';
break;
case ' ':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = '0';
break;
case '+':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = 'B';
break;
default:
*(linep++) = *patlet;
break;
}
patlet++;
}
pattern++;
if (*pattern)
*linep++ = ' ';
}
}
*linep = '\0';
gpgsm->output_cb.data = keydata;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0);
if (err)
return err;
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, line);
free (line);
return err;
}
static gpgme_error_t
gpgsm_genkey (void *engine, gpgme_data_t help_data, int use_armor,
gpgme_data_t pubkey, gpgme_data_t seckey)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm || !pubkey || seckey)
return gpg_error (GPG_ERR_INV_VALUE);
gpgsm->input_cb.data = help_data;
err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data));
if (err)
return err;
gpgsm->output_cb.data = pubkey;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0);
if (err)
return err;
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, "GENKEY");
return err;
}
static gpgme_error_t
gpgsm_import (void *engine, gpgme_data_t keydata)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
gpgsm->input_cb.data = keydata;
err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data));
if (err)
return err;
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, "IMPORT");
return err;
}
static gpgme_error_t
gpgsm_keylist (void *engine, const char *pattern, int secret_only,
gpgme_keylist_mode_t mode)
{
engine_gpgsm_t gpgsm = engine;
char *line;
gpgme_error_t err;
int list_mode = 0;
if (mode & GPGME_KEYLIST_MODE_LOCAL)
list_mode |= 1;
if (mode & GPGME_KEYLIST_MODE_EXTERN)
list_mode |= 2;
if (!pattern)
pattern = "";
/* Always send list-mode option because RESET does not reset it. */
if (asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0)
return gpg_error_from_errno (errno);
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, line, NULL, NULL);
free (line);
if (err)
return err;
/* Always send key validation because RESET does not reset it. */
/* Use the validation mode if required. We don't check for an error
yet because this is a pretty fresh gpgsm features. */
gpgsm_assuan_simple_command (gpgsm->assuan_ctx,
(mode & GPGME_KEYLIST_MODE_VALIDATE)?
"OPTION with-validation=1":
"OPTION with-validation=0" ,
NULL, NULL);
/* Length is "LISTSECRETKEYS " + p + '\0'. */
line = malloc (15 + strlen (pattern) + 1);
if (!line)
return gpg_error_from_errno (errno);
if (secret_only)
{
strcpy (line, "LISTSECRETKEYS ");
strcpy (&line[15], pattern);
}
else
{
strcpy (line, "LISTKEYS ");
strcpy (&line[9], pattern);
}
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, line);
free (line);
return err;
}
static gpgme_error_t
gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
int reserved, gpgme_keylist_mode_t mode)
{
engine_gpgsm_t gpgsm = engine;
char *line;
gpgme_error_t err;
/* Length is "LISTSECRETKEYS " + p + '\0'. */
int length = 15 + 1;
char *linep;
int any_pattern = 0;
int list_mode = 0;
if (reserved)
return gpg_error (GPG_ERR_INV_VALUE);
if (mode & GPGME_KEYLIST_MODE_LOCAL)
list_mode |= 1;
if (mode & GPGME_KEYLIST_MODE_EXTERN)
list_mode |= 2;
/* Always send list-mode option because RESET does not reset it. */
if (asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0)
return gpg_error_from_errno (errno);
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, line, NULL, NULL);
free (line);
if (err)
return err;
/* Always send key validation because RESET does not reset it. */
/* Use the validation mode if required. We don't check for an error
yet because this is a pretty fresh gpgsm features. */
gpgsm_assuan_simple_command (gpgsm->assuan_ctx,
(mode & GPGME_KEYLIST_MODE_VALIDATE)?
"OPTION with-validation=1":
"OPTION with-validation=0" ,
NULL, NULL);
if (pattern && *pattern)
{
const char **pat = pattern;
while (*pat)
{
const char *patlet = *pat;
while (*patlet)
{
length++;
if (*patlet == '%' || *patlet == ' ' || *patlet == '+')
length += 2;
patlet++;
}
pat++;
length++;
}
}
line = malloc (length);
if (!line)
return gpg_error_from_errno (errno);
if (secret_only)
{
strcpy (line, "LISTSECRETKEYS ");
linep = &line[15];
}
else
{
strcpy (line, "LISTKEYS ");
linep = &line[9];
}
if (pattern && *pattern)
{
while (*pattern)
{
const char *patlet = *pattern;
while (*patlet)
{
switch (*patlet)
{
case '%':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = '5';
break;
case ' ':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = '0';
break;
case '+':
*(linep++) = '%';
*(linep++) = '2';
*(linep++) = 'B';
break;
default:
*(linep++) = *patlet;
break;
}
patlet++;
}
any_pattern = 1;
*linep++ = ' ';
pattern++;
}
}
if (any_pattern)
linep--;
*linep = '\0';
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, line);
free (line);
return err;
}
static gpgme_error_t
gpgsm_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
int include_certs, gpgme_ctx_t ctx /* FIXME */)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
char *assuan_cmd;
int i;
gpgme_key_t key;
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
/* FIXME: This does not work as RESET does not reset it so we can't
revert back to default. */
if (include_certs != GPGME_INCLUDE_CERTS_DEFAULT)
{
/* FIXME: Make sure that if we run multiple operations, that we
can reset any previously set value in case the default is
requested. */
if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0)
return gpg_error_from_errno (errno);
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd,
NULL, NULL);
free (assuan_cmd);
if (err)
return err;
}
for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++)
{
const char *s = key->subkeys ? key->subkeys->fpr : NULL;
if (s && strlen (s) < 80)
{
char buf[100];
strcpy (stpcpy (buf, "SIGNER "), s);
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, buf,
NULL, NULL);
}
else
err = gpg_error (GPG_ERR_INV_VALUE);
gpgme_key_unref (key);
if (err)
return err;
}
gpgsm->input_cb.data = in;
err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data));
if (err)
return err;
gpgsm->output_cb.data = out;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0);
if (err)
return err;
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, mode == GPGME_SIG_MODE_DETACH
? "SIGN --detached" : "SIGN");
return err;
}
static gpgme_error_t
gpgsm_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
gpgme_data_t plaintext)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
gpgsm->input_cb.data = sig;
err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data));
if (err)
return err;
if (plaintext)
{
/* Normal or cleartext signature. */
gpgsm->output_cb.data = plaintext;
err = gpgsm_set_fd (gpgsm, OUTPUT_FD, 0);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
}
else
{
/* Detached signature. */
gpgsm->message_cb.data = signed_text;
err = gpgsm_set_fd (gpgsm, MESSAGE_FD, 0);
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
}
gpgsm->inline_data = NULL;
if (!err)
err = start (gpgsm, "VERIFY");
return err;
}
/* 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);
#if USE_DESCRIPTOR_PASSING
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);
gpgsm->inline_data = NULL;
# define CMD "GETAUDITLOG"
#else
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = output;
# define CMD "GETAUDITLOG --data"
#endif
err = start (gpgsm, (flags & GPGME_AUDITLOG_HTML)? CMD " --html" : CMD);
return err;
}
static void
gpgsm_set_status_handler (void *engine, engine_status_handler_t fnc,
void *fnc_value)
{
engine_gpgsm_t gpgsm = engine;
gpgsm->status.fnc = fnc;
gpgsm->status.fnc_value = fnc_value;
}
static gpgme_error_t
gpgsm_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc,
void *fnc_value)
{
engine_gpgsm_t gpgsm = engine;
gpgsm->colon.fnc = fnc;
gpgsm->colon.fnc_value = fnc_value;
gpgsm->colon.any = 0;
return 0;
}
static void
gpgsm_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
{
engine_gpgsm_t gpgsm = engine;
gpgsm->io_cbs = *io_cbs;
}
static void
gpgsm_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{
engine_gpgsm_t gpgsm = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:gpgsm_io_event", gpgsm,
"event %p, type %d, type_data %p",
gpgsm->io_cbs.event, type, type_data);
if (gpgsm->io_cbs.event)
(*gpgsm->io_cbs.event) (gpgsm->io_cbs.event_priv, type, type_data);
}
struct engine_ops _gpgme_engine_ops_gpgsm =
{
/* Static functions. */
_gpgme_get_gpgsm_path,
gpgsm_get_version,
gpgsm_get_req_version,
gpgsm_new,
/* Member functions. */
gpgsm_release,
#if USE_DESCRIPTOR_PASSING
gpgsm_reset,
#else
NULL, /* reset */
#endif
gpgsm_set_status_handler,
NULL, /* set_command_handler */
gpgsm_set_colon_line_handler,
gpgsm_set_locale,
gpgsm_decrypt,
gpgsm_delete,
NULL, /* edit */
gpgsm_encrypt,
NULL, /* encrypt_sign */
gpgsm_export,
gpgsm_export_ext,
gpgsm_genkey,
gpgsm_import,
gpgsm_keylist,
gpgsm_keylist_ext,
gpgsm_sign,
NULL, /* trustlist */
gpgsm_verify,
gpgsm_getauditlog,
+ NULL, /* conf_load */
+ NULL, /* conf_save */
gpgsm_set_io_cbs,
gpgsm_io_event,
gpgsm_cancel
};
diff --git a/gpgme/engine.c b/gpgme/engine.c
index ef7147d4..cf3fe9fe 100644
--- a/gpgme/engine.c
+++ b/gpgme/engine.c
@@ -1,758 +1,790 @@
/* engine.c - GPGME engine support.
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2006 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, 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 <string.h>
#include <errno.h>
#include <assert.h>
#include "gpgme.h"
#include "util.h"
#include "sema.h"
#include "ops.h"
#include "engine.h"
#include "engine-backend.h"
struct engine
{
struct engine_ops *ops;
void *engine;
};
static struct engine_ops *engine_ops[] =
{
&_gpgme_engine_ops_gpg, /* OpenPGP. */
#ifdef ENABLE_GPGSM
- &_gpgme_engine_ops_gpgsm /* CMS. */
+ &_gpgme_engine_ops_gpgsm, /* CMS. */
+#else
+ NULL,
+#endif
+#ifdef ENABLE_GPGCONF
+ &_gpgme_engine_ops_gpgconf /* gpg-conf. */
#else
NULL
#endif
};
/* The engine info. */
static gpgme_engine_info_t engine_info;
DEFINE_STATIC_LOCK (engine_info_lock);
/* Get the file name of the engine for PROTOCOL. */
static const char *
engine_get_file_name (gpgme_protocol_t proto)
{
if (proto > DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_file_name)
return (*engine_ops[proto]->get_file_name) ();
else
return NULL;
}
/* Get a malloced string containing the version number of the engine
for PROTOCOL. */
static char *
engine_get_version (gpgme_protocol_t proto, const char *file_name)
{
if (proto > DIM (engine_ops))
return NULL;
if (engine_ops[proto] && engine_ops[proto]->get_version)
return (*engine_ops[proto]->get_version) (file_name);
else
return NULL;
}
/* Get the required version number of the engine for PROTOCOL. */
static const char *
engine_get_req_version (gpgme_protocol_t 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. */
gpgme_error_t
gpgme_engine_check_version (gpgme_protocol_t proto)
{
gpgme_error_t err;
gpgme_engine_info_t info;
int result;
LOCK (engine_info_lock);
info = engine_info;
if (!info)
{
/* Make sure it is initialized. */
UNLOCK (engine_info_lock);
err = gpgme_get_engine_info (&info);
if (err)
return err;
LOCK (engine_info_lock);
}
while (info && info->protocol != proto)
info = info->next;
if (!info)
result = 0;
else
result = _gpgme_compare_versions (info->version,
info->req_version);
UNLOCK (engine_info_lock);
return result ? 0 : gpg_error (GPG_ERR_INV_ENGINE);
}
/* Release the engine info INFO. */
void
_gpgme_engine_info_release (gpgme_engine_info_t info)
{
while (info)
{
gpgme_engine_info_t next_info = info->next;
assert (info->file_name);
free (info->file_name);
if (info->home_dir)
free (info->home_dir);
if (info->version)
free (info->version);
free (info);
info = next_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. The
returned data is valid until the next gpgme_set_engine_info. */
gpgme_error_t
gpgme_get_engine_info (gpgme_engine_info_t *info)
{
LOCK (engine_info_lock);
if (!engine_info)
{
gpgme_engine_info_t *lastp = &engine_info;
gpgme_protocol_t proto_list[] = { GPGME_PROTOCOL_OpenPGP,
- GPGME_PROTOCOL_CMS };
+ GPGME_PROTOCOL_CMS,
+ GPGME_PROTOCOL_GPGCONF };
unsigned int proto;
for (proto = 0; proto < DIM (proto_list); proto++)
{
const char *ofile_name = engine_get_file_name (proto_list[proto]);
char *file_name;
if (!ofile_name)
continue;
file_name = strdup (ofile_name);
*lastp = malloc (sizeof (*engine_info));
if (!*lastp || !file_name)
{
int saved_errno = errno;
_gpgme_engine_info_release (engine_info);
engine_info = NULL;
if (file_name)
free (file_name);
UNLOCK (engine_info_lock);
return gpg_error_from_errno (saved_errno);
}
(*lastp)->protocol = proto_list[proto];
(*lastp)->file_name = file_name;
(*lastp)->home_dir = NULL;
(*lastp)->version = engine_get_version (proto_list[proto], NULL);
(*lastp)->req_version = engine_get_req_version (proto_list[proto]);
(*lastp)->next = NULL;
lastp = &(*lastp)->next;
}
}
*info = engine_info;
UNLOCK (engine_info_lock);
return 0;
}
/* Get a deep copy of the engine info and return it in INFO. */
gpgme_error_t
_gpgme_engine_info_copy (gpgme_engine_info_t *r_info)
{
gpgme_error_t err = 0;
gpgme_engine_info_t info;
gpgme_engine_info_t new_info;
gpgme_engine_info_t *lastp;
LOCK (engine_info_lock);
info = engine_info;
if (!info)
{
/* Make sure it is initialized. */
UNLOCK (engine_info_lock);
err = gpgme_get_engine_info (&info);
if (err)
return err;
LOCK (engine_info_lock);
}
new_info = NULL;
lastp = &new_info;
while (info)
{
char *file_name;
char *home_dir;
char *version;
assert (info->file_name);
file_name = strdup (info->file_name);
if (info->home_dir)
{
home_dir = strdup (info->home_dir);
if (!home_dir)
err = gpg_error_from_errno (errno);
}
else
home_dir = NULL;
if (info->version)
{
version = strdup (info->version);
if (!version)
err = gpg_error_from_errno (errno);
}
else
version = NULL;
*lastp = malloc (sizeof (*engine_info));
if (!*lastp || !file_name || err)
{
int saved_errno = errno;
_gpgme_engine_info_release (new_info);
if (file_name)
free (file_name);
if (home_dir)
free (home_dir);
if (version)
free (version);
UNLOCK (engine_info_lock);
return gpg_error_from_errno (saved_errno);
}
(*lastp)->protocol = info->protocol;
(*lastp)->file_name = file_name;
(*lastp)->home_dir = home_dir;
(*lastp)->version = version;
(*lastp)->req_version = info->req_version;
(*lastp)->next = NULL;
lastp = &(*lastp)->next;
info = info->next;
}
*r_info = new_info;
UNLOCK (engine_info_lock);
return 0;
}
/* Set the engine info for the info list INFO, protocol PROTO, to the
file name FILE_NAME and the home directory HOME_DIR. */
gpgme_error_t
_gpgme_set_engine_info (gpgme_engine_info_t info, gpgme_protocol_t proto,
const char *file_name, const char *home_dir)
{
char *new_file_name;
char *new_home_dir;
/* FIXME: Use some PROTO_MAX definition. */
if (proto > DIM (engine_ops))
return gpg_error (GPG_ERR_INV_VALUE);
while (info && info->protocol != proto)
info = info->next;
if (!info)
return gpg_error (GPG_ERR_INV_ENGINE);
/* Prepare new members. */
if (file_name)
new_file_name = strdup (file_name);
else
{
const char *ofile_name = engine_get_file_name (proto);
assert (ofile_name);
new_file_name = strdup (ofile_name);
}
if (!new_file_name)
return gpg_error_from_errno (errno);
if (home_dir)
{
new_home_dir = strdup (home_dir);
if (!new_home_dir)
{
free (new_file_name);
return gpg_error_from_errno (errno);
}
}
else
new_home_dir = NULL;
/* Remove the old members. */
assert (info->file_name);
free (info->file_name);
if (info->home_dir)
free (info->home_dir);
if (info->version)
free (info->version);
/* Install the new members. */
info->file_name = new_file_name;
info->home_dir = new_home_dir;
info->version = engine_get_version (proto, new_file_name);
return 0;
}
/* Set the default engine info for the protocol PROTO to the file name
FILE_NAME and the home directory HOME_DIR. */
gpgme_error_t
gpgme_set_engine_info (gpgme_protocol_t proto,
const char *file_name, const char *home_dir)
{
gpgme_error_t err;
gpgme_engine_info_t info;
LOCK (engine_info_lock);
info = engine_info;
if (!info)
{
/* Make sure it is initialized. */
UNLOCK (engine_info_lock);
err = gpgme_get_engine_info (&info);
if (err)
return err;
LOCK (engine_info_lock);
}
err = _gpgme_set_engine_info (info, proto, file_name, home_dir);
UNLOCK (engine_info_lock);
return err;
}
gpgme_error_t
_gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine)
{
engine_t engine;
if (!info->file_name || !info->version)
return gpg_error (GPG_ERR_INV_ENGINE);
engine = calloc (1, sizeof *engine);
if (!engine)
return gpg_error_from_errno (errno);
engine->ops = engine_ops[info->protocol];
if (engine->ops->new)
{
gpgme_error_t err;
err = (*engine->ops->new) (&engine->engine,
info->file_name, info->home_dir);
if (err)
{
free (engine);
return err;
}
}
else
engine->engine = NULL;
*r_engine = engine;
return 0;
}
gpgme_error_t
_gpgme_engine_reset (engine_t engine)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->reset)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->reset) (engine->engine);
}
void
_gpgme_engine_release (engine_t engine)
{
if (!engine)
return;
if (engine->ops->release)
(*engine->ops->release) (engine->engine);
free (engine);
}
void
_gpgme_engine_set_status_handler (engine_t engine,
engine_status_handler_t fnc, void *fnc_value)
{
if (!engine)
return;
if (engine->ops->set_status_handler)
(*engine->ops->set_status_handler) (engine->engine, fnc, fnc_value);
}
gpgme_error_t
_gpgme_engine_set_command_handler (engine_t engine,
engine_command_handler_t fnc,
void *fnc_value,
gpgme_data_t linked_data)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->set_command_handler)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->set_command_handler) (engine->engine,
fnc, fnc_value, linked_data);
}
gpgme_error_t
_gpgme_engine_set_colon_line_handler (engine_t engine,
engine_colon_line_handler_t fnc,
void *fnc_value)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->set_colon_line_handler)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->set_colon_line_handler) (engine->engine,
fnc, fnc_value);
}
gpgme_error_t
_gpgme_engine_set_locale (engine_t engine, int category,
const char *value)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->set_locale)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->set_locale) (engine->engine, category, value);
}
gpgme_error_t
_gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph,
gpgme_data_t plain)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->decrypt)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->decrypt) (engine->engine, ciph, plain);
}
gpgme_error_t
_gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
int allow_secret)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->delete)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->delete) (engine->engine, key, allow_secret);
}
gpgme_error_t
_gpgme_engine_op_edit (engine_t engine, int type, gpgme_key_t key,
gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->edit)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->edit) (engine->engine, type, key, out, ctx);
}
gpgme_error_t
_gpgme_engine_op_encrypt (engine_t engine, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph, int use_armor)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->encrypt)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->encrypt) (engine->engine, recp, flags, plain, ciph,
use_armor);
}
gpgme_error_t
_gpgme_engine_op_encrypt_sign (engine_t engine, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph,
int use_armor, gpgme_ctx_t ctx /* FIXME */)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->encrypt_sign)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->encrypt_sign) (engine->engine, recp, flags,
plain, ciph, use_armor, ctx);
}
gpgme_error_t
_gpgme_engine_op_export (engine_t engine, const char *pattern,
unsigned int reserved, gpgme_data_t keydata,
int use_armor)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->export)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->export) (engine->engine, pattern, reserved,
keydata, use_armor);
}
gpgme_error_t
_gpgme_engine_op_export_ext (engine_t engine, const char *pattern[],
unsigned int reserved, gpgme_data_t keydata,
int use_armor)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->export_ext)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->export_ext) (engine->engine, pattern, reserved,
keydata, use_armor);
}
gpgme_error_t
_gpgme_engine_op_genkey (engine_t engine, gpgme_data_t help_data,
int use_armor, gpgme_data_t pubkey,
gpgme_data_t seckey)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->genkey)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->genkey) (engine->engine, help_data, use_armor,
pubkey, seckey);
}
gpgme_error_t
_gpgme_engine_op_import (engine_t engine, gpgme_data_t keydata)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->import)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->import) (engine->engine, keydata);
}
gpgme_error_t
_gpgme_engine_op_keylist (engine_t engine, const char *pattern,
int secret_only, gpgme_keylist_mode_t mode)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->keylist)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->keylist) (engine->engine, pattern, secret_only, mode);
}
gpgme_error_t
_gpgme_engine_op_keylist_ext (engine_t engine, const char *pattern[],
int secret_only, int reserved,
gpgme_keylist_mode_t mode)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->keylist_ext)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->keylist_ext) (engine->engine, pattern, secret_only,
reserved, mode);
}
gpgme_error_t
_gpgme_engine_op_sign (engine_t engine, gpgme_data_t in, gpgme_data_t out,
gpgme_sig_mode_t mode, int use_armor,
int use_textmode, int include_certs,
gpgme_ctx_t ctx /* FIXME */)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->sign)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->sign) (engine->engine, in, out, mode, use_armor,
use_textmode, include_certs, ctx);
}
gpgme_error_t
_gpgme_engine_op_trustlist (engine_t engine, const char *pattern)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->trustlist)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->trustlist) (engine->engine, pattern);
}
gpgme_error_t
_gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
gpgme_data_t signed_text, gpgme_data_t plaintext)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->verify)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->verify) (engine->engine, sig, signed_text, plaintext);
}
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);
}
+gpgme_error_t
+_gpgme_engine_op_conf_load (engine_t engine, gpgme_conf_comp_t *conf_p)
+{
+ if (!engine)
+ return gpg_error (GPG_ERR_INV_VALUE);
+
+ if (!engine->ops->conf_load)
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+
+ return (*engine->ops->conf_load) (engine->engine, conf_p);
+}
+
+
+gpgme_error_t
+_gpgme_engine_op_conf_save (engine_t engine, gpgme_conf_comp_t conf)
+{
+ if (!engine)
+ return gpg_error (GPG_ERR_INV_VALUE);
+
+ if (!engine->ops->conf_save)
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+
+ return (*engine->ops->conf_save) (engine->engine, conf);
+}
+
+
void
_gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs)
{
if (!engine)
return;
(*engine->ops->set_io_cbs) (engine->engine, io_cbs);
}
void
_gpgme_engine_io_event (engine_t engine,
gpgme_event_io_t type, void *type_data)
{
if (!engine)
return;
(*engine->ops->io_event) (engine->engine, type, type_data);
}
gpgme_error_t
_gpgme_engine_cancel (engine_t engine)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->cancel)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->cancel) (engine->engine);
}
diff --git a/gpgme/engine.h b/gpgme/engine.h
index 6c636e04..e67399ec 100644
--- a/gpgme/engine.h
+++ b/gpgme/engine.h
@@ -1,137 +1,142 @@
/* engine.h - GPGME engine interface.
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef ENGINE_H
#define ENGINE_H
#include "gpgme.h"
struct engine;
typedef struct engine *engine_t;
typedef gpgme_error_t (*engine_status_handler_t) (void *priv,
gpgme_status_code_t code,
char *args);
typedef gpgme_error_t (*engine_colon_line_handler_t) (void *priv, char *line);
typedef gpgme_error_t (*engine_command_handler_t) (void *priv,
gpgme_status_code_t code,
const char *keyword,
int fd, int *processed);
/* Get a deep copy of the engine info and return it in INFO. */
gpgme_error_t _gpgme_engine_info_copy (gpgme_engine_info_t *r_info);
/* Release the engine info INFO. */
void _gpgme_engine_info_release (gpgme_engine_info_t info);
/* Set the engine info for the info list INFO, protocol PROTO, to the
file name FILE_NAME and the home directory HOME_DIR. */
gpgme_error_t _gpgme_set_engine_info (gpgme_engine_info_t info,
gpgme_protocol_t praoto,
const char *file_name,
const char *home_dir);
gpgme_error_t _gpgme_engine_new (gpgme_engine_info_t info,
engine_t *r_engine);
gpgme_error_t _gpgme_engine_reset (engine_t engine);
gpgme_error_t _gpgme_engine_set_locale (engine_t engine, int category,
const char *value);
void _gpgme_engine_release (engine_t engine);
void _gpgme_engine_set_status_handler (engine_t engine,
engine_status_handler_t fnc,
void *fnc_value);
gpgme_error_t _gpgme_engine_set_command_handler (engine_t engine,
engine_command_handler_t fnc,
void *fnc_value,
gpgme_data_t data);
gpgme_error_t
_gpgme_engine_set_colon_line_handler (engine_t engine,
engine_colon_line_handler_t fnc,
void *fnc_value);
gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine,
gpgme_data_t ciph,
gpgme_data_t plain);
gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
int allow_secret);
gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type,
gpgme_key_t key, gpgme_data_t out,
gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t _gpgme_engine_op_encrypt (engine_t engine,
gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph,
int use_armor);
gpgme_error_t _gpgme_engine_op_encrypt_sign (engine_t engine,
gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain,
gpgme_data_t ciph,
int use_armor,
gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t _gpgme_engine_op_export (engine_t engine, const char *pattern,
unsigned int reserved,
gpgme_data_t keydata, int use_armor);
gpgme_error_t _gpgme_engine_op_export_ext (engine_t engine,
const char *pattern[],
unsigned int reserved,
gpgme_data_t keydata,
int use_armor);
gpgme_error_t _gpgme_engine_op_genkey (engine_t engine,
gpgme_data_t help_data,
int use_armor, gpgme_data_t pubkey,
gpgme_data_t seckey);
gpgme_error_t _gpgme_engine_op_import (engine_t engine,
gpgme_data_t keydata);
gpgme_error_t _gpgme_engine_op_keylist (engine_t engine,
const char *pattern,
int secret_only,
gpgme_keylist_mode_t mode);
gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
const char *pattern[],
int secret_only,
int reserved,
gpgme_keylist_mode_t mode);
gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
gpgme_data_t out, gpgme_sig_mode_t mode,
int use_armor, int use_textmode,
int include_certs,
gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t _gpgme_engine_op_trustlist (engine_t engine,
const char *pattern);
gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
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);
+gpgme_error_t _gpgme_engine_op_conf_load (engine_t engine,
+ gpgme_conf_comp_t *conf_p);
+gpgme_error_t _gpgme_engine_op_conf_save (engine_t engine,
+ gpgme_conf_comp_t conf);
+
void _gpgme_engine_set_io_cbs (engine_t engine,
gpgme_io_cbs_t io_cbs);
void _gpgme_engine_io_event (engine_t engine,
gpgme_event_io_t type, void *type_data);
gpgme_error_t _gpgme_engine_cancel (engine_t engine);
#endif /* ENGINE_H */
diff --git a/gpgme/gpgconf.c b/gpgme/gpgconf.c
new file mode 100644
index 00000000..9fa2ce9e
--- /dev/null
+++ b/gpgme/gpgconf.c
@@ -0,0 +1,134 @@
+/* gpgconf.c - GnuPG Made Easy.
+ 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gpgme.h"
+
+#include "ops.h"
+#include "engine.h"
+
+#ifdef ENABLE_GPGCONF
+/* engine-gpgconf.c. */
+gpgme_error_t _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
+ gpgme_conf_type_t type, void *value);
+void _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
+gpgme_error_t _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
+ gpgme_conf_arg_t arg);
+void _gpgme_conf_release (gpgme_conf_comp_t conf);
+gpgme_error_t _gpgme_conf_load (void *engine, gpgme_conf_comp_t *conf_p);
+gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
+
+#endif
+
+
+/* Allocate a new gpgme_conf_arg_t. */
+gpgme_error_t
+gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
+ gpgme_conf_type_t type, void *value)
+{
+#ifdef ENABLE_GPGCONF
+ return _gpgme_conf_arg_new (arg_p, type, value);
+#else
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#endif
+}
+
+
+/* This also releases all chained argument structures! */
+void
+gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
+{
+#ifdef ENABLE_GPGCONF
+ return _gpgme_conf_arg_release (arg, type);
+#endif
+}
+
+
+/* Register a change for the value of OPT to ARG. */
+gpgme_error_t
+gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
+{
+#ifdef ENABLE_GPGCONF
+ return _gpgme_conf_opt_change (opt, reset, arg);
+#else
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#endif
+}
+
+
+
+/* Public function to release a gpgme_conf_comp list. */
+void
+gpgme_conf_release (gpgme_conf_comp_t conf)
+{
+#ifdef ENABLE_GPGCONF
+ _gpgme_conf_release (conf);
+#endif
+}
+
+
+/* Public function to release load a configuration list. No
+ asynchronous interface for now. */
+gpgme_error_t
+gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
+{
+#ifdef ENABLE_GPGCONF
+ gpgme_error_t err;
+ gpgme_protocol_t proto = ctx->protocol;
+
+ ctx->protocol = GPGME_PROTOCOL_GPGCONF;
+ err = _gpgme_op_reset (ctx, 1);
+ if (err)
+ return err;
+
+ err = _gpgme_engine_op_conf_load (ctx->engine, conf_p);
+ ctx->protocol = proto;
+ return err;
+#else
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#endif
+}
+
+
+/* This function does not follow chained components! */
+gpgme_error_t
+gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp)
+{
+#ifdef ENABLE_GPGCONF
+ gpgme_error_t err;
+ gpgme_protocol_t proto = ctx->protocol;
+
+ ctx->protocol = GPGME_PROTOCOL_GPGCONF;
+ err = _gpgme_op_reset (ctx, 1);
+ if (err)
+ return err;
+
+ err = _gpgme_engine_op_conf_save (ctx->engine, comp);
+ ctx->protocol = proto;
+ return err;
+#else
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+#endif
+}
+
+
diff --git a/gpgme/gpgme.def b/gpgme/gpgme.def
index 57dbe40d..3c5e335b 100644
--- a/gpgme/gpgme.def
+++ b/gpgme/gpgme.def
@@ -1,163 +1,170 @@
; gpgme.def - List of symbols to export.
; Copyright (C) 2005 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, write to the Free Software
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
EXPORTS
gpgme_check_version @1
gpgme_get_engine_info @2
gpgme_engine_check_version @3
gpgme_err_code_from_errno @4
gpgme_err_code_to_errno @5
gpgme_err_make_from_errno @6
gpgme_error_from_errno @7
gpgme_strerror @8
gpgme_strerror_r @9
gpgme_strsource @10
gpgme_data_get_encoding @11
gpgme_data_new @12
gpgme_data_new_from_cbs @13
gpgme_data_new_from_fd @14
gpgme_data_new_from_file @15
gpgme_data_new_from_filepart @16
gpgme_data_new_from_mem @17
gpgme_data_new_from_stream @18
gpgme_data_read @19
gpgme_data_release @20
gpgme_data_release_and_get_mem @21
gpgme_data_seek @22
gpgme_data_set_encoding @23
gpgme_data_write @24
gpgme_get_protocol_name @25
gpgme_hash_algo_name @26
gpgme_pubkey_algo_name @27
gpgme_new @28
gpgme_get_armor @29
gpgme_get_include_certs @30
gpgme_get_io_cbs @31
gpgme_get_keylist_mode @32
gpgme_get_passphrase_cb @33
gpgme_get_progress_cb @34
gpgme_get_protocol @35
gpgme_get_textmode @36
gpgme_release @37
gpgme_set_armor @38
gpgme_set_include_certs @39
gpgme_set_io_cbs @40
gpgme_set_keylist_mode @41
gpgme_set_locale @42
gpgme_set_passphrase_cb @43
gpgme_set_progress_cb @44
gpgme_set_protocol @45
gpgme_set_textmode @46
gpgme_signers_add @47
gpgme_signers_clear @48
gpgme_signers_enum @49
gpgme_key_ref @50
gpgme_key_unref @51
gpgme_key_release @52
gpgme_trust_item_ref @53
gpgme_trust_item_unref @54
gpgme_cancel @55
gpgme_op_card_edit @56
gpgme_op_card_edit_start @57
gpgme_op_decrypt @58
gpgme_op_decrypt_result @59
gpgme_op_decrypt_start @60
gpgme_op_decrypt_verify @61
gpgme_op_decrypt_verify_start @62
gpgme_op_delete @63
gpgme_op_delete_start @64
gpgme_op_edit @65
gpgme_op_edit_start @66
gpgme_op_encrypt @67
gpgme_op_encrypt_result @68
gpgme_op_encrypt_sign @69
gpgme_op_encrypt_sign_start @70
gpgme_op_encrypt_start @71
gpgme_op_export @72
gpgme_op_export_ext @73
gpgme_op_export_ext_start @74
gpgme_op_export_start @75
gpgme_op_genkey @76
gpgme_op_genkey_result @77
gpgme_op_genkey_start @78
gpgme_get_key @79
gpgme_op_import @80
gpgme_op_import_result @81
gpgme_op_import_start @82
gpgme_op_keylist_end @83
gpgme_op_keylist_ext_start @84
gpgme_op_keylist_next @85
gpgme_op_keylist_result @86
gpgme_op_keylist_start @87
gpgme_op_sign @88
gpgme_op_sign_result @89
gpgme_op_sign_start @90
gpgme_op_trustlist_end @91
gpgme_op_trustlist_next @92
gpgme_op_trustlist_start @93
gpgme_op_verify @94
gpgme_op_verify_result @95
gpgme_op_verify_start @96
gpgme_wait @97
gpgme_data_new_with_read_cb @98
gpgme_data_rewind @99
gpgme_get_sig_status @100
gpgme_get_sig_string_attr @101
gpgme_get_sig_ulong_attr @102
gpgme_get_sig_key @103
gpgme_key_get_string_attr @104
gpgme_key_get_ulong_attr @105
gpgme_key_sig_get_string_attr @106
gpgme_key_sig_get_ulong_attr @107
gpgme_op_import_ext @108
gpgme_trust_item_get_int_attr @109
gpgme_trust_item_get_string_attr @110
gpgme_trust_item_release @111
gpgme_set_engine_info @112
gpgme_ctx_get_engine_info @113
gpgme_ctx_set_engine_info @114
gpgme_data_set_file_name @115
gpgme_data_get_file_name @116
gpgme_sig_notation_clear @117
gpgme_sig_notation_add @118
gpgme_sig_notation_get @119
gpgme_free @120
gpgme_get_giochannel @121
gpgme_get_fdptr @122
gpgme_op_getauditlog_start @123
gpgme_op_getauditlog @124
+ gpgme_conf_release @125
+ gpgme_conf_arg_new @126
+ gpgme_conf_arg_release @127
+ gpgme_conf_opt_change @128
+ gpgme_op_conf_load @129
+ gpgme_op_conf_save @130
+
; END
diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h
index b867419c..bf42035e 100644
--- a/gpgme/gpgme.h
+++ b/gpgme/gpgme.h
@@ -1,1725 +1,1883 @@
/* gpgme.h - Public interface to GnuPG Made Easy.
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2005, 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/>.
*/
#ifndef GPGME_H
#define GPGME_H
#ifdef __GNUC__
#define _GPGME_INLINE __inline__
#elif __STDC_VERSION__ >= 199901L
#define _GPGME_INLINE inline
#else
#define _GPGME_INLINE
#endif
/* Include stdio.h for the FILE type definition. */
#include <stdio.h>
#ifdef _MSC_VER
typedef long off_t;
typedef long ssize_t;
#else
# include <sys/types.h>
#endif
#include <gpg-error.h>
#ifdef __cplusplus
extern "C" {
#if 0 /* just to make Emacs auto-indent happy */
}
#endif
#endif /* __cplusplus */
/* Check for compiler features. */
#if __GNUC__
#define _GPGME_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#if _GPGME_GCC_VERSION > 30100
#define _GPGME_DEPRECATED __attribute__ ((__deprecated__))
#endif
#endif
#ifndef _GPGME_DEPRECATED
#define _GPGME_DEPRECATED
#endif
/* The version of this header should match the one of the library. Do
not use this symbol in your application, use gpgme_check_version
instead. The purpose of this macro is to let autoconf (using the
AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do
that for you! */
-#define GPGME_VERSION "1.1.6-svn1258"
+#define GPGME_VERSION "1.1.6-svn1282"
/* Some opaque data types used by GPGME. */
/* The context holds some global state and configration options, as
well as the results of a crypto operation. */
struct gpgme_context;
typedef struct gpgme_context *gpgme_ctx_t;
/* The data object is used by GPGME to exchange arbitrary data. */
struct gpgme_data;
typedef struct gpgme_data *gpgme_data_t;
/* Wrappers for the libgpg-error library. */
typedef gpg_error_t gpgme_error_t;
typedef gpg_err_code_t gpgme_err_code_t;
typedef gpg_err_source_t gpgme_err_source_t;
static _GPGME_INLINE gpgme_error_t
gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code)
{
return gpg_err_make (source, code);
}
/* The user can define GPGME_ERR_SOURCE_DEFAULT before including this
file to specify a default source for gpgme_error. */
#ifndef GPGME_ERR_SOURCE_DEFAULT
#define GPGME_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1
#endif
static _GPGME_INLINE gpgme_error_t
gpgme_error (gpgme_err_code_t code)
{
return gpgme_err_make (GPGME_ERR_SOURCE_DEFAULT, code);
}
static _GPGME_INLINE gpgme_err_code_t
gpgme_err_code (gpgme_error_t err)
{
return gpg_err_code (err);
}
static _GPGME_INLINE gpgme_err_source_t
gpgme_err_source (gpgme_error_t err)
{
return gpg_err_source (err);
}
/* Return a pointer to a string containing a description of the error
code in the error value ERR. This function is not thread safe. */
const char *gpgme_strerror (gpgme_error_t err);
/* Return the error string for ERR in the user-supplied buffer BUF of
size BUFLEN. This function is, in contrast to gpg_strerror,
thread-safe if a thread-safe strerror_r() function is provided by
the system. If the function succeeds, 0 is returned and BUF
contains the string describing the error. If the buffer was not
large enough, ERANGE is returned and BUF contains as much of the
beginning of the error string as fits into the buffer. */
int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen);
/* Return a pointer to a string containing a description of the error
source in the error value ERR. */
const char *gpgme_strsource (gpgme_error_t err);
/* Retrieve the error code for the system error ERR. This returns
GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
this). */
gpgme_err_code_t gpgme_err_code_from_errno (int err);
/* Retrieve the system error for the error code CODE. This returns 0
if CODE is not a system error code. */
int gpgme_err_code_to_errno (gpgme_err_code_t code);
/* Return an error value with the error source SOURCE and the system
error ERR. */
gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err);
/* Return an error value with the system error ERR. */
gpgme_err_code_t gpgme_error_from_errno (int err);
/* The possible encoding mode of gpgme_data_t objects. */
typedef enum
{
GPGME_DATA_ENCODING_NONE = 0, /* Not specified. */
GPGME_DATA_ENCODING_BINARY = 1,
GPGME_DATA_ENCODING_BASE64 = 2,
GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor. */
}
gpgme_data_encoding_t;
/* Public key algorithms from libgcrypt. */
typedef enum
{
GPGME_PK_RSA = 1,
GPGME_PK_RSA_E = 2,
GPGME_PK_RSA_S = 3,
GPGME_PK_ELG_E = 16,
GPGME_PK_DSA = 17,
GPGME_PK_ELG = 20
}
gpgme_pubkey_algo_t;
/* Hash algorithms from libgcrypt. */
typedef enum
{
GPGME_MD_NONE = 0,
GPGME_MD_MD5 = 1,
GPGME_MD_SHA1 = 2,
GPGME_MD_RMD160 = 3,
GPGME_MD_MD2 = 5,
GPGME_MD_TIGER = 6, /* TIGER/192. */
GPGME_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
GPGME_MD_SHA256 = 8,
GPGME_MD_SHA384 = 9,
GPGME_MD_SHA512 = 10,
GPGME_MD_MD4 = 301,
GPGME_MD_CRC32 = 302,
GPGME_MD_CRC32_RFC1510 = 303,
GPGME_MD_CRC24_RFC2440 = 304
}
gpgme_hash_algo_t;
/* The possible signature stati. Deprecated, use error value in sig
status. */
typedef enum
{
GPGME_SIG_STAT_NONE = 0,
GPGME_SIG_STAT_GOOD = 1,
GPGME_SIG_STAT_BAD = 2,
GPGME_SIG_STAT_NOKEY = 3,
GPGME_SIG_STAT_NOSIG = 4,
GPGME_SIG_STAT_ERROR = 5,
GPGME_SIG_STAT_DIFF = 6,
GPGME_SIG_STAT_GOOD_EXP = 7,
GPGME_SIG_STAT_GOOD_EXPKEY = 8
}
_gpgme_sig_stat_t;
typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED;
/* The available signature modes. */
typedef enum
{
GPGME_SIG_MODE_NORMAL = 0,
GPGME_SIG_MODE_DETACH = 1,
GPGME_SIG_MODE_CLEAR = 2
}
gpgme_sig_mode_t;
/* The available key and signature attributes. Deprecated, use the
individual result structures instead. */
typedef enum
{
GPGME_ATTR_KEYID = 1,
GPGME_ATTR_FPR = 2,
GPGME_ATTR_ALGO = 3,
GPGME_ATTR_LEN = 4,
GPGME_ATTR_CREATED = 5,
GPGME_ATTR_EXPIRE = 6,
GPGME_ATTR_OTRUST = 7,
GPGME_ATTR_USERID = 8,
GPGME_ATTR_NAME = 9,
GPGME_ATTR_EMAIL = 10,
GPGME_ATTR_COMMENT = 11,
GPGME_ATTR_VALIDITY = 12,
GPGME_ATTR_LEVEL = 13,
GPGME_ATTR_TYPE = 14,
GPGME_ATTR_IS_SECRET = 15,
GPGME_ATTR_KEY_REVOKED = 16,
GPGME_ATTR_KEY_INVALID = 17,
GPGME_ATTR_UID_REVOKED = 18,
GPGME_ATTR_UID_INVALID = 19,
GPGME_ATTR_KEY_CAPS = 20,
GPGME_ATTR_CAN_ENCRYPT = 21,
GPGME_ATTR_CAN_SIGN = 22,
GPGME_ATTR_CAN_CERTIFY = 23,
GPGME_ATTR_KEY_EXPIRED = 24,
GPGME_ATTR_KEY_DISABLED = 25,
GPGME_ATTR_SERIAL = 26,
GPGME_ATTR_ISSUER = 27,
GPGME_ATTR_CHAINID = 28,
GPGME_ATTR_SIG_STATUS = 29,
GPGME_ATTR_ERRTOK = 30,
GPGME_ATTR_SIG_SUMMARY = 31,
GPGME_ATTR_SIG_CLASS = 32
}
_gpgme_attr_t;
typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED;
/* The available validities for a trust item or key. */
typedef enum
{
GPGME_VALIDITY_UNKNOWN = 0,
GPGME_VALIDITY_UNDEFINED = 1,
GPGME_VALIDITY_NEVER = 2,
GPGME_VALIDITY_MARGINAL = 3,
GPGME_VALIDITY_FULL = 4,
GPGME_VALIDITY_ULTIMATE = 5
}
gpgme_validity_t;
/* The available protocols. */
typedef enum
{
GPGME_PROTOCOL_OpenPGP = 0, /* The default mode. */
GPGME_PROTOCOL_CMS = 1,
+ GPGME_PROTOCOL_GPGCONF = 2, /* Special code for gpgconf. */
GPGME_PROTOCOL_UNKNOWN = 255
}
gpgme_protocol_t;
/* The available keylist mode flags. */
#define GPGME_KEYLIST_MODE_LOCAL 1
#define GPGME_KEYLIST_MODE_EXTERN 2
#define GPGME_KEYLIST_MODE_SIGS 4
#define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8
#define GPGME_KEYLIST_MODE_VALIDATE 256
typedef unsigned int gpgme_keylist_mode_t;
/* Flags for the audit log functions. */
#define GPGME_AUDITLOG_HTML 1
#define GPGME_AUDITLOG_WITH_HELP 128
/* Signature notations. */
/* The available signature notation flags. */
#define GPGME_SIG_NOTATION_HUMAN_READABLE 1
#define GPGME_SIG_NOTATION_CRITICAL 2
typedef unsigned int gpgme_sig_notation_flags_t;
struct _gpgme_sig_notation
{
struct _gpgme_sig_notation *next;
/* If NAME is a null pointer, then VALUE contains a policy URL
rather than a notation. */
char *name;
/* The value of the notation data. */
char *value;
/* The length of the name of the notation data. */
int name_len;
/* The length of the value of the notation data. */
int value_len;
/* The accumulated flags. */
gpgme_sig_notation_flags_t flags;
/* Notation data is human-readable. */
unsigned int human_readable : 1;
/* Notation data is critical. */
unsigned int critical : 1;
/* Internal to GPGME, do not use. */
int _unused : 30;
};
typedef struct _gpgme_sig_notation *gpgme_sig_notation_t;
/* The possible stati for the edit operation. */
typedef enum
{
GPGME_STATUS_EOF,
/* mkstatus processing starts here */
GPGME_STATUS_ENTER,
GPGME_STATUS_LEAVE,
GPGME_STATUS_ABORT,
GPGME_STATUS_GOODSIG,
GPGME_STATUS_BADSIG,
GPGME_STATUS_ERRSIG,
GPGME_STATUS_BADARMOR,
GPGME_STATUS_RSA_OR_IDEA,
GPGME_STATUS_KEYEXPIRED,
GPGME_STATUS_KEYREVOKED,
GPGME_STATUS_TRUST_UNDEFINED,
GPGME_STATUS_TRUST_NEVER,
GPGME_STATUS_TRUST_MARGINAL,
GPGME_STATUS_TRUST_FULLY,
GPGME_STATUS_TRUST_ULTIMATE,
GPGME_STATUS_SHM_INFO,
GPGME_STATUS_SHM_GET,
GPGME_STATUS_SHM_GET_BOOL,
GPGME_STATUS_SHM_GET_HIDDEN,
GPGME_STATUS_NEED_PASSPHRASE,
GPGME_STATUS_VALIDSIG,
GPGME_STATUS_SIG_ID,
GPGME_STATUS_ENC_TO,
GPGME_STATUS_NODATA,
GPGME_STATUS_BAD_PASSPHRASE,
GPGME_STATUS_NO_PUBKEY,
GPGME_STATUS_NO_SECKEY,
GPGME_STATUS_NEED_PASSPHRASE_SYM,
GPGME_STATUS_DECRYPTION_FAILED,
GPGME_STATUS_DECRYPTION_OKAY,
GPGME_STATUS_MISSING_PASSPHRASE,
GPGME_STATUS_GOOD_PASSPHRASE,
GPGME_STATUS_GOODMDC,
GPGME_STATUS_BADMDC,
GPGME_STATUS_ERRMDC,
GPGME_STATUS_IMPORTED,
GPGME_STATUS_IMPORT_OK,
GPGME_STATUS_IMPORT_PROBLEM,
GPGME_STATUS_IMPORT_RES,
GPGME_STATUS_FILE_START,
GPGME_STATUS_FILE_DONE,
GPGME_STATUS_FILE_ERROR,
GPGME_STATUS_BEGIN_DECRYPTION,
GPGME_STATUS_END_DECRYPTION,
GPGME_STATUS_BEGIN_ENCRYPTION,
GPGME_STATUS_END_ENCRYPTION,
GPGME_STATUS_DELETE_PROBLEM,
GPGME_STATUS_GET_BOOL,
GPGME_STATUS_GET_LINE,
GPGME_STATUS_GET_HIDDEN,
GPGME_STATUS_GOT_IT,
GPGME_STATUS_PROGRESS,
GPGME_STATUS_SIG_CREATED,
GPGME_STATUS_SESSION_KEY,
GPGME_STATUS_NOTATION_NAME,
GPGME_STATUS_NOTATION_DATA,
GPGME_STATUS_POLICY_URL,
GPGME_STATUS_BEGIN_STREAM,
GPGME_STATUS_END_STREAM,
GPGME_STATUS_KEY_CREATED,
GPGME_STATUS_USERID_HINT,
GPGME_STATUS_UNEXPECTED,
GPGME_STATUS_INV_RECP,
GPGME_STATUS_NO_RECP,
GPGME_STATUS_ALREADY_SIGNED,
GPGME_STATUS_SIGEXPIRED,
GPGME_STATUS_EXPSIG,
GPGME_STATUS_EXPKEYSIG,
GPGME_STATUS_TRUNCATED,
GPGME_STATUS_ERROR,
GPGME_STATUS_NEWSIG,
GPGME_STATUS_REVKEYSIG,
GPGME_STATUS_SIG_SUBPACKET,
GPGME_STATUS_NEED_PASSPHRASE_PIN,
GPGME_STATUS_SC_OP_FAILURE,
GPGME_STATUS_SC_OP_SUCCESS,
GPGME_STATUS_CARDCTRL,
GPGME_STATUS_BACKUP_KEY_CREATED,
GPGME_STATUS_PKA_TRUST_BAD,
GPGME_STATUS_PKA_TRUST_GOOD,
GPGME_STATUS_PLAINTEXT
}
gpgme_status_code_t;
/* The engine information structure. */
struct _gpgme_engine_info
{
struct _gpgme_engine_info *next;
/* The protocol ID. */
gpgme_protocol_t protocol;
/* The file name of the engine binary. */
char *file_name;
/* The version string of the installed engine. */
char *version;
/* The minimum version required for GPGME. */
const char *req_version;
/* The home directory used, or NULL if default. */
char *home_dir;
};
typedef struct _gpgme_engine_info *gpgme_engine_info_t;
/* A subkey from a key. */
struct _gpgme_subkey
{
struct _gpgme_subkey *next;
/* True if subkey is revoked. */
unsigned int revoked : 1;
/* True if subkey is expired. */
unsigned int expired : 1;
/* True if subkey is disabled. */
unsigned int disabled : 1;
/* True if subkey is invalid. */
unsigned int invalid : 1;
/* True if subkey can be used for encryption. */
unsigned int can_encrypt : 1;
/* True if subkey can be used for signing. */
unsigned int can_sign : 1;
/* True if subkey can be used for certification. */
unsigned int can_certify : 1;
/* True if subkey is secret. */
unsigned int secret : 1;
/* True if subkey can be used for authentication. */
unsigned int can_authenticate : 1;
/* True if subkey is qualified for signatures according to German law. */
unsigned int is_qualified : 1;
/* Internal to GPGME, do not use. */
unsigned int _unused : 22;
/* Public key algorithm supported by this subkey. */
gpgme_pubkey_algo_t pubkey_algo;
/* Length of the subkey. */
unsigned int length;
/* The key ID of the subkey. */
char *keyid;
/* Internal to GPGME, do not use. */
char _keyid[16 + 1];
/* The fingerprint of the subkey in hex digit form. */
char *fpr;
/* The creation timestamp, -1 if invalid, 0 if not available. */
long int timestamp;
/* The expiration timestamp, 0 if the subkey does not expire. */
long int expires;
};
typedef struct _gpgme_subkey *gpgme_subkey_t;
/* A signature on a user ID. */
struct _gpgme_key_sig
{
struct _gpgme_key_sig *next;
/* True if the signature is a revocation signature. */
unsigned int revoked : 1;
/* True if the signature is expired. */
unsigned int expired : 1;
/* True if the signature is invalid. */
unsigned int invalid : 1;
/* True if the signature should be exported. */
unsigned int exportable : 1;
/* Internal to GPGME, do not use. */
unsigned int _unused : 28;
/* The public key algorithm used to create the signature. */
gpgme_pubkey_algo_t pubkey_algo;
/* The key ID of key used to create the signature. */
char *keyid;
/* Internal to GPGME, do not use. */
char _keyid[16 + 1];
/* The creation timestamp, -1 if invalid, 0 if not available. */
long int timestamp;
/* The expiration timestamp, 0 if the subkey does not expire. */
long int expires;
/* Same as in gpgme_signature_t. */
gpgme_error_t status;
#ifdef __cplusplus
unsigned int _obsolete_class _GPGME_DEPRECATED;
#else
/* Must be set to SIG_CLASS below. */
unsigned int class _GPGME_DEPRECATED;
#endif
/* The user ID string. */
char *uid;
/* The name part of the user ID. */
char *name;
/* The email part of the user ID. */
char *email;
/* The comment part of the user ID. */
char *comment;
/* Crypto backend specific signature class. */
unsigned int sig_class;
/* Notation data and policy URLs. */
gpgme_sig_notation_t notations;
/* Internal to GPGME, do not use. */
gpgme_sig_notation_t _last_notation;
};
typedef struct _gpgme_key_sig *gpgme_key_sig_t;
/* An user ID from a key. */
struct _gpgme_user_id
{
struct _gpgme_user_id *next;
/* True if the user ID is revoked. */
unsigned int revoked : 1;
/* True if the user ID is invalid. */
unsigned int invalid : 1;
/* Internal to GPGME, do not use. */
unsigned int _unused : 30;
/* The validity of the user ID. */
gpgme_validity_t validity;
/* The user ID string. */
char *uid;
/* The name part of the user ID. */
char *name;
/* The email part of the user ID. */
char *email;
/* The comment part of the user ID. */
char *comment;
/* The signatures of the user ID. */
gpgme_key_sig_t signatures;
/* Internal to GPGME, do not use. */
gpgme_key_sig_t _last_keysig;
};
typedef struct _gpgme_user_id *gpgme_user_id_t;
/* A key from the keyring. */
struct _gpgme_key
{
/* Internal to GPGME, do not use. */
unsigned int _refs;
/* True if key is revoked. */
unsigned int revoked : 1;
/* True if key is expired. */
unsigned int expired : 1;
/* True if key is disabled. */
unsigned int disabled : 1;
/* True if key is invalid. */
unsigned int invalid : 1;
/* True if key can be used for encryption. */
unsigned int can_encrypt : 1;
/* True if key can be used for signing. */
unsigned int can_sign : 1;
/* True if key can be used for certification. */
unsigned int can_certify : 1;
/* True if key is secret. */
unsigned int secret : 1;
/* True if key can be used for authentication. */
unsigned int can_authenticate : 1;
/* True if subkey is qualified for signatures according to German law. */
unsigned int is_qualified : 1;
/* Internal to GPGME, do not use. */
unsigned int _unused : 22;
/* This is the protocol supported by this key. */
gpgme_protocol_t protocol;
/* If protocol is GPGME_PROTOCOL_CMS, this string contains the
issuer serial. */
char *issuer_serial;
/* If protocol is GPGME_PROTOCOL_CMS, this string contains the
issuer name. */
char *issuer_name;
/* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain
ID. */
char *chain_id;
/* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the
owner trust. */
gpgme_validity_t owner_trust;
/* The subkeys of the key. */
gpgme_subkey_t subkeys;
/* The user IDs of the key. */
gpgme_user_id_t uids;
/* Internal to GPGME, do not use. */
gpgme_subkey_t _last_subkey;
/* Internal to GPGME, do not use. */
gpgme_user_id_t _last_uid;
/* The keylist mode that was active when listing the key. */
gpgme_keylist_mode_t keylist_mode;
};
typedef struct _gpgme_key *gpgme_key_t;
/* Types for callback functions. */
/* Request a passphrase from the user. */
typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook,
const char *uid_hint,
const char *passphrase_info,
int prev_was_bad, int fd);
/* Inform the user about progress made. */
typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what,
int type, int current, int total);
/* Interact with the user about an edit operation. */
typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque,
gpgme_status_code_t status,
const char *args, int fd);
/* Context management functions. */
/* Create a new context and return it in CTX. */
gpgme_error_t gpgme_new (gpgme_ctx_t *ctx);
/* Release the context CTX. */
void gpgme_release (gpgme_ctx_t ctx);
/* Set the protocol to be used by CTX to PROTO. */
gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto);
/* Get the protocol used with CTX */
gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx);
/* Get the string describing protocol PROTO, or NULL if invalid. */
const char *gpgme_get_protocol_name (gpgme_protocol_t proto);
/* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */
void gpgme_set_armor (gpgme_ctx_t ctx, int yes);
/* Return non-zero if armor mode is set in CTX. */
int gpgme_get_armor (gpgme_ctx_t ctx);
/* If YES is non-zero, enable text mode in CTX, disable it otherwise. */
void gpgme_set_textmode (gpgme_ctx_t ctx, int yes);
/* Return non-zero if text mode is set in CTX. */
int gpgme_get_textmode (gpgme_ctx_t ctx);
/* Use whatever the default of the backend crypto engine is. */
#define GPGME_INCLUDE_CERTS_DEFAULT -256
/* Include up to NR_OF_CERTS certificates in an S/MIME message. */
void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs);
/* Return the number of certs to include in an S/MIME message. */
int gpgme_get_include_certs (gpgme_ctx_t ctx);
/* Set keylist mode in CTX to MODE. */
gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx,
gpgme_keylist_mode_t mode);
/* Get keylist mode in CTX. */
gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx);
/* Set the passphrase callback function in CTX to CB. HOOK_VALUE is
passed as first argument to the passphrase callback function. */
void gpgme_set_passphrase_cb (gpgme_ctx_t ctx,
gpgme_passphrase_cb_t cb, void *hook_value);
/* Get the current passphrase callback function in *CB and the current
hook value in *HOOK_VALUE. */
void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb,
void **hook_value);
/* Set the progress callback function in CTX to CB. HOOK_VALUE is
passed as first argument to the progress callback function. */
void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb,
void *hook_value);
/* Get the current progress callback function in *CB and the current
hook value in *HOOK_VALUE. */
void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb,
void **hook_value);
/* This function sets the locale for the context CTX, or the default
locale if CTX is a null pointer. */
gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category,
const char *value);
/* Get the information about the configured engines. A pointer to the
first engine in the statically allocated linked list is returned.
The returned data is valid until the next gpgme_ctx_set_engine_info. */
gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx);
/* Set the engine info for the context CTX, protocol PROTO, to the
file name FILE_NAME and the home directory HOME_DIR. */
gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx,
gpgme_protocol_t proto,
const char *file_name,
const char *home_dir);
/* Return a statically allocated string with the name of the public
key algorithm ALGO, or NULL if that name is not known. */
const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo);
/* Return a statically allocated string with the name of the hash
algorithm ALGO, or NULL if that name is not known. */
const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo);
/* Delete all signers from CTX. */
void gpgme_signers_clear (gpgme_ctx_t ctx);
/* Add KEY to list of signers in CTX. */
gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
/* Return the SEQth signer's key in CTX. */
gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
/* Retrieve the signature status of signature IDX in CTX after a
successful verify operation in R_STAT (if non-null). The creation
time stamp of the signature is returned in R_CREATED (if non-null).
The function returns a string containing the fingerprint.
Deprecated, use verify result directly. */
const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
_gpgme_sig_stat_t *r_stat,
time_t *r_created) _GPGME_DEPRECATED;
/* Retrieve certain attributes of a signature. IDX is the index
number of the signature after a successful verify operation. WHAT
is an attribute where GPGME_ATTR_EXPIRE is probably the most useful
one. WHATIDX is to be passed as 0 for most attributes . */
unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx,
_gpgme_attr_t what, int whatidx)
_GPGME_DEPRECATED;
const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx,
_gpgme_attr_t what, int whatidx)
_GPGME_DEPRECATED;
/* Get the key used to create signature IDX in CTX and return it in
R_KEY. */
gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key)
_GPGME_DEPRECATED;
/* Clear all notation data from the context. */
void gpgme_sig_notation_clear (gpgme_ctx_t ctx);
/* Add the human-readable notation data with name NAME and value VALUE
to the context CTX, using the flags FLAGS. If NAME is NULL, then
VALUE should be a policy URL. The flag
GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation
data, and false for policy URLs. */
gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
const char *value,
gpgme_sig_notation_flags_t flags);
/* Get the sig notations for this context. */
gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx);
/* Run control. */
/* The type of an I/O callback function. */
typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd);
/* The type of a function that can register FNC as the I/O callback
function for the file descriptor FD with direction dir (0: for writing,
1: for reading). FNC_DATA should be passed as DATA to FNC. The
function should return a TAG suitable for the corresponding
gpgme_remove_io_cb_t, and an error value. */
typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir,
gpgme_io_cb_t fnc,
void *fnc_data, void **tag);
/* The type of a function that can remove a previously registered I/O
callback function given TAG as returned by the register
function. */
typedef void (*gpgme_remove_io_cb_t) (void *tag);
typedef enum
{
GPGME_EVENT_START,
GPGME_EVENT_DONE,
GPGME_EVENT_NEXT_KEY,
GPGME_EVENT_NEXT_TRUSTITEM
}
gpgme_event_io_t;
/* The type of a function that is called when a context finished an
operation. */
typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type,
void *type_data);
struct gpgme_io_cbs
{
gpgme_register_io_cb_t add;
void *add_priv;
gpgme_remove_io_cb_t remove;
gpgme_event_io_cb_t event;
void *event_priv;
};
typedef struct gpgme_io_cbs *gpgme_io_cbs_t;
/* Set the I/O callback functions in CTX to IO_CBS. */
void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
/* Get the current I/O callback functions. */
void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
/* Process the pending operation and, if HANG is non-zero, wait for
the pending operation to finish. */
gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
/* Functions to handle data objects. */
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle HANDLE. Return the number of characters read, 0 on EOF
and -1 on error. If an error occurs, errno is set. */
typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer,
size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle HANDLE. Return the number of characters written, or -1
on error. If an error occurs, errno is set. */
typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle HANDLE to OFFSET, relativ to
WHENCE. */
typedef off_t (*gpgme_data_seek_cb_t) (void *handle, off_t offset, int whence);
/* Close the data object with the handle DL. */
typedef void (*gpgme_data_release_cb_t) (void *handle);
struct gpgme_data_cbs
{
gpgme_data_read_cb_t read;
gpgme_data_write_cb_t write;
gpgme_data_seek_cb_t seek;
gpgme_data_release_cb_t release;
};
typedef struct gpgme_data_cbs *gpgme_data_cbs_t;
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence);
/* Create a new data buffer and return it in R_DH. */
gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh);
/* Destroy the data buffer DH. */
void gpgme_data_release (gpgme_data_t dh);
/* Create a new data buffer filled with SIZE bytes starting from
BUFFER. If COPY is zero, copying is delayed until necessary, and
the data is taken from the original location when needed. */
gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh,
const char *buffer, size_t size,
int copy);
/* Destroy the data buffer DH and return a pointer to its content.
The memory has be to released with gpgme_free() by the user. It's
size is returned in R_LEN. */
char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len);
/* Release the memory returned by gpgme_data_release_and_get_mem(). */
void gpgme_free (void *buffer);
gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh,
gpgme_data_cbs_t cbs,
void *handle);
gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd);
gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream);
/* Return the encoding attribute of the data buffer DH */
gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh);
/* Set the encoding attribute of data buffer DH to ENC */
gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh,
gpgme_data_encoding_t enc);
/* Get the file name associated with the data object with handle DH, or
NULL if there is none. */
char *gpgme_data_get_file_name (gpgme_data_t dh);
/* Set the file name associated with the data object with handle DH to
FILE_NAME. */
gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
const char *file_name);
/* Create a new data buffer which retrieves the data from the callback
function READ_CB. Deprecated, please use gpgme_data_new_from_cbs
instead. */
gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh,
int (*read_cb) (void*,char *,
size_t,size_t*),
void *read_cb_value)
_GPGME_DEPRECATED;
/* Create a new data buffer filled with the content of file FNAME.
COPY must be non-zero. For delayed read, please use
gpgme_data_new_from_fd or gpgme_data_new_from stream instead. */
gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh,
const char *fname,
int copy);
/* Create a new data buffer filled with LENGTH bytes starting from
OFFSET within the file FNAME or stream FP (exactly one must be
non-zero). */
gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh,
const char *fname, FILE *fp,
off_t offset, size_t length);
/* Reset the read pointer in DH. Deprecated, please use
gpgme_data_seek instead. */
gpgme_error_t gpgme_data_rewind (gpgme_data_t dh) _GPGME_DEPRECATED;
/* Key and trust functions. */
/* Get the key with the fingerprint FPR from the crypto backend. If
SECRET is true, get the secret key. */
gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr,
gpgme_key_t *r_key, int secret);
/* Acquire a reference to KEY. */
void gpgme_key_ref (gpgme_key_t key);
/* Release a reference to KEY. If this was the last one the key is
destroyed. */
void gpgme_key_unref (gpgme_key_t key);
void gpgme_key_release (gpgme_key_t key);
/* Return the value of the attribute WHAT of KEY, which has to be
representable by a string. IDX specifies the sub key or user ID
for attributes related to sub keys or user IDs. Deprecated, use
key structure directly instead. */
const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what,
const void *reserved, int idx)
_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of KEY, which has to be
representable by an unsigned integer. IDX specifies the sub key or
user ID for attributes related to sub keys or user IDs.
Deprecated, use key structure directly instead. */
unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what,
const void *reserved, int idx)
_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of a signature on user ID
UID_IDX in KEY, which has to be representable by a string. IDX
specifies the signature. Deprecated, use key structure directly
instead. */
const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx,
_gpgme_attr_t what,
const void *reserved, int idx)
_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of a signature on user ID
UID_IDX in KEY, which has to be representable by an unsigned
integer string. IDX specifies the signature. Deprecated, use key
structure directly instead. */
unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx,
_gpgme_attr_t what,
const void *reserved, int idx)
_GPGME_DEPRECATED;
/* Crypto Operations. */
/* Cancel a pending asynchronous operation. */
gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx);
struct _gpgme_invalid_key
{
struct _gpgme_invalid_key *next;
char *fpr;
gpgme_error_t reason;
};
typedef struct _gpgme_invalid_key *gpgme_invalid_key_t;
/* Encryption. */
struct _gpgme_op_encrypt_result
{
/* The list of invalid recipients. */
gpgme_invalid_key_t invalid_recipients;
};
typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t;
/* Retrieve a pointer to the result of the encrypt operation. */
gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx);
/* The valid encryption flags. */
typedef enum
{
GPGME_ENCRYPT_ALWAYS_TRUST = 1
}
gpgme_encrypt_flags_t;
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
store the resulting ciphertext in CIPHER. */
gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t cipher);
gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t cipher);
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
store the resulting ciphertext in CIPHER. Also sign the ciphertext
with the signers in CTX. */
gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx,
gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain,
gpgme_data_t cipher);
gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t cipher);
/* Decryption. */
struct _gpgme_recipient
{
struct _gpgme_recipient *next;
/* The key ID of key for which the text was encrypted. */
char *keyid;
/* Internal to GPGME, do not use. */
char _keyid[16 + 1];
/* The public key algorithm of the recipient key. */
gpgme_pubkey_algo_t pubkey_algo;
/* The status of the recipient. */
gpgme_error_t status;
};
typedef struct _gpgme_recipient *gpgme_recipient_t;
struct _gpgme_op_decrypt_result
{
char *unsupported_algorithm;
/* Key should not have been used for encryption. */
unsigned int wrong_key_usage : 1;
/* Internal to GPGME, do not use. */
int _unused : 31;
gpgme_recipient_t recipients;
/* The original file name of the plaintext message, if
available. */
char *file_name;
};
typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t;
/* Retrieve a pointer to the result of the decrypt operation. */
gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx);
/* Decrypt ciphertext CIPHER within CTX and store the resulting
plaintext in PLAIN. */
gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
gpgme_data_t plain);
gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx,
gpgme_data_t cipher, gpgme_data_t plain);
/* Decrypt ciphertext CIPHER and make a signature verification within
CTX and store the resulting plaintext in PLAIN. */
gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx,
gpgme_data_t cipher,
gpgme_data_t plain);
gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
gpgme_data_t plain);
/* Signing. */
struct _gpgme_new_signature
{
struct _gpgme_new_signature *next;
/* The type of the signature. */
gpgme_sig_mode_t type;
/* The public key algorithm used to create the signature. */
gpgme_pubkey_algo_t pubkey_algo;
/* The hash algorithm used to create the signature. */
gpgme_hash_algo_t hash_algo;
/* Internal to GPGME, do not use. Must be set to the same value as
CLASS below. */
unsigned long _obsolete_class;
/* Signature creation time. */
long int timestamp;
/* The fingerprint of the signature. */
char *fpr;
#ifdef __cplusplus
unsigned int _obsolete_class_2;
#else
/* Must be set to SIG_CLASS below. */
unsigned int class _GPGME_DEPRECATED;
#endif
/* Crypto backend specific signature class. */
unsigned int sig_class;
};
typedef struct _gpgme_new_signature *gpgme_new_signature_t;
struct _gpgme_op_sign_result
{
/* The list of invalid signers. */
gpgme_invalid_key_t invalid_signers;
gpgme_new_signature_t signatures;
};
typedef struct _gpgme_op_sign_result *gpgme_sign_result_t;
/* Retrieve a pointer to the result of the signing operation. */
gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx);
/* Sign the plaintext PLAIN and store the signature in SIG. */
gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx,
gpgme_data_t plain, gpgme_data_t sig,
gpgme_sig_mode_t mode);
gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx,
gpgme_data_t plain, gpgme_data_t sig,
gpgme_sig_mode_t mode);
/* Verify. */
/* Flags used for the SUMMARY field in a gpgme_signature_t. */
typedef enum
{
GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */
GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */
GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */
GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */
GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */
GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */
GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */
GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */
GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */
GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */
GPGME_SIGSUM_SYS_ERROR = 0x0800 /* A system error occured. */
}
gpgme_sigsum_t;
struct _gpgme_signature
{
struct _gpgme_signature *next;
/* A summary of the signature status. */
gpgme_sigsum_t summary;
/* The fingerprint or key ID of the signature. */
char *fpr;
/* The status of the signature. */
gpgme_error_t status;
/* Notation data and policy URLs. */
gpgme_sig_notation_t notations;
/* Signature creation time. */
unsigned long timestamp;
/* Signature exipration time or 0. */
unsigned long exp_timestamp;
/* Key should not have been used for signing. */
unsigned int wrong_key_usage : 1;
/* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */
unsigned int pka_trust : 2;
/* Validity has been verified using the chain model. */
unsigned int chain_model : 1;
/* Internal to GPGME, do not use. */
int _unused : 28;
gpgme_validity_t validity;
gpgme_error_t validity_reason;
/* The public key algorithm used to create the signature. */
gpgme_pubkey_algo_t pubkey_algo;
/* The hash algorithm used to create the signature. */
gpgme_hash_algo_t hash_algo;
/* The mailbox from the PKA information or NULL. */
char *pka_address;
};
typedef struct _gpgme_signature *gpgme_signature_t;
struct _gpgme_op_verify_result
{
gpgme_signature_t signatures;
/* The original file name of the plaintext message, if
available. */
char *file_name;
};
typedef struct _gpgme_op_verify_result *gpgme_verify_result_t;
/* Retrieve a pointer to the result of the verify operation. */
gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx);
/* Verify within CTX that SIG is a valid signature for TEXT. */
gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig,
gpgme_data_t signed_text,
gpgme_data_t plaintext);
gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig,
gpgme_data_t signed_text,
gpgme_data_t plaintext);
/* Import. */
/* The key was new. */
#define GPGME_IMPORT_NEW 1
/* The key contained new user IDs. */
#define GPGME_IMPORT_UID 2
/* The key contained new signatures. */
#define GPGME_IMPORT_SIG 4
/* The key contained new sub keys. */
#define GPGME_IMPORT_SUBKEY 8
/* The key contained a secret key. */
#define GPGME_IMPORT_SECRET 16
struct _gpgme_import_status
{
struct _gpgme_import_status *next;
/* Fingerprint. */
char *fpr;
/* If a problem occured, the reason why the key could not be
imported. Otherwise GPGME_No_Error. */
gpgme_error_t result;
/* The result of the import, the GPGME_IMPORT_* values bit-wise
ORed. 0 means the key was already known and no new components
have been added. */
unsigned int status;
};
typedef struct _gpgme_import_status *gpgme_import_status_t;
/* Import. */
struct _gpgme_op_import_result
{
/* Number of considered keys. */
int considered;
/* Keys without user ID. */
int no_user_id;
/* Imported keys. */
int imported;
/* Imported RSA keys. */
int imported_rsa;
/* Unchanged keys. */
int unchanged;
/* Number of new user ids. */
int new_user_ids;
/* Number of new sub keys. */
int new_sub_keys;
/* Number of new signatures. */
int new_signatures;
/* Number of new revocations. */
int new_revocations;
/* Number of secret keys read. */
int secret_read;
/* Number of secret keys imported. */
int secret_imported;
/* Number of secret keys unchanged. */
int secret_unchanged;
/* Number of new keys skipped. */
int skipped_new_keys;
/* Number of keys not imported. */
int not_imported;
/* List of keys for which an import was attempted. */
gpgme_import_status_t imports;
};
typedef struct _gpgme_op_import_result *gpgme_import_result_t;
/* Retrieve a pointer to the result of the import operation. */
gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx);
/* Import the key in KEYDATA into the keyring. */
gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata);
gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata);
gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata,
int *nr) _GPGME_DEPRECATED;
/* Export the keys found by PATTERN into KEYDATA. */
gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern,
unsigned int reserved,
gpgme_data_t keydata);
gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern,
unsigned int reserved, gpgme_data_t keydata);
gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx,
const char *pattern[],
unsigned int reserved,
gpgme_data_t keydata);
gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
unsigned int reserved,
gpgme_data_t keydata);
/* Key generation. */
struct _gpgme_op_genkey_result
{
/* A primary key was generated. */
unsigned int primary : 1;
/* A sub key was generated. */
unsigned int sub : 1;
/* Internal to GPGME, do not use. */
unsigned int _unused : 30;
/* The fingerprint of the generated key. */
char *fpr;
};
typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t;
/* Generate a new keypair and add it to the keyring. PUBKEY and
SECKEY should be null for now. PARMS specifies what keys should be
generated. */
gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms,
gpgme_data_t pubkey, gpgme_data_t seckey);
gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms,
gpgme_data_t pubkey, gpgme_data_t seckey);
/* Retrieve a pointer to the result of the genkey operation. */
gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx);
/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret
keys are also deleted. */
gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
int allow_secret);
gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key,
int allow_secret);
/* Edit the key KEY. Send status and command requests to FNC and
output of edit commands to OUT. */
gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
gpgme_edit_cb_t fnc, void *fnc_value,
gpgme_data_t out);
gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,
gpgme_edit_cb_t fnc, void *fnc_value,
gpgme_data_t out);
/* Edit the card for the key KEY. Send status and command requests to
FNC and output of edit commands to OUT. */
gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
gpgme_edit_cb_t fnc, void *fnc_value,
gpgme_data_t out);
gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key,
gpgme_edit_cb_t fnc, void *fnc_value,
gpgme_data_t out);
/* Key management functions. */
struct _gpgme_op_keylist_result
{
unsigned int truncated : 1;
/* Internal to GPGME, do not use. */
unsigned int _unused : 31;
};
typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t;
/* Retrieve a pointer to the result of the key listing operation. */
gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx);
/* Start a keylist operation within CTX, searching for keys which
match PATTERN. If SECRET_ONLY is true, only secret keys are
returned. */
gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern,
int secret_only);
gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx,
const char *pattern[],
int secret_only, int reserved);
/* Return the next key from the keylist in R_KEY. */
gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key);
/* Terminate a pending keylist operation within CTX. */
gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx);
/* Trust items and operations. */
struct _gpgme_trust_item
{
/* Internal to GPGME, do not use. */
unsigned int _refs;
/* The key ID to which the trust item belongs. */
char *keyid;
/* Internal to GPGME, do not use. */
char _keyid[16 + 1];
/* The type of the trust item, 1 refers to a key, 2 to a user ID. */
int type;
/* The trust level. */
int level;
/* The owner trust if TYPE is 1. */
char *owner_trust;
/* Internal to GPGME, do not use. */
char _owner_trust[2];
/* The calculated validity. */
char *validity;
/* Internal to GPGME, do not use. */
char _validity[2];
/* The user name if TYPE is 2. */
char *name;
};
typedef struct _gpgme_trust_item *gpgme_trust_item_t;
/* Start a trustlist operation within CTX, searching for trust items
which match PATTERN. */
gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx,
const char *pattern, int max_level);
/* Return the next trust item from the trustlist in R_ITEM. */
gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx,
gpgme_trust_item_t *r_item);
/* Terminate a pending trustlist operation within CTX. */
gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx);
/* Acquire a reference to ITEM. */
void gpgme_trust_item_ref (gpgme_trust_item_t item);
/* Release a reference to ITEM. If this was the last one the trust
item is destroyed. */
void gpgme_trust_item_unref (gpgme_trust_item_t item);
/* Release the trust item ITEM. Deprecated, use
gpgme_trust_item_unref. */
void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of ITEM, which has to be
representable by a string. Deprecated, use trust item structure
directly. */
const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item,
_gpgme_attr_t what,
const void *reserved, int idx)
_GPGME_DEPRECATED;
/* Return the value of the attribute WHAT of KEY, which has to be
representable by an integer. IDX specifies a running index if the
attribute appears more than once in the key. Deprecated, use trust
item structure directly. */
int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what,
const void *reserved, int idx)
_GPGME_DEPRECATED;
/* 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);
+
+/* Interface to gpg-conf. */
+
+/* The expert level at which a configuration option or group of
+ options should be displayed. See the gpg-conf documentation for
+ more details. */
+typedef enum
+ {
+ GPGME_CONF_BASIC = 0,
+ GPGME_CONF_ADVANCED = 1,
+ GPGME_CONF_EXPERT = 2,
+ GPGME_CONF_INVISIBLE = 3,
+ GPGME_CONF_INTERNAL = 4
+ }
+gpgme_conf_level_t;
+
+
+/* The data type of a configuration option argument. See the gpg-conf
+ documentation for more details. */
+typedef enum
+ {
+ /* Basic types. */
+ GPGME_CONF_NONE = 0,
+ GPGME_CONF_STRING = 1,
+ GPGME_CONF_INT32 = 2,
+ GPGME_CONF_UINT32 = 3,
+
+ /* Complex types. */
+ GPGME_CONF_PATHNAME = 32,
+ GPGME_CONF_LDAP_SERVER = 33
+ }
+gpgme_conf_type_t;
+
+
+/* This represents a single argument for a configuration option.
+ Which of the members of value is used depends on the ALT_TYPE. */
+typedef struct gpgme_conf_arg
+{
+ struct gpgme_conf_arg *next;
+ /* True if the option appears without an (optional) argument. */
+ unsigned int no_arg;
+ union
+ {
+ unsigned int count;
+ unsigned int uint32;
+ int int32;
+ char *string;
+ } value;
+} *gpgme_conf_arg_t;
+
+
+/* The flags of a configuration option. See the gpg-conf
+ documentation for details. */
+#define GPGME_CONF_GROUP (1 << 0)
+#define GPGME_CONF_OPTIONAL (1 << 1)
+#define GPGME_CONF_LIST (1 << 2)
+#define GPGME_CONF_RUNTIME (1 << 3)
+#define GPGME_CONF_DEFAULT (1 << 4)
+#define GPGME_CONF_DEFAULT_DESC (1 << 5)
+#define GPGME_CONF_NO_ARG_DESC (1 << 6)
+#define GPGME_CONF_NO_CHANGE (1 << 7)
+
+
+/* The representation of a single configuration option. See the
+ gpg-conf documentation for details. */
+typedef struct gpgme_conf_opt
+{
+ struct gpgme_conf_opt *next;
+
+ /* The option name. */
+ char *name;
+
+ /* The flags for this option. */
+ unsigned int flags;
+
+ /* The level of this option. */
+ gpgme_conf_level_t level;
+
+ /* The localized description of this option. */
+ char *description;
+
+ /* The type and alternate type of this option. */
+ gpgme_conf_type_t type;
+ gpgme_conf_type_t alt_type;
+
+ /* The localized (short) name of the argument, if any. */
+ char *argname;
+
+ /* The default value. */
+ gpgme_conf_arg_t default_value;
+ char *default_description;
+
+ /* The default value if the option is not set. */
+ gpgme_conf_arg_t no_arg_value;
+ char *no_arg_description;
+
+ /* The current value if the option is set. */
+ gpgme_conf_arg_t value;
+
+ /* The new value, if any. NULL means reset to default. */
+ int change_value;
+ gpgme_conf_arg_t new_value;
+
+ /* Free for application use. */
+ void *user_data;
+} *gpgme_conf_opt_t;
+
+
+/* The representation of a component that can be configured. See the
+ gpg-conf documentation for details. */
+typedef struct gpgme_conf_comp
+{
+ struct gpgme_conf_comp *next;
+
+ /* Internal to GPGME, do not use! */
+ gpgme_conf_opt_t *_last_opt_p;
+
+ /* The component name. */
+ char *name;
+
+ /* A human-readable description for the component. */
+ char *description;
+
+ /* The program name (an absolute path to the program). */
+ char *program_name;
+
+ /* A linked list of options for this component. */
+ struct gpgme_conf_opt *options;
+} *gpgme_conf_comp_t;
+
+
+/* Allocate a new gpgme_conf_arg_t. If VALUE is NULL, a "no arg
+ default" is prepared. If type is a string type, VALUE should point
+ to the string. Else, it should point to an unsigned or signed
+ integer respectively. */
+gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
+ gpgme_conf_type_t type, void *value);
+
+/* This also releases all chained argument structures! */
+void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
+
+/* Register a change for the value of OPT to ARG. If RESET is 1 (do
+ not use any values but 0 or 1), ARG is ignored and the option is
+ not changed (reverting a previous change). Otherwise, if ARG is
+ NULL, the option is cleared or reset to its default. */
+gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
+ gpgme_conf_arg_t arg);
+
+/* Release a set of configurations. */
+void gpgme_conf_release (gpgme_conf_comp_t conf);
+
+/* Retrieve the current configurations. */
+gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p);
+
+/* Save the configuration of component comp. This function does not
+ follow chained components! */
+gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
/* Various functions. */
/* Check that the library fulfills the version requirement. */
const char *gpgme_check_version (const char *req_version);
/* 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. The
returned data is valid until the next gpgme_set_engine_info. */
gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info);
/* Set the default engine info for the protocol PROTO to the file name
FILE_NAME and the home directory HOME_DIR. */
gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto,
const char *file_name,
const char *home_dir);
/* Engine support functions. */
/* Verify that the engine implementing PROTO is installed and
available. */
gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto);
/* Deprecated types. */
typedef gpgme_ctx_t GpgmeCtx _GPGME_DEPRECATED;
typedef gpgme_data_t GpgmeData _GPGME_DEPRECATED;
typedef gpgme_error_t GpgmeError _GPGME_DEPRECATED;
typedef gpgme_data_encoding_t GpgmeDataEncoding _GPGME_DEPRECATED;
typedef gpgme_pubkey_algo_t GpgmePubKeyAlgo _GPGME_DEPRECATED;
typedef gpgme_hash_algo_t GpgmeHashAlgo _GPGME_DEPRECATED;
typedef gpgme_sig_stat_t GpgmeSigStat _GPGME_DEPRECATED;
typedef gpgme_sig_mode_t GpgmeSigMode _GPGME_DEPRECATED;
typedef gpgme_attr_t GpgmeAttr _GPGME_DEPRECATED;
typedef gpgme_validity_t GpgmeValidity _GPGME_DEPRECATED;
typedef gpgme_protocol_t GpgmeProtocol _GPGME_DEPRECATED;
typedef gpgme_engine_info_t GpgmeEngineInfo _GPGME_DEPRECATED;
typedef gpgme_subkey_t GpgmeSubkey _GPGME_DEPRECATED;
typedef gpgme_key_sig_t GpgmeKeySig _GPGME_DEPRECATED;
typedef gpgme_user_id_t GpgmeUserID _GPGME_DEPRECATED;
typedef gpgme_key_t GpgmeKey _GPGME_DEPRECATED;
typedef gpgme_passphrase_cb_t GpgmePassphraseCb _GPGME_DEPRECATED;
typedef gpgme_progress_cb_t GpgmeProgressCb _GPGME_DEPRECATED;
typedef gpgme_io_cb_t GpgmeIOCb _GPGME_DEPRECATED;
typedef gpgme_register_io_cb_t GpgmeRegisterIOCb _GPGME_DEPRECATED;
typedef gpgme_remove_io_cb_t GpgmeRemoveIOCb _GPGME_DEPRECATED;
typedef gpgme_event_io_t GpgmeEventIO _GPGME_DEPRECATED;
typedef gpgme_event_io_cb_t GpgmeEventIOCb _GPGME_DEPRECATED;
#define GpgmeIOCbs gpgme_io_cbs
typedef gpgme_data_read_cb_t GpgmeDataReadCb _GPGME_DEPRECATED;
typedef gpgme_data_write_cb_t GpgmeDataWriteCb _GPGME_DEPRECATED;
typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED;
typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED;
#define GpgmeDataCbs gpgme_data_cbs
typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED;
typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED;
typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED;
typedef gpgme_verify_result_t GpgmeVerifyResult _GPGME_DEPRECATED;
typedef gpgme_import_status_t GpgmeImportStatus _GPGME_DEPRECATED;
typedef gpgme_import_result_t GpgmeImportResult _GPGME_DEPRECATED;
typedef gpgme_genkey_result_t GpgmeGenKeyResult _GPGME_DEPRECATED;
typedef gpgme_trust_item_t GpgmeTrustItem _GPGME_DEPRECATED;
typedef gpgme_status_code_t GpgmeStatusCode _GPGME_DEPRECATED;
#ifdef __cplusplus
}
#endif
#endif /* GPGME_H */
diff --git a/gpgme/libgpgme.vers b/gpgme/libgpgme.vers
index 9f18dafc..183a3943 100644
--- a/gpgme/libgpgme.vers
+++ b/gpgme/libgpgme.vers
@@ -1,170 +1,177 @@
# libgpgme.vers - List of symbols to export.
# Copyright (C) 2002, 2004, 2005 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#-------------------------------------------------------
# Please remember to add new functions also to gpgme.def
#-------------------------------------------------------
GPGME_1.1 {
global:
gpgme_set_engine_info;
gpgme_ctx_get_engine_info;
gpgme_ctx_set_engine_info;
gpgme_data_set_file_name;
gpgme_data_get_file_name;
gpgme_sig_notation_clear;
gpgme_sig_notation_add;
gpgme_sig_notation_get;
gpgme_free;
gpgme_op_getauditlog_start;
gpgme_op_getauditlog;
+
+ gpgme_conf_release;
+ gpgme_conf_arg_new;
+ gpgme_conf_arg_release;
+ gpgme_conf_opt_change;
+ gpgme_op_conf_load;
+ gpgme_op_conf_save;
};
GPGME_1.0 {
global:
gpgme_check_version;
gpgme_get_engine_info;
gpgme_engine_check_version;
gpgme_err_code_from_errno;
gpgme_err_code_to_errno;
gpgme_err_make_from_errno;
gpgme_error_from_errno;
gpgme_strerror;
gpgme_strerror_r;
gpgme_strsource;
gpgme_data_get_encoding;
gpgme_data_new;
gpgme_data_new_from_cbs;
gpgme_data_new_from_fd;
gpgme_data_new_from_file;
gpgme_data_new_from_filepart;
gpgme_data_new_from_mem;
gpgme_data_new_from_stream;
gpgme_data_read;
gpgme_data_release;
gpgme_data_release_and_get_mem;
gpgme_data_seek;
gpgme_data_set_encoding;
gpgme_data_write;
gpgme_get_protocol_name;
gpgme_hash_algo_name;
gpgme_pubkey_algo_name;
gpgme_new;
gpgme_get_armor;
gpgme_get_include_certs;
gpgme_get_io_cbs;
gpgme_get_keylist_mode;
gpgme_get_passphrase_cb;
gpgme_get_progress_cb;
gpgme_get_protocol;
gpgme_get_textmode;
gpgme_release;
gpgme_set_armor;
gpgme_set_include_certs;
gpgme_set_io_cbs;
gpgme_set_keylist_mode;
gpgme_set_locale;
gpgme_set_passphrase_cb;
gpgme_set_progress_cb;
gpgme_set_protocol;
gpgme_set_textmode;
gpgme_signers_add;
gpgme_signers_clear;
gpgme_signers_enum;
gpgme_key_ref;
gpgme_key_unref;
gpgme_key_release;
gpgme_trust_item_ref;
gpgme_trust_item_unref;
gpgme_cancel;
gpgme_op_card_edit;
gpgme_op_card_edit_start;
gpgme_op_decrypt;
gpgme_op_decrypt_result;
gpgme_op_decrypt_start;
gpgme_op_decrypt_verify;
gpgme_op_decrypt_verify_start;
gpgme_op_delete;
gpgme_op_delete_start;
gpgme_op_edit;
gpgme_op_edit_start;
gpgme_op_encrypt;
gpgme_op_encrypt_result;
gpgme_op_encrypt_sign;
gpgme_op_encrypt_sign_start;
gpgme_op_encrypt_start;
gpgme_op_export;
gpgme_op_export_ext;
gpgme_op_export_ext_start;
gpgme_op_export_start;
gpgme_op_genkey;
gpgme_op_genkey_result;
gpgme_op_genkey_start;
gpgme_get_key;
gpgme_op_import;
gpgme_op_import_result;
gpgme_op_import_start;
gpgme_op_keylist_end;
gpgme_op_keylist_ext_start;
gpgme_op_keylist_next;
gpgme_op_keylist_result;
gpgme_op_keylist_start;
gpgme_op_sign;
gpgme_op_sign_result;
gpgme_op_sign_start;
gpgme_op_trustlist_end;
gpgme_op_trustlist_next;
gpgme_op_trustlist_start;
gpgme_op_verify;
gpgme_op_verify_result;
gpgme_op_verify_start;
gpgme_wait;
gpgme_data_new_with_read_cb;
gpgme_data_rewind;
gpgme_get_sig_status;
gpgme_get_sig_string_attr;
gpgme_get_sig_ulong_attr;
gpgme_get_sig_key;
gpgme_key_get_string_attr;
gpgme_key_get_ulong_attr;
gpgme_key_sig_get_string_attr;
gpgme_key_sig_get_ulong_attr;
gpgme_op_import_ext;
gpgme_trust_item_get_int_attr;
gpgme_trust_item_get_string_attr;
gpgme_trust_item_release;
local:
*;
};
diff --git a/gpgme/op-support.c b/gpgme/op-support.c
index 20c07385..1212c542 100644
--- a/gpgme/op-support.c
+++ b/gpgme/op-support.c
@@ -1,293 +1,295 @@
/* op-support.c - Supporting functions.
Copyright (C) 2002, 2003, 2004, 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 <stdlib.h>
#include <errno.h>
#include <string.h>
#include <locale.h>
#include "gpgme.h"
#include "context.h"
#include "ops.h"
gpgme_error_t
_gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type, void **hook,
int size, void (*cleanup) (void *))
{
struct ctx_op_data *data = ctx->op_data;
while (data && data->type != type)
data = data->next;
if (!data)
{
if (size < 0)
{
*hook = NULL;
return 0;
}
data = calloc (1, sizeof (struct ctx_op_data) + size);
if (!data)
return gpg_error_from_errno (errno);
data->next = ctx->op_data;
data->type = type;
data->cleanup = cleanup;
data->hook = (void *) (((char *) data) + sizeof (struct ctx_op_data));
ctx->op_data = data;
}
*hook = data->hook;
return 0;
}
/* 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).
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 && no_reset)
reuse_engine = 1;
else if (ctx->engine)
{
/* Attempt to reset an existing engine. */
err = _gpgme_engine_reset (ctx->engine);
if (gpg_err_code (err) == GPG_ERR_NOT_IMPLEMENTED)
{
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
}
if (!ctx->engine)
{
gpgme_engine_info_t info;
info = ctx->engine_info;
while (info && info->protocol != ctx->protocol)
info = info->next;
if (!info)
return gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL);
/* Create an engine object. */
err = _gpgme_engine_new (info, &ctx->engine);
if (err)
return err;
}
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);
#endif
+ if (gpg_err_code (err) == GPG_ERR_NOT_IMPLEMENTED)
+ err = 0;
if (err)
{
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
return err;
}
}
if (type == 1 || (type == 2 && !ctx->io_cbs.add))
{
/* Use private event loop. */
io_cbs.add = _gpgme_add_io_cb;
io_cbs.add_priv = ctx;
io_cbs.remove = _gpgme_remove_io_cb;
io_cbs.event = _gpgme_wait_private_event_cb;
io_cbs.event_priv = ctx;
}
else if (! ctx->io_cbs.add)
{
/* Use global event loop. */
io_cbs.add = _gpgme_add_io_cb;
io_cbs.add_priv = ctx;
io_cbs.remove = _gpgme_remove_io_cb;
io_cbs.event = _gpgme_wait_global_event_cb;
io_cbs.event_priv = ctx;
}
else
{
/* Use user event loop. */
io_cbs.add = _gpgme_wait_user_add_io_cb;
io_cbs.add_priv = ctx;
io_cbs.remove = _gpgme_wait_user_remove_io_cb;
io_cbs.event = _gpgme_wait_user_event_cb;
io_cbs.event_priv = ctx;
}
_gpgme_engine_set_io_cbs (ctx->engine, &io_cbs);
return err;
}
/* Parse the INV_RECP status line in ARGS and return the result in
KEY. */
gpgme_error_t
_gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key)
{
gpgme_invalid_key_t inv_key;
char *tail;
long int reason;
inv_key = malloc (sizeof (*inv_key));
if (!inv_key)
return gpg_error_from_errno (errno);
inv_key->next = NULL;
errno = 0;
reason = strtol (args, &tail, 0);
if (errno || args == tail || *tail != ' ')
{
/* The crypto backend does not behave. */
free (inv_key);
return gpg_error (GPG_ERR_INV_ENGINE);
}
switch (reason)
{
default:
case 0:
inv_key->reason = gpg_error (GPG_ERR_GENERAL);
break;
case 1:
inv_key->reason = gpg_error (GPG_ERR_NO_PUBKEY);
break;
case 2:
inv_key->reason = gpg_error (GPG_ERR_AMBIGUOUS_NAME);
break;
case 3:
inv_key->reason = gpg_error (GPG_ERR_WRONG_KEY_USAGE);
break;
case 4:
inv_key->reason = gpg_error (GPG_ERR_CERT_REVOKED);
break;
case 5:
inv_key->reason = gpg_error (GPG_ERR_CERT_EXPIRED);
break;
case 6:
inv_key->reason = gpg_error (GPG_ERR_NO_CRL_KNOWN);
break;
case 7:
inv_key->reason = gpg_error (GPG_ERR_CRL_TOO_OLD);
break;
case 8:
inv_key->reason = gpg_error (GPG_ERR_NO_POLICY_MATCH);
break;
case 9:
inv_key->reason = gpg_error (GPG_ERR_NO_SECKEY);
break;
case 10:
inv_key->reason = gpg_error (GPG_ERR_PUBKEY_NOT_TRUSTED);
break;
case 11:
inv_key->reason = gpg_error (GPG_ERR_MISSING_CERT);
break;
}
while (*tail == ' ')
tail++;
if (*tail)
{
inv_key->fpr = strdup (tail);
if (!inv_key->fpr)
{
int saved_errno = errno;
free (inv_key);
return gpg_error_from_errno (saved_errno);
}
}
else
inv_key->fpr = NULL;
*key = inv_key;
return 0;
}
/* Parse the PLAINTEXT status line in ARGS and return the result in
FILENAMEP. */
gpgme_error_t
_gpgme_parse_plaintext (char *args, char **filenamep)
{
char *tail;
while (*args == ' ')
args++;
if (*args == '\0')
return 0;
/* First argument is file type. */
while (*args != ' ' && *args != '\0')
args++;
while (*args == ' ')
args++;
if (*args == '\0')
return 0;
/* Second argument is the timestamp. */
while (*args != ' ' && *args != '\0')
args++;
while (*args == ' ')
args++;
if (*args == '\0')
return 0;
tail = args;
while (*tail != ' ' && *tail != '\0')
tail++;
*tail = '\0';
if (filenamep && *args != '\0')
{
char *filename = strdup (args);
if (!filename)
return gpg_error_from_errno (errno);
*filenamep = filename;
}
return 0;
}
diff --git a/gpgme/posix-util.c b/gpgme/posix-util.c
index d5b4172d..168dad6e 100644
--- a/gpgme/posix-util.c
+++ b/gpgme/posix-util.c
@@ -1,57 +1,67 @@
/* posix-util.c - Utility functions for Posix
Copyright (C) 2001 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2004 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, 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "util.h"
const char *
_gpgme_get_gpg_path (void)
{
#ifdef GPG_PATH
return GPG_PATH;
#else
return NULL;
#endif
}
const char *
_gpgme_get_gpgsm_path (void)
{
#ifdef GPGSM_PATH
return GPGSM_PATH;
#else
return NULL;
#endif
}
+const char *
+_gpgme_get_gpgconf_path (void)
+{
+#ifdef GPGCONF_PATH
+ return GPGCONF_PATH;
+#else
+ return NULL;
+#endif
+}
+
/* See w32-util.c */
int
_gpgme_get_conf_int (const char *key, int *value)
{
return 0;
}
diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c
index c54da3a2..0ffdc7c7 100644
--- a/gpgme/rungpg.c
+++ b/gpgme/rungpg.c
@@ -1,2127 +1,2129 @@
/* rungpg.c - Gpg Engine.
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <locale.h>
#include "gpgme.h"
#include "util.h"
#include "ops.h"
#include "wait.h"
#include "context.h" /*temp hack until we have GpmeData methods to do I/O */
#include "priv-io.h"
#include "sema.h"
#include "debug.h"
#include "status-table.h"
#include "engine-backend.h"
/* This type is used to build a list of gpg arguments and data
sources/sinks. */
struct arg_and_data_s
{
struct arg_and_data_s *next;
gpgme_data_t data; /* If this is not NULL, use arg below. */
int inbound; /* True if this is used for reading from gpg. */
int dup_to;
int print_fd; /* Print the fd number and not the special form of it. */
char arg[1]; /* Used if data above is not used. */
};
struct fd_data_map_s
{
gpgme_data_t data;
int inbound; /* true if this is used for reading from gpg */
int dup_to;
int fd; /* the fd to use */
int peer_fd; /* the outher side of the pipe */
void *tag;
};
typedef gpgme_error_t (*colon_preprocessor_t) (char *line, char **rline);
struct engine_gpg
{
char *file_name;
char *lc_messages;
char *lc_ctype;
struct arg_and_data_s *arglist;
struct arg_and_data_s **argtail;
struct
{
int fd[2];
size_t bufsize;
char *buffer;
size_t readpos;
int eof;
engine_status_handler_t fnc;
void *fnc_value;
void *tag;
} status;
/* This is a kludge - see the comment at colon_line_handler. */
struct
{
int fd[2];
size_t bufsize;
char *buffer;
size_t readpos;
int eof;
engine_colon_line_handler_t fnc; /* this indicate use of this structrue */
void *fnc_value;
void *tag;
colon_preprocessor_t preprocess_fnc;
} colon;
char **argv;
struct fd_data_map_s *fd_data_map;
/* stuff needed for interactive (command) mode */
struct
{
int used;
int fd;
void *cb_data;
int idx; /* Index in fd_data_map */
gpgme_status_code_t code; /* last code */
char *keyword; /* what has been requested (malloced) */
engine_command_handler_t fnc;
void *fnc_value;
/* The kludges never end. This is used to couple command handlers
with output data in edit key mode. */
gpgme_data_t linked_data;
int linked_idx;
} cmd;
struct gpgme_io_cbs io_cbs;
};
typedef struct engine_gpg *engine_gpg_t;
static void
gpg_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{
engine_gpg_t gpg = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:gpg_io_event", gpg,
"event %p, type %d, type_data %p",
gpg->io_cbs.event, type, type_data);
if (gpg->io_cbs.event)
(*gpg->io_cbs.event) (gpg->io_cbs.event_priv, type, type_data);
}
static void
close_notify_handler (int fd, void *opaque)
{
engine_gpg_t gpg = opaque;
assert (fd != -1);
if (gpg->status.fd[0] == fd)
{
if (gpg->status.tag)
(*gpg->io_cbs.remove) (gpg->status.tag);
gpg->status.fd[0] = -1;
}
else if (gpg->status.fd[1] == fd)
gpg->status.fd[1] = -1;
else if (gpg->colon.fd[0] == fd)
{
if (gpg->colon.tag)
(*gpg->io_cbs.remove) (gpg->colon.tag);
gpg->colon.fd[0] = -1;
}
else if (gpg->colon.fd[1] == fd)
gpg->colon.fd[1] = -1;
else if (gpg->fd_data_map)
{
int i;
for (i = 0; gpg->fd_data_map[i].data; i++)
{
if (gpg->fd_data_map[i].fd == fd)
{
if (gpg->fd_data_map[i].tag)
(*gpg->io_cbs.remove) (gpg->fd_data_map[i].tag);
gpg->fd_data_map[i].fd = -1;
break;
}
if (gpg->fd_data_map[i].peer_fd == fd)
{
gpg->fd_data_map[i].peer_fd = -1;
break;
}
}
}
}
/* If FRONT is true, push at the front of the list. Use this for
options added late in the process. */
static gpgme_error_t
add_arg_ext (engine_gpg_t gpg, const char *arg, int front)
{
struct arg_and_data_s *a;
assert (gpg);
assert (arg);
a = malloc (sizeof *a + strlen (arg));
if (!a)
return gpg_error_from_errno (errno);
a->data = NULL;
a->dup_to = -1;
strcpy (a->arg, arg);
if (front)
{
a->next = gpg->arglist;
if (!gpg->arglist)
{
/* If this is the first argument, we need to update the tail
pointer. */
gpg->argtail = &a->next;
}
gpg->arglist = a;
}
else
{
a->next = NULL;
*gpg->argtail = a;
gpg->argtail = &a->next;
}
return 0;
}
static gpgme_error_t
add_arg (engine_gpg_t gpg, const char *arg)
{
return add_arg_ext (gpg, arg, 0);
}
static gpgme_error_t
add_data (engine_gpg_t gpg, gpgme_data_t data, int dup_to, int inbound)
{
struct arg_and_data_s *a;
assert (gpg);
assert (data);
a = malloc (sizeof *a - 1);
if (!a)
return gpg_error_from_errno (errno);
a->next = NULL;
a->data = data;
a->inbound = inbound;
if (dup_to == -2)
{
a->print_fd = 1;
a->dup_to = -1;
}
else
{
a->print_fd = 0;
a->dup_to = dup_to;
}
*gpg->argtail = a;
gpg->argtail = &a->next;
return 0;
}
static char *
gpg_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
: _gpgme_get_gpg_path ());
}
static const char *
gpg_get_req_version (void)
{
return NEED_GPG_VERSION;
}
static void
free_argv (char **argv)
{
int i;
for (i = 0; argv[i]; i++)
free (argv[i]);
free (argv);
}
static void
free_fd_data_map (struct fd_data_map_s *fd_data_map)
{
int i;
if (!fd_data_map)
return;
for (i = 0; fd_data_map[i].data; i++)
{
if (fd_data_map[i].fd != -1)
_gpgme_io_close (fd_data_map[i].fd);
if (fd_data_map[i].peer_fd != -1)
_gpgme_io_close (fd_data_map[i].peer_fd);
/* Don't release data because this is only a reference. */
}
free (fd_data_map);
}
static gpgme_error_t
gpg_cancel (void *engine)
{
engine_gpg_t gpg = engine;
if (!gpg)
return gpg_error (GPG_ERR_INV_VALUE);
if (gpg->status.fd[0] != -1)
_gpgme_io_close (gpg->status.fd[0]);
if (gpg->status.fd[1] != -1)
_gpgme_io_close (gpg->status.fd[1]);
if (gpg->colon.fd[0] != -1)
_gpgme_io_close (gpg->colon.fd[0]);
if (gpg->colon.fd[1] != -1)
_gpgme_io_close (gpg->colon.fd[1]);
if (gpg->fd_data_map)
{
free_fd_data_map (gpg->fd_data_map);
gpg->fd_data_map = NULL;
}
if (gpg->cmd.fd != -1)
_gpgme_io_close (gpg->cmd.fd);
return 0;
}
static void
gpg_release (void *engine)
{
engine_gpg_t gpg = engine;
if (!gpg)
return;
gpg_cancel (engine);
if (gpg->file_name)
free (gpg->file_name);
if (gpg->lc_messages)
free (gpg->lc_messages);
if (gpg->lc_ctype)
free (gpg->lc_ctype);
while (gpg->arglist)
{
struct arg_and_data_s *next = gpg->arglist->next;
if (gpg->arglist)
free (gpg->arglist);
gpg->arglist = next;
}
if (gpg->status.buffer)
free (gpg->status.buffer);
if (gpg->colon.buffer)
free (gpg->colon.buffer);
if (gpg->argv)
free_argv (gpg->argv);
if (gpg->cmd.keyword)
free (gpg->cmd.keyword);
free (gpg);
}
static gpgme_error_t
gpg_new (void **engine, const char *file_name, const char *home_dir)
{
engine_gpg_t gpg;
gpgme_error_t rc = 0;
char *dft_display = NULL;
char dft_ttyname[64];
char *dft_ttytype = NULL;
gpg = calloc (1, sizeof *gpg);
if (!gpg)
return gpg_error_from_errno (errno);
if (file_name)
{
gpg->file_name = strdup (file_name);
if (!gpg->file_name)
{
rc = gpg_error_from_errno (errno);
goto leave;
}
}
gpg->argtail = &gpg->arglist;
gpg->status.fd[0] = -1;
gpg->status.fd[1] = -1;
gpg->colon.fd[0] = -1;
gpg->colon.fd[1] = -1;
gpg->cmd.fd = -1;
gpg->cmd.idx = -1;
gpg->cmd.linked_data = NULL;
gpg->cmd.linked_idx = -1;
/* Allocate the read buffer for the status pipe. */
gpg->status.bufsize = 1024;
gpg->status.readpos = 0;
gpg->status.buffer = malloc (gpg->status.bufsize);
if (!gpg->status.buffer)
{
rc = gpg_error_from_errno (errno);
goto leave;
}
/* In any case we need a status pipe - create it right here and
don't handle it with our generic gpgme_data_t mechanism. */
if (_gpgme_io_pipe (gpg->status.fd, 1) == -1)
{
rc = gpg_error_from_errno (errno);
goto leave;
}
if (_gpgme_io_set_close_notify (gpg->status.fd[0],
close_notify_handler, gpg)
|| _gpgme_io_set_close_notify (gpg->status.fd[1],
close_notify_handler, gpg))
{
rc = gpg_error (GPG_ERR_GENERAL);
goto leave;
}
gpg->status.eof = 0;
if (home_dir)
{
rc = add_arg (gpg, "--homedir");
if (!rc)
rc = add_arg (gpg, home_dir);
if (rc)
goto leave;
}
rc = add_arg (gpg, "--status-fd");
if (rc)
goto leave;
{
char buf[25];
_gpgme_io_fd2str (buf, sizeof (buf), gpg->status.fd[1]);
rc = add_arg (gpg, buf);
if (rc)
goto leave;
}
rc = add_arg (gpg, "--no-tty");
if (!rc)
rc = add_arg (gpg, "--charset");
if (!rc)
rc = add_arg (gpg, "utf8");
if (!rc)
rc = add_arg (gpg, "--enable-progress-filter");
if (rc)
goto leave;
rc = _gpgme_getenv ("DISPLAY", &dft_display);
if (rc)
goto leave;
if (dft_display)
{
rc = add_arg (gpg, "--display");
if (!rc)
rc = add_arg (gpg, dft_display);
free (dft_display);
}
if (isatty (1))
{
int err;
err = ttyname_r (1, dft_ttyname, sizeof (dft_ttyname));
if (err)
rc = gpg_error_from_errno (errno);
else
{
if (dft_ttyname)
{
rc = add_arg (gpg, "--ttyname");
if (!rc)
rc = add_arg (gpg, dft_ttyname);
}
else
rc = 0;
if (!rc)
{
rc = _gpgme_getenv ("TERM", &dft_ttytype);
if (rc)
goto leave;
if (dft_ttytype)
{
rc = add_arg (gpg, "--ttytype");
if (!rc)
rc = add_arg (gpg, dft_ttytype);
}
free (dft_ttytype);
}
}
if (rc)
goto leave;
}
leave:
if (rc)
gpg_release (gpg);
else
*engine = gpg;
return rc;
}
static gpgme_error_t
gpg_set_locale (void *engine, int category, const char *value)
{
engine_gpg_t gpg = engine;
if (category == LC_CTYPE)
{
if (gpg->lc_ctype)
{
free (gpg->lc_ctype);
gpg->lc_ctype = NULL;
}
if (value)
{
gpg->lc_ctype = strdup (value);
if (!gpg->lc_ctype)
return gpg_error_from_syserror ();
}
}
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
if (gpg->lc_messages)
{
free (gpg->lc_messages);
gpg->lc_messages = NULL;
}
if (value)
{
gpg->lc_messages = strdup (value);
if (!gpg->lc_messages)
return gpg_error_from_syserror ();
}
}
#endif /* LC_MESSAGES */
else
return gpg_error (GPG_ERR_INV_VALUE);
return 0;
}
/* Note, that the status_handler is allowed to modifiy the args
value. */
static void
gpg_set_status_handler (void *engine, engine_status_handler_t fnc,
void *fnc_value)
{
engine_gpg_t gpg = engine;
gpg->status.fnc = fnc;
gpg->status.fnc_value = fnc_value;
}
/* Kludge to process --with-colon output. */
static gpgme_error_t
gpg_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc,
void *fnc_value)
{
engine_gpg_t gpg = engine;
gpg->colon.bufsize = 1024;
gpg->colon.readpos = 0;
gpg->colon.buffer = malloc (gpg->colon.bufsize);
if (!gpg->colon.buffer)
return gpg_error_from_errno (errno);
if (_gpgme_io_pipe (gpg->colon.fd, 1) == -1)
{
int saved_errno = errno;
free (gpg->colon.buffer);
gpg->colon.buffer = NULL;
return gpg_error_from_errno (saved_errno);
}
if (_gpgme_io_set_close_notify (gpg->colon.fd[0], close_notify_handler, gpg)
|| _gpgme_io_set_close_notify (gpg->colon.fd[1],
close_notify_handler, gpg))
return gpg_error (GPG_ERR_GENERAL);
gpg->colon.eof = 0;
gpg->colon.fnc = fnc;
gpg->colon.fnc_value = fnc_value;
return 0;
}
static gpgme_error_t
command_handler (void *opaque, int fd)
{
gpgme_error_t err;
engine_gpg_t gpg = (engine_gpg_t) opaque;
int processed = 0;
assert (gpg->cmd.used);
assert (gpg->cmd.code);
assert (gpg->cmd.fnc);
err = gpg->cmd.fnc (gpg->cmd.fnc_value, gpg->cmd.code, gpg->cmd.keyword, fd,
&processed);
if (err)
return err;
/* We always need to send at least a newline character. */
if (!processed)
_gpgme_io_write (fd, "\n", 1);
gpg->cmd.code = 0;
/* And sleep again until read_status will wake us up again. */
/* XXX We must check if there are any more fds active after removing
this one. */
(*gpg->io_cbs.remove) (gpg->fd_data_map[gpg->cmd.idx].tag);
gpg->cmd.fd = gpg->fd_data_map[gpg->cmd.idx].fd;
gpg->fd_data_map[gpg->cmd.idx].fd = -1;
return 0;
}
/* The Fnc will be called to get a value for one of the commands with
a key KEY. If the Code pssed to FNC is 0, the function may release
resources associated with the returned value from another call. To
match such a second call to a first call, the returned value from
the first call is passed as keyword. */
static gpgme_error_t
gpg_set_command_handler (void *engine, engine_command_handler_t fnc,
void *fnc_value, gpgme_data_t linked_data)
{
engine_gpg_t gpg = engine;
gpgme_error_t rc;
rc = add_arg (gpg, "--command-fd");
if (rc)
return rc;
/* This is a hack. We don't have a real data object. The only
thing that matters is that we use something unique, so we use the
address of the cmd structure in the gpg object. */
rc = add_data (gpg, (void *) &gpg->cmd, -2, 0);
if (rc)
return rc;
gpg->cmd.fnc = fnc;
gpg->cmd.cb_data = (void *) &gpg->cmd;
gpg->cmd.fnc_value = fnc_value;
gpg->cmd.linked_data = linked_data;
gpg->cmd.used = 1;
return 0;
}
static gpgme_error_t
build_argv (engine_gpg_t gpg)
{
gpgme_error_t err;
struct arg_and_data_s *a;
struct fd_data_map_s *fd_data_map;
size_t datac=0, argc=0;
char **argv;
int need_special = 0;
int use_agent = 0;
char *p;
/* We don't want to use the agent with a malformed environment
variable. This is only a very basic test but sufficient to make
our life in the regression tests easier. */
err = _gpgme_getenv ("GPG_AGENT_INFO", &p);
if (err)
return err;
use_agent = (p && strchr (p, ':'));
if (p)
free (p);
if (gpg->argv)
{
free_argv (gpg->argv);
gpg->argv = NULL;
}
if (gpg->fd_data_map)
{
free_fd_data_map (gpg->fd_data_map);
gpg->fd_data_map = NULL;
}
argc++; /* For argv[0]. */
for (a = gpg->arglist; a; a = a->next)
{
argc++;
if (a->data)
{
/*fprintf (stderr, "build_argv: data\n" );*/
datac++;
if (a->dup_to == -1 && !a->print_fd)
need_special = 1;
}
else
{
/* fprintf (stderr, "build_argv: arg=`%s'\n", a->arg );*/
}
}
if (need_special)
argc++;
if (use_agent)
argc++;
if (!gpg->cmd.used)
argc++; /* --batch */
argc += 1; /* --no-sk-comment */
argv = calloc (argc + 1, sizeof *argv);
if (!argv)
return gpg_error_from_errno (errno);
fd_data_map = calloc (datac + 1, sizeof *fd_data_map);
if (!fd_data_map)
{
int saved_errno = errno;
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc = datac = 0;
argv[argc] = strdup ("gpg"); /* argv[0] */
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc++;
if (need_special)
{
argv[argc] = strdup ("--enable-special-filenames");
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc++;
}
if (use_agent)
{
argv[argc] = strdup ("--use-agent");
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc++;
}
if (!gpg->cmd.used)
{
argv[argc] = strdup ("--batch");
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc++;
}
argv[argc] = strdup ("--no-sk-comment");
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc++;
for (a = gpg->arglist; a; a = a->next)
{
if (a->data)
{
/* Create a pipe to pass it down to gpg. */
fd_data_map[datac].inbound = a->inbound;
/* Create a pipe. */
{
int fds[2];
if (_gpgme_io_pipe (fds, fd_data_map[datac].inbound ? 1 : 0)
== -1)
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error (saved_errno);
}
if (_gpgme_io_set_close_notify (fds[0],
close_notify_handler, gpg)
|| _gpgme_io_set_close_notify (fds[1],
close_notify_handler,
gpg))
{
return gpg_error (GPG_ERR_GENERAL);
}
/* If the data_type is FD, we have to do a dup2 here. */
if (fd_data_map[datac].inbound)
{
fd_data_map[datac].fd = fds[0];
fd_data_map[datac].peer_fd = fds[1];
}
else
{
fd_data_map[datac].fd = fds[1];
fd_data_map[datac].peer_fd = fds[0];
}
}
/* Hack to get hands on the fd later. */
if (gpg->cmd.used)
{
if (gpg->cmd.cb_data == a->data)
{
assert (gpg->cmd.idx == -1);
gpg->cmd.idx = datac;
}
else if (gpg->cmd.linked_data == a->data)
{
assert (gpg->cmd.linked_idx == -1);
gpg->cmd.linked_idx = datac;
}
}
fd_data_map[datac].data = a->data;
fd_data_map[datac].dup_to = a->dup_to;
if (a->dup_to == -1)
{
char *ptr;
int buflen = 25;
argv[argc] = malloc (buflen);
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
ptr = argv[argc];
if (!a->print_fd)
{
*(ptr++) = '-';
*(ptr++) = '&';
buflen -= 2;
}
_gpgme_io_fd2str (ptr, buflen, fd_data_map[datac].peer_fd);
argc++;
}
datac++;
}
else
{
argv[argc] = strdup (a->arg);
if (!argv[argc])
{
int saved_errno = errno;
free (fd_data_map);
free_argv (argv);
return gpg_error_from_errno (saved_errno);
}
argc++;
}
}
gpg->argv = argv;
gpg->fd_data_map = fd_data_map;
return 0;
}
static gpgme_error_t
add_io_cb (engine_gpg_t gpg, int fd, int dir, gpgme_io_cb_t handler, void *data,
void **tag)
{
gpgme_error_t err;
err = (*gpg->io_cbs.add) (gpg->io_cbs.add_priv, fd, dir, handler, data, tag);
if (err)
return err;
if (!dir)
/* FIXME Kludge around poll() problem. */
err = _gpgme_io_set_nonblocking (fd);
return err;
}
static int
status_cmp (const void *ap, const void *bp)
{
const struct status_table_s *a = ap;
const struct status_table_s *b = bp;
return strcmp (a->name, b->name);
}
/* Handle the status output of GnuPG. This function does read entire
lines and passes them as C strings to the callback function (we can
use C Strings because the status output is always UTF-8 encoded).
Of course we have to buffer the lines to cope with long lines
e.g. with a large user ID. Note: We can optimize this to only cope
with status line code we know about and skip all other stuff
without buffering (i.e. without extending the buffer). */
static gpgme_error_t
read_status (engine_gpg_t gpg)
{
char *p;
int nread;
size_t bufsize = gpg->status.bufsize;
char *buffer = gpg->status.buffer;
size_t readpos = gpg->status.readpos;
assert (buffer);
if (bufsize - readpos < 256)
{
/* Need more room for the read. */
bufsize += 1024;
buffer = realloc (buffer, bufsize);
if (!buffer)
return gpg_error_from_errno (errno);
}
nread = _gpgme_io_read (gpg->status.fd[0],
buffer + readpos, bufsize-readpos);
if (nread == -1)
return gpg_error_from_errno (errno);
if (!nread)
{
gpg->status.eof = 1;
if (gpg->status.fnc)
{
gpgme_error_t err;
err = gpg->status.fnc (gpg->status.fnc_value, GPGME_STATUS_EOF, "");
if (err)
return err;
}
return 0;
}
while (nread > 0)
{
for (p = buffer + readpos; nread; nread--, p++)
{
if (*p == '\n')
{
/* (we require that the last line is terminated by a LF) */
if (p > buffer && p[-1] == '\r')
p[-1] = 0;
*p = 0;
if (!strncmp (buffer, "[GNUPG:] ", 9)
&& buffer[9] >= 'A' && buffer[9] <= 'Z')
{
struct status_table_s t, *r;
char *rest;
rest = strchr (buffer + 9, ' ');
if (!rest)
rest = p; /* Set to an empty string. */
else
*rest++ = 0;
t.name = buffer+9;
/* (the status table has one extra element) */
r = bsearch (&t, status_table, DIM(status_table) - 1,
sizeof t, status_cmp);
if (r)
{
if (gpg->cmd.used
&& (r->code == GPGME_STATUS_GET_BOOL
|| r->code == GPGME_STATUS_GET_LINE
|| r->code == GPGME_STATUS_GET_HIDDEN))
{
gpg->cmd.code = r->code;
if (gpg->cmd.keyword)
free (gpg->cmd.keyword);
gpg->cmd.keyword = strdup (rest);
if (!gpg->cmd.keyword)
return gpg_error_from_errno (errno);
/* This should be the last thing we have
received and the next thing will be that
the command handler does its action. */
if (nread > 1)
TRACE0 (DEBUG_CTX, "gpgme:read_status", 0,
"error: unexpected data");
add_io_cb (gpg, gpg->cmd.fd, 0,
command_handler, gpg,
&gpg->fd_data_map[gpg->cmd.idx].tag);
gpg->fd_data_map[gpg->cmd.idx].fd = gpg->cmd.fd;
gpg->cmd.fd = -1;
}
else if (gpg->status.fnc)
{
gpgme_error_t err;
err = gpg->status.fnc (gpg->status.fnc_value,
r->code, rest);
if (err)
return err;
}
if (r->code == GPGME_STATUS_END_STREAM)
{
if (gpg->cmd.used)
{
/* Before we can actually add the
command fd, we might have to flush
the linked output data pipe. */
if (gpg->cmd.linked_idx != -1
&& gpg->fd_data_map[gpg->cmd.linked_idx].fd
!= -1)
{
struct io_select_fd_s fds;
fds.fd =
gpg->fd_data_map[gpg->cmd.linked_idx].fd;
fds.for_read = 1;
fds.for_write = 0;
fds.opaque = NULL;
do
{
fds.signaled = 0;
_gpgme_io_select (&fds, 1, 1);
if (fds.signaled)
_gpgme_data_inbound_handler
(gpg->cmd.linked_data, fds.fd);
}
while (fds.signaled);
}
/* XXX We must check if there are any
more fds active after removing this
one. */
(*gpg->io_cbs.remove)
(gpg->fd_data_map[gpg->cmd.idx].tag);
gpg->cmd.fd = gpg->fd_data_map[gpg->cmd.idx].fd;
gpg->fd_data_map[gpg->cmd.idx].fd = -1;
}
}
}
}
/* To reuse the buffer for the next line we have to
shift the remaining data to the buffer start and
restart the loop Hmmm: We can optimize this function
by looking forward in the buffer to see whether a
second complete line is available and in this case
avoid the memmove for this line. */
nread--; p++;
if (nread)
memmove (buffer, p, nread);
readpos = 0;
break; /* the for loop */
}
else
readpos++;
}
}
/* Update the gpg object. */
gpg->status.bufsize = bufsize;
gpg->status.buffer = buffer;
gpg->status.readpos = readpos;
return 0;
}
static gpgme_error_t
status_handler (void *opaque, int fd)
{
engine_gpg_t gpg = opaque;
int err;
assert (fd == gpg->status.fd[0]);
err = read_status (gpg);
if (err)
return err;
if (gpg->status.eof)
_gpgme_io_close (fd);
return 0;
}
static gpgme_error_t
read_colon_line (engine_gpg_t gpg)
{
char *p;
int nread;
size_t bufsize = gpg->colon.bufsize;
char *buffer = gpg->colon.buffer;
size_t readpos = gpg->colon.readpos;
assert (buffer);
if (bufsize - readpos < 256)
{
/* Need more room for the read. */
bufsize += 1024;
buffer = realloc (buffer, bufsize);
if (!buffer)
return gpg_error_from_errno (errno);
}
nread = _gpgme_io_read (gpg->colon.fd[0], buffer+readpos, bufsize-readpos);
if (nread == -1)
return gpg_error_from_errno (errno);
if (!nread)
{
gpg->colon.eof = 1;
assert (gpg->colon.fnc);
gpg->colon.fnc (gpg->colon.fnc_value, NULL);
return 0;
}
while (nread > 0)
{
for (p = buffer + readpos; nread; nread--, p++)
{
if ( *p == '\n' )
{
/* (we require that the last line is terminated by a LF)
and we skip empty lines. Note: we use UTF8 encoding
and escaping of special characters. We require at
least one colon to cope with some other printed
information. */
*p = 0;
if (*buffer && strchr (buffer, ':'))
{
char *line = NULL;
if (gpg->colon.preprocess_fnc)
{
gpgme_error_t err;
err = gpg->colon.preprocess_fnc (buffer, &line);
if (err)
return err;
}
assert (gpg->colon.fnc);
gpg->colon.fnc (gpg->colon.fnc_value, line ? line : buffer);
if (line)
free (line);
}
/* To reuse the buffer for the next line we have to
shift the remaining data to the buffer start and
restart the loop Hmmm: We can optimize this function
by looking forward in the buffer to see whether a
second complete line is available and in this case
avoid the memmove for this line. */
nread--; p++;
if (nread)
memmove (buffer, p, nread);
readpos = 0;
break; /* The for loop. */
}
else
readpos++;
}
}
/* Update the gpg object. */
gpg->colon.bufsize = bufsize;
gpg->colon.buffer = buffer;
gpg->colon.readpos = readpos;
return 0;
}
/* This colonline handler thing is not the clean way to do it. It
might be better to enhance the gpgme_data_t object to act as a wrapper
for a callback. Same goes for the status thing. For now we use
this thing here because it is easier to implement. */
static gpgme_error_t
colon_line_handler (void *opaque, int fd)
{
engine_gpg_t gpg = opaque;
gpgme_error_t rc = 0;
assert (fd == gpg->colon.fd[0]);
rc = read_colon_line (gpg);
if (rc)
return rc;
if (gpg->colon.eof)
_gpgme_io_close (fd);
return 0;
}
static gpgme_error_t
start (engine_gpg_t gpg)
{
gpgme_error_t rc;
int saved_errno;
int i, n;
int status;
struct spawn_fd_item_s *fd_child_list, *fd_parent_list;
if (!gpg)
return gpg_error (GPG_ERR_INV_VALUE);
if (!gpg->file_name && !_gpgme_get_gpg_path ())
return gpg_error (GPG_ERR_INV_ENGINE);
if (gpg->lc_ctype)
{
rc = add_arg_ext (gpg, gpg->lc_ctype, 1);
if (!rc)
rc = add_arg_ext (gpg, "--lc-ctype", 1);
if (rc)
return rc;
}
if (gpg->lc_messages)
{
rc = add_arg_ext (gpg, gpg->lc_messages, 1);
if (!rc)
rc = add_arg_ext (gpg, "--lc-messages", 1);
if (rc)
return rc;
}
rc = build_argv (gpg);
if (rc)
return rc;
n = 3; /* status_fd, colon_fd and end of list */
for (i = 0; gpg->fd_data_map[i].data; i++)
n++;
fd_child_list = calloc (n + n, sizeof *fd_child_list);
if (!fd_child_list)
return gpg_error_from_errno (errno);
fd_parent_list = fd_child_list + n;
/* build the fd list for the child */
n = 0;
/* The status fd is never dup'ed, so do not include it in the list. */
if (gpg->colon.fnc)
{
fd_child_list[n].fd = gpg->colon.fd[1];
fd_child_list[n].dup_to = 1; /* dup to stdout */
n++;
}
for (i = 0; gpg->fd_data_map[i].data; i++)
{
if (gpg->fd_data_map[i].dup_to != -1)
{
fd_child_list[n].fd = gpg->fd_data_map[i].peer_fd;
fd_child_list[n].dup_to = gpg->fd_data_map[i].dup_to;
n++;
}
}
fd_child_list[n].fd = -1;
fd_child_list[n].dup_to = -1;
/* Build the fd list for the parent. */
n = 0;
if (gpg->status.fd[1] != -1)
{
fd_parent_list[n].fd = gpg->status.fd[1];
fd_parent_list[n].dup_to = -1;
n++;
}
if (gpg->colon.fd[1] != -1)
{
fd_parent_list[n].fd = gpg->colon.fd[1];
fd_parent_list[n].dup_to = -1;
n++;
}
for (i = 0; gpg->fd_data_map[i].data; i++)
{
fd_parent_list[n].fd = gpg->fd_data_map[i].peer_fd;
fd_parent_list[n].dup_to = -1;
n++;
}
fd_parent_list[n].fd = -1;
fd_parent_list[n].dup_to = -1;
status = _gpgme_io_spawn (gpg->file_name ? gpg->file_name :
_gpgme_get_gpg_path (),
gpg->argv, fd_child_list, fd_parent_list);
saved_errno = errno;
free (fd_child_list);
if (status == -1)
return gpg_error_from_errno (saved_errno);
/*_gpgme_register_term_handler ( closure, closure_value, pid );*/
rc = add_io_cb (gpg, gpg->status.fd[0], 1, status_handler, gpg,
&gpg->status.tag);
if (rc)
/* FIXME: kill the child */
return rc;
if (gpg->colon.fnc)
{
assert (gpg->colon.fd[0] != -1);
rc = add_io_cb (gpg, gpg->colon.fd[0], 1, colon_line_handler, gpg,
&gpg->colon.tag);
if (rc)
/* FIXME: kill the child */
return rc;
}
for (i = 0; gpg->fd_data_map[i].data; i++)
{
if (gpg->cmd.used && i == gpg->cmd.idx)
{
/* Park the cmd fd. */
gpg->cmd.fd = gpg->fd_data_map[i].fd;
gpg->fd_data_map[i].fd = -1;
}
else
{
rc = add_io_cb (gpg, gpg->fd_data_map[i].fd,
gpg->fd_data_map[i].inbound,
gpg->fd_data_map[i].inbound
? _gpgme_data_inbound_handler
: _gpgme_data_outbound_handler,
gpg->fd_data_map[i].data, &gpg->fd_data_map[i].tag);
if (rc)
/* FIXME: kill the child */
return rc;
}
}
gpg_io_event (gpg, GPGME_EVENT_START, NULL);
/* fixme: check what data we can release here */
return 0;
}
static gpgme_error_t
gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--decrypt");
/* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--output");
if (!err)
err = add_arg (gpg, "-");
if (!err)
err = add_data (gpg, plain, 1, 1);
if (!err)
err = add_data (gpg, ciph, 0, 0);
if (!err)
start (gpg);
return err;
}
static gpgme_error_t
gpg_delete (void *engine, gpgme_key_t key, int allow_secret)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, allow_secret ? "--delete-secret-and-public-key"
: "--delete-key");
if (!err)
err = add_arg (gpg, "--");
if (!err)
{
if (!key->subkeys || !key->subkeys->fpr)
return gpg_error (GPG_ERR_INV_VALUE);
else
err = add_arg (gpg, key->subkeys->fpr);
}
if (!err)
start (gpg);
return err;
}
static gpgme_error_t
append_args_from_signers (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */)
{
gpgme_error_t err = 0;
int i;
gpgme_key_t key;
for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++)
{
const char *s = key->subkeys ? key->subkeys->keyid : NULL;
if (s)
{
if (!err)
err = add_arg (gpg, "-u");
if (!err)
err = add_arg (gpg, s);
}
gpgme_key_unref (key);
if (err) break;
}
return err;
}
static gpgme_error_t
append_args_from_sig_notations (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */)
{
gpgme_error_t err = 0;
gpgme_sig_notation_t notation;
notation = gpgme_sig_notation_get (ctx);
while (!err && notation)
{
if (notation->name
&& !(notation->flags & GPGME_SIG_NOTATION_HUMAN_READABLE))
err = gpg_error (GPG_ERR_INV_VALUE);
else if (notation->name)
{
char *arg;
/* Maximum space needed is one byte for the "critical" flag,
the name, one byte for '=', the value, and a terminating
'\0'. */
arg = malloc (1 + notation->name_len + 1 + notation->value_len + 1);
if (!arg)
err = gpg_error_from_errno (errno);
if (!err)
{
char *argp = arg;
if (notation->critical)
*(argp++) = '!';
memcpy (argp, notation->name, notation->name_len);
argp += notation->name_len;
*(argp++) = '=';
/* We know that notation->name is '\0' terminated. */
strcpy (argp, notation->value);
}
if (!err)
err = add_arg (gpg, "--sig-notation");
if (!err)
err = add_arg (gpg, arg);
if (arg)
free (arg);
}
else
{
/* This is a policy URL. */
char *value;
if (notation->critical)
{
value = malloc (1 + notation->value_len + 1);
if (!value)
err = gpg_error_from_errno (errno);
else
{
value[0] = '!';
/* We know that notation->value is '\0' terminated. */
strcpy (&value[1], notation->value);
}
}
else
value = notation->value;
if (!err)
err = add_arg (gpg, "--sig-policy-url");
if (!err)
err = add_arg (gpg, value);
if (value != notation->value)
free (value);
}
notation = notation->next;
}
return err;
}
static gpgme_error_t
gpg_edit (void *engine, int type, gpgme_key_t key, gpgme_data_t out,
gpgme_ctx_t ctx /* FIXME */)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--with-colons");
if (!err)
err = append_args_from_signers (gpg, ctx);
if (!err)
err = add_arg (gpg, type == 0 ? "--edit-key" : "--card-edit");
if (!err)
err = add_data (gpg, out, 1, 1);
if (!err)
err = add_arg (gpg, "--");
if (!err && type == 0)
{
const char *s = key->subkeys ? key->subkeys->fpr : NULL;
if (!s)
err = gpg_error (GPG_ERR_INV_VALUE);
else
err = add_arg (gpg, s);
}
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
append_args_from_recipients (engine_gpg_t gpg, gpgme_key_t recp[])
{
gpgme_error_t err = 0;
int i = 0;
while (recp[i])
{
if (!recp[i]->subkeys || !recp[i]->subkeys->fpr)
err = gpg_error (GPG_ERR_INV_VALUE);
if (!err)
err = add_arg (gpg, "-r");
if (!err)
err = add_arg (gpg, recp[i]->subkeys->fpr);
if (err)
break;
i++;
}
return err;
}
static gpgme_error_t
gpg_encrypt (void *engine, gpgme_key_t recp[], gpgme_encrypt_flags_t flags,
gpgme_data_t plain, gpgme_data_t ciph, int use_armor)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
int symmetric = !recp;
err = add_arg (gpg, symmetric ? "--symmetric" : "--encrypt");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
if (!symmetric)
{
/* If we know that all recipients are valid (full or ultimate trust)
we can suppress further checks. */
if (!err && !symmetric && (flags & GPGME_ENCRYPT_ALWAYS_TRUST))
err = add_arg (gpg, "--always-trust");
if (!err)
err = append_args_from_recipients (gpg, recp);
}
/* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--output");
if (!err)
err = add_arg (gpg, "-");
if (!err)
err = add_data (gpg, ciph, 1, 1);
if (gpgme_data_get_file_name (plain))
{
if (!err)
err = add_arg (gpg, "--set-filename");
if (!err)
err = add_arg (gpg, gpgme_data_get_file_name (plain));
}
if (!err)
err = add_arg (gpg, "--");
if (!err)
err = add_data (gpg, plain, 0, 0);
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_encrypt_sign (void *engine, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags, gpgme_data_t plain,
gpgme_data_t ciph, int use_armor,
gpgme_ctx_t ctx /* FIXME */)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--encrypt");
if (!err)
err = add_arg (gpg, "--sign");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
/* If we know that all recipients are valid (full or ultimate trust)
we can suppress further checks. */
if (!err && (flags & GPGME_ENCRYPT_ALWAYS_TRUST))
err = add_arg (gpg, "--always-trust");
if (!err)
err = append_args_from_recipients (gpg, recp);
if (!err)
err = append_args_from_signers (gpg, ctx);
if (!err)
err = append_args_from_sig_notations (gpg, ctx);
/* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--output");
if (!err)
err = add_arg (gpg, "-");
if (!err)
err = add_data (gpg, ciph, 1, 1);
if (gpgme_data_get_file_name (plain))
{
if (!err)
err = add_arg (gpg, "--set-filename");
if (!err)
err = add_arg (gpg, gpgme_data_get_file_name (plain));
}
if (!err)
err = add_arg (gpg, "--");
if (!err)
err = add_data (gpg, plain, 0, 0);
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_export (void *engine, const char *pattern, unsigned int reserved,
gpgme_data_t keydata, int use_armor)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
if (reserved)
return gpg_error (GPG_ERR_INV_VALUE);
err = add_arg (gpg, "--export");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
if (!err)
err = add_data (gpg, keydata, 1, 1);
if (!err)
err = add_arg (gpg, "--");
if (!err && pattern && *pattern)
err = add_arg (gpg, pattern);
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_export_ext (void *engine, const char *pattern[], unsigned int reserved,
gpgme_data_t keydata, int use_armor)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
if (reserved)
return gpg_error (GPG_ERR_INV_VALUE);
err = add_arg (gpg, "--export");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
if (!err)
err = add_data (gpg, keydata, 1, 1);
if (!err)
err = add_arg (gpg, "--");
if (pattern)
{
while (!err && *pattern && **pattern)
err = add_arg (gpg, *(pattern++));
}
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_genkey (void *engine, gpgme_data_t help_data, int use_armor,
gpgme_data_t pubkey, gpgme_data_t seckey)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
if (!gpg)
return gpg_error (GPG_ERR_INV_VALUE);
/* We need a special mechanism to get the fd of a pipe here, so that
we can use this for the %pubring and %secring parameters. We
don't have this yet, so we implement only the adding to the
standard keyrings. */
if (pubkey || seckey)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
err = add_arg (gpg, "--gen-key");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
if (!err)
err = add_data (gpg, help_data, 0, 0);
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_import (void *engine, gpgme_data_t keydata)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--import");
if (!err)
err = add_data (gpg, keydata, 0, 0);
if (!err)
err = start (gpg);
return err;
}
/* The output for external keylistings in GnuPG is different from all
the other key listings. We catch this here with a special
preprocessor that reformats the colon handler lines. */
static gpgme_error_t
gpg_keylist_preprocess (char *line, char **r_line)
{
enum
{
RT_NONE, RT_INFO, RT_PUB, RT_UID
}
rectype = RT_NONE;
#define NR_FIELDS 16
char *field[NR_FIELDS];
int fields = 0;
*r_line = NULL;
while (line && fields < NR_FIELDS)
{
field[fields++] = line;
line = strchr (line, ':');
if (line)
*(line++) = '\0';
}
if (!strcmp (field[0], "info"))
rectype = RT_INFO;
else if (!strcmp (field[0], "pub"))
rectype = RT_PUB;
else if (!strcmp (field[0], "uid"))
rectype = RT_UID;
else
rectype = RT_NONE;
switch (rectype)
{
case RT_INFO:
/* FIXME: Eventually, check the version number at least. */
return 0;
case RT_PUB:
if (fields < 7)
return 0;
/* The format is:
pub:<keyid>:<algo>:<keylen>:<creationdate>:<expirationdate>:<flags>
as defined in 5.2. Machine Readable Indexes of the OpenPGP
HTTP Keyserver Protocol (draft).
We want:
pub:o<flags>:<keylen>:<algo>:<keyid>:<creatdate>:<expdate>::::::::
*/
if (asprintf (r_line, "pub:o%s:%s:%s:%s:%s:%s::::::::",
field[6], field[3], field[2], field[1],
field[4], field[5]) < 0)
return gpg_error_from_errno (errno);
return 0;
case RT_UID:
/* The format is:
uid:<escaped uid string>:<creationdate>:<expirationdate>:<flags>
as defined in 5.2. Machine Readable Indexes of the OpenPGP
HTTP Keyserver Protocol (draft).
We want:
uid:o<flags>::::<creatdate>:<expdate>:::<uid>:
*/
if (asprintf (r_line, "uid:o%s::::%s:%s:::%s:",
field[4], field[2], field[3], field[1]) < 0)
return gpg_error_from_errno (errno);
return 0;
case RT_NONE:
/* Unknown record. */
break;
}
return 0;
}
static gpgme_error_t
gpg_keylist (void *engine, const char *pattern, int secret_only,
gpgme_keylist_mode_t mode)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
if (mode & GPGME_KEYLIST_MODE_EXTERN)
{
if ((mode & GPGME_KEYLIST_MODE_LOCAL)
|| secret_only)
return gpg_error (GPG_ERR_NOT_SUPPORTED);
}
err = add_arg (gpg, "--with-colons");
if (!err)
err = add_arg (gpg, "--fixed-list-mode");
if (!err)
err = add_arg (gpg, "--with-fingerprint");
if (!err)
err = add_arg (gpg, "--with-fingerprint");
if (!err && (mode & GPGME_KEYLIST_MODE_SIGS)
&& (mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS))
{
err = add_arg (gpg, "--list-options");
if (!err)
err = add_arg (gpg, "show-sig-subpackets=\"20,26\"");
}
if (!err)
{
if (mode & GPGME_KEYLIST_MODE_EXTERN)
{
err = add_arg (gpg, "--search-keys");
gpg->colon.preprocess_fnc = gpg_keylist_preprocess;
}
else
{
err = add_arg (gpg, secret_only ? "--list-secret-keys"
: ((mode & GPGME_KEYLIST_MODE_SIGS)
? "--check-sigs" : "--list-keys"));
}
}
/* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--");
if (!err && pattern && *pattern)
err = add_arg (gpg, pattern);
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_keylist_ext (void *engine, const char *pattern[], int secret_only,
int reserved, gpgme_keylist_mode_t mode)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
if (reserved)
return gpg_error (GPG_ERR_INV_VALUE);
err = add_arg (gpg, "--with-colons");
if (!err)
err = add_arg (gpg, "--fixed-list-mode");
if (!err)
err = add_arg (gpg, "--with-fingerprint");
if (!err)
err = add_arg (gpg, "--with-fingerprint");
if (!err && (mode & GPGME_KEYLIST_MODE_SIGS)
&& (mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS))
{
err = add_arg (gpg, "--list-options");
if (!err)
err = add_arg (gpg, "show-sig-subpackets=\"20,26\"");
}
if (!err)
err = add_arg (gpg, secret_only ? "--list-secret-keys"
: ((mode & GPGME_KEYLIST_MODE_SIGS)
? "--check-sigs" : "--list-keys"));
if (!err)
err = add_arg (gpg, "--");
if (pattern)
{
while (!err && *pattern && **pattern)
err = add_arg (gpg, *(pattern++));
}
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
int include_certs, gpgme_ctx_t ctx /* FIXME */)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
if (mode == GPGME_SIG_MODE_CLEAR)
err = add_arg (gpg, "--clearsign");
else
{
err = add_arg (gpg, "--sign");
if (!err && mode == GPGME_SIG_MODE_DETACH)
err = add_arg (gpg, "--detach");
if (!err && use_armor)
err = add_arg (gpg, "--armor");
if (!err && use_textmode)
err = add_arg (gpg, "--textmode");
}
if (!err)
err = append_args_from_signers (gpg, ctx);
if (!err)
err = append_args_from_sig_notations (gpg, ctx);
if (gpgme_data_get_file_name (in))
{
if (!err)
err = add_arg (gpg, "--set-filename");
if (!err)
err = add_arg (gpg, gpgme_data_get_file_name (in));
}
/* Tell the gpg object about the data. */
if (!err)
err = add_data (gpg, in, 0, 0);
if (!err)
err = add_data (gpg, out, 1, 1);
if (!err)
start (gpg);
return err;
}
static gpgme_error_t
gpg_trustlist (void *engine, const char *pattern)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--with-colons");
if (!err)
err = add_arg (gpg, "--list-trust-path");
/* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--");
if (!err)
err = add_arg (gpg, pattern);
if (!err)
err = start (gpg);
return err;
}
static gpgme_error_t
gpg_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
gpgme_data_t plaintext)
{
engine_gpg_t gpg = engine;
gpgme_error_t err = 0;
if (plaintext)
{
/* Normal or cleartext signature. */
err = add_arg (gpg, "--output");
if (!err)
err = add_arg (gpg, "-");
if (!err)
err = add_arg (gpg, "--");
if (!err)
err = add_data (gpg, sig, 0, 0);
if (!err)
err = add_data (gpg, plaintext, 1, 1);
}
else
{
err = add_arg (gpg, "--verify");
if (!err)
err = add_arg (gpg, "--");
if (!err)
err = add_data (gpg, sig, -1, 0);
if (signed_text)
{
if (!err)
err = add_arg (gpg, "-");
if (!err)
err = add_data (gpg, signed_text, 0, 0);
}
}
if (!err)
err = start (gpg);
return err;
}
static void
gpg_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
{
engine_gpg_t gpg = engine;
gpg->io_cbs = *io_cbs;
}
struct engine_ops _gpgme_engine_ops_gpg =
{
/* Static functions. */
_gpgme_get_gpg_path,
gpg_get_version,
gpg_get_req_version,
gpg_new,
/* Member functions. */
gpg_release,
NULL, /* reset */
gpg_set_status_handler,
gpg_set_command_handler,
gpg_set_colon_line_handler,
gpg_set_locale,
gpg_decrypt,
gpg_delete,
gpg_edit,
gpg_encrypt,
gpg_encrypt_sign,
gpg_export,
gpg_export_ext,
gpg_genkey,
gpg_import,
gpg_keylist,
gpg_keylist_ext,
gpg_sign,
gpg_trustlist,
gpg_verify,
- NULL,
+ NULL, /* getauditlog */
+ NULL, /* conf_load */
+ NULL, /* conf_save */
gpg_set_io_cbs,
gpg_io_event,
gpg_cancel
};
diff --git a/gpgme/util.h b/gpgme/util.h
index 28d5e192..0cd6ab5c 100644
--- a/gpgme/util.h
+++ b/gpgme/util.h
@@ -1,106 +1,107 @@
/* util.h
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2005 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef UTIL_H
#define UTIL_H
#include "gpgme.h"
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
/*-- {posix,w32}-util.c --*/
const char *_gpgme_get_gpg_path (void);
const char *_gpgme_get_gpgsm_path (void);
+const char *_gpgme_get_gpgconf_path (void);
int _gpgme_get_conf_int (const char *key, int *value);
/*-- replacement functions in <funcname>.c --*/
#ifdef HAVE_CONFIG_H
#ifndef HAVE_STPCPY
static _GPGME_INLINE char *
_gpgme_stpcpy (char *a, const char *b)
{
while (*b)
*a++ = *b++;
*a = 0;
return a;
}
#define stpcpy(a,b) _gpgme_stpcpy ((a), (b))
#endif /*!HAVE_STPCPY*/
#if !HAVE_VASPRINTF
#include <stdarg.h>
int vasprintf (char **result, const char *format, va_list args);
int asprintf (char **result, const char *format, ...);
#endif
#ifndef HAVE_TTYNAME_R
int ttyname_r (int fd, char *buf, size_t buflen);
#endif
#endif
/*-- conversion.c --*/
/* Convert two hexadecimal digits from STR to the value they
represent. Returns -1 if one of the characters is not a
hexadecimal digit. */
int _gpgme_hextobyte (const char *str);
/* Decode the C formatted string SRC and store the result in the
buffer *DESTP which is LEN bytes long. If LEN is zero, then a
large enough buffer is allocated with malloc and *DESTP is set to
the result. Currently, LEN is only used to specify if allocation
is desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. */
gpgme_error_t _gpgme_decode_c_string (const char *src, char **destp,
size_t len);
/* Decode the percent escaped string SRC and store the result in the
buffer *DESTP which is LEN bytes long. If LEN is zero, then a
large enough buffer is allocated with malloc and *DESTP is set to
the result. Currently, LEN is only used to specify if allocation
is desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. If BINARY is 1, then '\0'
characters are allowed in the output. */
gpgme_error_t _gpgme_decode_percent_string (const char *src, char **destp,
size_t len, int binary);
/* Parse the string TIMESTAMP into a time_t. The string may either be
seconds since Epoch or in the ISO 8601 format like
"20390815T143012". Returns 0 for an empty string or seconds since
Epoch. Leading spaces are skipped. If ENDP is not NULL, it will
point to the next non-parsed character in TIMESTRING. */
time_t _gpgme_parse_timestamp (const char *timestamp, char **endp);
gpgme_error_t _gpgme_map_gnupg_error (char *err);
/* Retrieve the environment variable NAME and return a copy of it in a
malloc()'ed buffer in *VALUE. If the environment variable is not
set, return NULL in *VALUE. */
gpgme_error_t _gpgme_getenv (const char *name, char **value);
#endif /* UTIL_H */
diff --git a/gpgme/w32-util.c b/gpgme/w32-util.c
index 60c8396d..b0f6df2d 100644
--- a/gpgme/w32-util.c
+++ b/gpgme/w32-util.c
@@ -1,345 +1,365 @@
/* w32-util.c - Utility functions for the W32 API
Copyright (C) 1999 Free Software Foundation, Inc
Copyright (C) 2001 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 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, 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
#include <windows.h>
#include <shlobj.h>
#include <io.h>
#include "util.h"
#include "sema.h"
#include "debug.h"
DEFINE_STATIC_LOCK (get_path_lock);
#define RTLD_LAZY 0
static __inline__ void *
dlopen (const char * name, int flag)
{
void * hd = LoadLibrary (name);
return hd;
}
static __inline__ void *
dlsym (void * hd, const char * sym)
{
if (hd && sym)
{
void * fnc = GetProcAddress (hd, sym);
if (!fnc)
return NULL;
return fnc;
}
return NULL;
}
static __inline__ int
dlclose (void * hd)
{
if (hd)
{
FreeLibrary (hd);
return 0;
}
return -1;
}
/* Return a string from the W32 Registry or NULL in case of error.
Caller must release the return value. A NULL for root is an alias
for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn. */
static char *
read_w32_registry_string (const char *root, const char *dir, const char *name)
{
HKEY root_key, key_handle;
DWORD n1, nbytes, type;
char *result = NULL;
if ( !root )
root_key = HKEY_CURRENT_USER;
else if ( !strcmp( root, "HKEY_CLASSES_ROOT" ) )
root_key = HKEY_CLASSES_ROOT;
else if ( !strcmp( root, "HKEY_CURRENT_USER" ) )
root_key = HKEY_CURRENT_USER;
else if ( !strcmp( root, "HKEY_LOCAL_MACHINE" ) )
root_key = HKEY_LOCAL_MACHINE;
else if ( !strcmp( root, "HKEY_USERS" ) )
root_key = HKEY_USERS;
else if ( !strcmp( root, "HKEY_PERFORMANCE_DATA" ) )
root_key = HKEY_PERFORMANCE_DATA;
else if ( !strcmp( root, "HKEY_CURRENT_CONFIG" ) )
root_key = HKEY_CURRENT_CONFIG;
else
return NULL;
if ( RegOpenKeyEx ( root_key, dir, 0, KEY_READ, &key_handle ) )
{
if (root)
return NULL; /* no need for a RegClose, so return direct */
/* It seems to be common practise to fall back to HKLM. */
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
return NULL; /* still no need for a RegClose, so return direct */
}
nbytes = 1;
if ( RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes ) )
{
if (root)
goto leave;
/* Try to fallback to HKLM also vor a missing value. */
RegCloseKey (key_handle);
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
return NULL; /* Nope. */
if (RegQueryValueEx ( key_handle, name, 0, NULL, NULL, &nbytes))
goto leave;
}
result = malloc ( (n1=nbytes+1) );
if ( !result )
goto leave;
if ( RegQueryValueEx ( key_handle, name, 0, &type, result, &n1 ) )
{
free(result); result = NULL;
goto leave;
}
result[nbytes] = 0; /* Make sure it is really a string. */
if (type == REG_EXPAND_SZ && strchr (result, '%'))
{
char *tmp;
n1 += 1000;
tmp = malloc (n1+1);
if (!tmp)
goto leave;
nbytes = ExpandEnvironmentStrings (result, tmp, n1);
if (nbytes && nbytes > n1)
{
free (tmp);
n1 = nbytes;
tmp = malloc (n1 + 1);
if (!tmp)
goto leave;
nbytes = ExpandEnvironmentStrings (result, tmp, n1);
if (nbytes && nbytes > n1) {
free (tmp); /* Oops - truncated, better don't expand at all. */
goto leave;
}
tmp[nbytes] = 0;
free (result);
result = tmp;
}
else if (nbytes) /* Okay, reduce the length. */
{
tmp[nbytes] = 0;
free (result);
result = malloc (strlen (tmp)+1);
if (!result)
result = tmp;
else
{
strcpy (result, tmp);
free (tmp);
}
}
else /* Error - don't expand. */
{
free (tmp);
}
}
leave:
RegCloseKey( key_handle );
return result;
}
/* This is a helper function to load and run a Windows function from
either of one DLLs. */
static HRESULT
w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e)
{
static int initialized;
static HRESULT (WINAPI * func)(HWND,int,HANDLE,DWORD,LPSTR);
if (!initialized)
{
static char *dllnames[] = { "shell32.dll", "shfolder.dll", NULL };
void *handle;
int i;
initialized = 1;
for (i=0, handle = NULL; !handle && dllnames[i]; i++)
{
handle = dlopen (dllnames[i], RTLD_LAZY);
if (handle)
{
func = dlsym (handle, "SHGetFolderPathA");
if (!func)
{
dlclose (handle);
handle = NULL;
}
}
}
}
if (func)
return func (a,b,c,d,e);
else
return -1;
}
static char *
find_program_in_registry (const char *name)
{
char *program = NULL;
program = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", name);
if (program)
{
int i;
TRACE2 (DEBUG_CTX, "gpgme:find_program_in_registry", 0,
"found %s in registry: `%s'", name, program);
for (i = 0; program[i]; i++)
{
if (program[i] == '/')
program[i] = '\\';
}
}
return program;
}
static char *
find_program_in_inst_dir (const char *name)
{
char *result = NULL;
char *tmp;
tmp = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
"Software\\GNU\\GnuPG",
"Install Directory");
if (!tmp)
return NULL;
result = malloc (strlen (tmp) + 1 + strlen (name) + 1);
if (!result)
{
free (tmp);
return NULL;
}
strcpy (stpcpy (stpcpy (result, tmp), "\\"), name);
free (tmp);
if (access (result, F_OK))
{
free (result);
return NULL;
}
return result;
}
+
static char *
find_program_at_standard_place (const char *name)
{
char path[MAX_PATH];
char *result = NULL;
if (w32_shgetfolderpath (NULL, CSIDL_PROGRAM_FILES, NULL, 0, path) >= 0)
{
result = malloc (strlen (path) + 1 + strlen (name) + 1);
if (result)
{
strcpy (stpcpy (stpcpy (result, path), "\\"), name);
if (access (result, F_OK))
{
free (result);
result = NULL;
}
}
}
return result;
}
const char *
_gpgme_get_gpg_path (void)
{
static char *gpg_program;
LOCK (get_path_lock);
if (!gpg_program)
gpg_program = find_program_in_registry ("gpgProgram");
if (!gpg_program)
gpg_program = find_program_in_inst_dir ("gpg.exe");
if (!gpg_program)
gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
UNLOCK (get_path_lock);
return gpg_program;
}
+
const char *
_gpgme_get_gpgsm_path (void)
{
static char *gpgsm_program;
LOCK (get_path_lock);
if (!gpgsm_program)
gpgsm_program = find_program_in_registry ("gpgsmProgram");
if (!gpgsm_program)
gpgsm_program = find_program_in_inst_dir ("gpgsm.exe");
if (!gpgsm_program)
gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
UNLOCK (get_path_lock);
return gpgsm_program;
}
+const char *
+_gpgme_get_gpgconf_path (void)
+{
+ static char *gpgconf_program;
+
+ LOCK (get_path_lock);
+ if (!gpgconf_program)
+ gpgconf_program = find_program_in_registry ("gpgconfProgram");
+ if (!gpgconf_program)
+ gpgconf_program = find_program_in_inst_dir ("gpgconf.exe");
+ if (!gpgconf_program)
+ gpgconf_program
+ = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
+ UNLOCK (get_path_lock);
+ return gpgconf_program;
+}
+
+
/* Return an integer value from gpgme specific configuration
entries. VALUE receives that value; function returns true if a value
has been configured and false if not. */
int
_gpgme_get_conf_int (const char *key, int *value)
{
char *tmp = read_w32_registry_string (NULL, "Software\\GNU\\gpgme", key);
if (!tmp)
return 0;
*value = atoi (tmp);
free (tmp);
return 1;
}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9e16ce2e..dd7c3968 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,757 +1,768 @@
+2008-01-04 Marcus Brinkmann <marcus@g10code.de>
+
+ * Makefile.am (TESTS_ENVIRONMENT): Use absolute path for
+ GNUPGHOME.
+ * gpg/Makefile.am (TESTS_ENVIRONMENT): Use absolute path for
+ GNUPGHOME.
+ * gpgsm/Makefile.am (TESTS_ENVIRONMENT): Use absolute path for
+ GNUPGHOME.
+ * gpg/Makefile.am (TESTS): Add t-gpgconf.
+ t-gpgconf.c: New file.
+
2007-11-23 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-verify.c (show_auditlog): Check for GPG_ERR_ASS_UNKNOWN_CMD.
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.
* gpg/Makefile.am (tests_unix): New variable.
(TESTS): Use it.
* gpg/t-support.h (passphrase_cb) [HAVE_W32_SYSTEM]: Use WriteFile instead of write.
* gpg/t-wait.c [HAVE_W32_SYSTEM]: Define sleep as _sleep.
2007-09-14 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-verify.c (main): Release TEXT and SIG.
2007-07-12 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (key_id): Change := into =.
2007-07-12 Werner Koch <wk@g10code.com>
* gpgsm/t-support.h (init_gpgme) [W32]: Do not init the locales as
the constants are not available.
2007-02-26 Werner Koch <wk@g10code.com>
* gpg/t-verify.c (double_plaintext_sig): New.
(main): Check it.
2006-12-02 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c (main): Skip unknown keys. Newer versions of
GPGSM import more keys than older ones.
2005-12-06 Werner Koch <wk@g10code.com>
* gpg/t-keylist.c (main): Changed for that secondary keys now have
a fingerprint.
* gpg/t-keylist-sig.c (main): Ditto.
* gpgsm/t-keylist.c (main): Ditto. The test used to be wrong.
2005-10-18 Werner Koch <wk@g10code.com>
* gpg/pubdemo.asc, gpg/secdemo.asc: Add 2 expired subkeys to
Whisky.
* gpg/t-keylist.c: Reordered list to match new demo keyring. Add
arg for number of subkeys and for extra checking function.
(main): Enhanced a few error outputs. Changed subkey
counting. Call extra checking fucntion.
(check_whisky): New.
2005-10-07 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c (main): Allow for an email address as a second
uid.
* gpg/t-sig-notation.c: Change critical notation to something
GnuPG understands.
2005-10-01 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (EXTRA_DIST): Remove gpg.conf.
(DISTCLEANFILES): Add gpg.conf.
(all-local): Add gpg.conf.
(./gpg.conf): New target.
* gpg/gpg.conf: Remove file.
* gpg/Makefile.am (EXTRA_DIST): Add gpg.conf.
* gpg/Makefile.am (TESTS): Add t-sig-notation.
* gpg/t-sig-notation.c (check_result): New file.
* gpg/t-verify.c (check_result): Also check the length of the
notation data.
* gpg/gpg.conf: New file.
2005-09-30 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (TESTS): Add t-filename.
* gpg/t-filename.c: New file.
2005-09-23 Werner Koch <wk@g10code.com>
* gpg/t-support.h (init_gpgme) [W32]: Don't use LC_MESSAGES.
* gpg/t-encrypt-large.c: New test.
* gpg/Makefile.am (TESTS): Add t-encrypt-large.
2005-06-03 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (TESTS): Add t-wait.
* gpg/t-wait.c (main): New test.
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* gpg/mkdemodirs: Add copyright notice.
* gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c,
gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c,
gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c,
gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c,
gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c,
gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c,
gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c,
gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c,
gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c,
gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c,
t-version.c: Change license to LGPL.
2004-08-17 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c (struct): Add new fields VALIDITY and
KEY_LENGTH.
(main): Use them.
* gpgsm/t-import.c (check_result): New argument total_stat.
(main): Pass this argument. Reduce number of total considered
keys to 1 for the second test.
2004-04-05 Werner Koch <wk@gnupg.org>
* gpgsm/Makefile.am: Changed the faked system time to 20011213T12000.
2004-03-07 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c: Add chain IDs.
2004-03-03 Werner Koch <wk@gnupg.org>
* gpgsm/t-export.c (main): Also check exporting 2 certificates.
2004-02-17 Werner Koch <wk@gnupg.org>
* gpgsm/t-import.c (check_result): gpgsm does now return info in
the result->imports; adjust for that.
* gpgsm/Makefile.am (TESTS_ENVIRONMENT): Reset the GPG_AGENT_INFO.
Include config.h at the top of each C source. This is required
due to LFS support.
* gpg/t-keylist-sig.c (main): s/class/sig_class/.
* gpg/t-signers.c (check_result): Ditto.
* gpg/t-sign.c (check_result): Ditto.
* gpg/t-encrypt-sign.c (check_result): Ditto.
* gpgsm/t-sign.c (check_result): Ditto.
2004-01-12 Werner Koch <wk@gnupg.org>
* gpg/t-keylist-sig.c (main): Temporary disabled one test due top
gpg 1.3.4 problems.
* gpg/t-import.c (check_result): Likewise.
2003-11-19 Werner Koch <wk@gnupg.org>
* gpg/t-support.h (DIM): Added.
* gpg/t-verify.c (check_result): Rewrote test for notations
because the order of notaions is not guaranteed.
* gpgsm/t-support.h (fail_if_err): Also print the numeric values.
2003-10-06 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-eventloop.c: Include <sys/types.h> for old systems.
* gpgsm/Makefile.am (DISTCLEANFILES): Add random_seed.
* gpg/t-thread1.c (thread_one): Do not call initialize_gpgme.
Likewise.
2003-09-14 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-thread1.c (main): Call init_gpgme here.
(initialize_gpgme): Function removed.
* gpg/t-thread1.c: New file.
* gpg/Makefile.am (TESTS): Add t-thread1.c.
(t_thread1_LDADD): New variable.
(LDADD): Remove GPG Error lib.
* gpgsm/Makefile.am (LDADD): Likewise.
* gpg/t-import.c (main): Likewise.
* gpg/t-keylist-sig.c (main): Likewise.
* gpg/t-keylist.c (main): Likewise.
* gpg/t-sign.c (main): Likewise.
* gpg/t-signers.c (main): Likewise.
* gpg/t-trustlist.c (main): Likewise.
* gpgsm/t-support.h: Include <stdlib.h> and <locale.h>.
(init_gpgme): New function.
* gpg/t-support.h: Likewise.
* gpgsm/t-verify.c (main): Call init_gpgme.
* gpgsm/t-decrypt.c (main): Likewise.
* gpgsm/t-encrypt.c (main): Likewise.
* gpgsm/t-export.c (main): Likewise.
* gpgsm/t-genkey.c (main): Likewise.
* gpgsm/t-import.c (main): Likewise.
* gpgsm/t-keylist.c (main): Likewise.
* gpgsm/t-sign.c (main): Likewise.
* gpg/t-verify.c (main): Call init_gpgme.
* gpg/t-decrypt-verify.c (main): Likewise.
* gpg/t-decrypt.c (main): Likewise.
* gpg/t-edit.c (main): Likewise.
* gpg/t-encrypt-sign.c (main): Likewise.
* gpg/t-encrypt-sym.c (main): Likewise.
* gpg/t-encrypt.c (main): Likewise.
* gpg/t-eventloop.c (main): Likewise.
* gpg/t-export.c (main): Likewise.
* gpg/t-genkey.c (main): Likewise.
2003-08-14 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-sign.c (check_result): Change output format for signature
class to unsigned int.
* gpg/t-signers.c (check_result): Likewise.
* gpg/t-encrypt-sign.c (check_result): Likewise.
* gpgsm/t-sign.c (check_result): Likewise.
2003-07-31 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-verify.c (check_result): Change type of SUMMARY to
unsigned int.
* gpg/t-decrypt-verify.c (check_verify_result): Likewise.
* gpg/t-keylist-sig.c (keys): Change type of member CLASS to
unsigned int.
* t-data.c (read_cb): Change type of AMOUNT to unsigned int.
* t-version.c (version): Remove unused variable.
2003-07-22 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (AM_CPPFLAGS): New variable.
(LDADD): Add @GPG_ERROR_LIBS@.
* gpg/Makefile.am (AM_CPPFLAGS): New variable.
(LDADD): Add @GPG_ERROR_LIBS@.
* gpgsm/Makefile.am (AM_CPPFLAGS): New variable.
(LDADD): Add @GPG_ERROR_LIBS@.
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
Everywhere: Use libgpg-error error codes.
* gpg/Makefile.am (noinst_HEADERS): New variable.
* gpg/t-support.h: New file.
* gpgsm/Makefile.am (noinst_HEADERS): New variable.
* gpgsm/t-support.h: New file.
2003-05-29 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-encrypt-sym.c (main): Adapt to new syntax.
* gpg/t-encrypt.c (main): Likewise.
* gpg/t-eventloop.c (main): Likewise.
* gpg/t-encrypt-sign.c (main): Likewise.
* gpgsm/t-export.c (main): Likewise.
* gpgsm/t-encrypt.c (main): Likewise.
2003-05-28 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-eventloop.c (main): Rewrite recipient management.
* gpg/t-encrypt-sign.c (main): Likewise.
* gpg/t-encrypt.c (main): Likewise.
* gpg/t-export.c (main): Likewise.
* gpgsm/t-encrypt.c (main): Likewise.
* gpgsm/t-export.c (main): Likewise.
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after
t-import.
* gpg/t-edit.c (edit_fnc): Fix primary UID for keylisting tests.
* gpg/t-keylist.c: Change order of user IDs.
* gpg/t-keylist-sig.c: Likewise.
* gpg/t-import.c: Add support for gpg in CVS.
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
* t-data.c: Remove TEST_OUT_CB.
(main): Likewise.
* gpg/t-trustlist.c (main): Access ITEM directly.
* (t-decrypt-verify.c, t-decrypt.c, t-edit.c, t-encrypt-sign.c,
t-encrypt-sym.c, t-sign.c, t-signers.c): Include <unistd.h>.
(passphrase_cb): Rewritten.
* t-edit.c (edit_fnc): Rewritten.
2003-05-04 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-keylist-sig.c (main): Remove timestamp check.
* gpgsm/t-keylist.c: Add check for timestamp.
* gpg/Makefile.am (TESTS): Add t-keylist-sig.
* gpg/t-keylist-sig.c: New file.
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-eventloop.c (main): Do not call print_op_info.
(print_op_info): Function removed.
* gpg/t-keylist.c: Rewritten.
* gpgsm/t-keylist.c (main): Rewritten.
* gpg/t-edit.c (main): Do not use gpgme_key_get_as_xml. Use
gpgme_key_unref instead gpgme_key_release.
* gpg/t-signers.c (main): Use gpgme_key_unref instead
gpgme_key_release.
2003-04-29 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-trustlist.c: Rewritten.
* gpg/t-verify.c (main): Rewritten.
* gpg/t-decrypt-verify.c: Rewritten.
* gpgsm/t-verify.c (main): Rewritten.
2003-04-28 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-decrypt.c (main): Rewritten.
* gpg/t-decrypt.c: Rewritten.
* gpg/t-signers.c: Rewritten.
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-encrypt-sign.c (check_result): Rewritten.
* gpg/t-sign.c: Rewritten.
* gpgsm/t-sign.c: Rewritten.
* gpg/t-encrypt.c: Check for invalid recipients.
* gpgsm/t-encrypt.c: Likewise.
* gpg/t-import.c (check_result): Really use FPR.
* gpgsm/t-import.c (check_result): Rewritten.
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-import.c: Rewritten.
* gpgsm/t-genkey.c: Rewritten.
* gpgsm/Makefile.am (noinst_PROGRAMS): Add t-genkey.
* gpg/t-genkey.c: Include <stdlib.h>.
(main): Check result->fpr before checking its length.
2003-04-24 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-genkey.c: Rewritten to match new semantics.
2003-02-06 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-decrypt.c (passphrase_cb): Fix to new prototype.
* gpg/t-decrypt-verify.c (passphrase_cb): Likewise.
* gpg/t-edit.c (passphrase_cb): Likewise.
* gpg/t-encrypt-sign.c (passphrase_cb): Likewise.
* gpg/t-encrypt-sym.c (passphrase_cb): Likewise.
* gpg/t-sign.c (passphrase_cb): Likewise.
* gpg/t-signers.c (passphrase_cb): Likewise.
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* t-engine-info.c: Use file_name instead path throughout.
* 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.
* gpg/t-verify.c (main): Likewise.
* gpg/t-decrypt-verify.c (main): Likewise for
gpgme_op_decrypt_verify.
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (./gpgsm.conf): Add a faked system time to
avoid certification's expiry.
* gpgsm/t-encrypt.c (main): Use the short certification name.
2002-11-19 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-genkey.c (main): Add missing argument to gpgme_op_genkey
invocation.
2002-10-09 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-decrypt.c (print_data): Update to new gpgme_data_read
interface, and use gpgme_engine_check_version instead
gpgme_check_version.
* gpg/t-decrypt-verify.c (print_data): Likewise.
* gpg/t-edit.c (main): Likewise.
* gpg/t-encrypt.c (print_data): Likewise.
* gpg/t-encrypt-sign.c (print_data): Likewise.
* gpg/t-encrypt-sym.c (print_data): Likewise.
* gpg/t-eventloop.c (print_data): Likewise.
* gpg/t-export.c (print_data): Likewise.
* gpg/t-sign.c (print_data): Likewise.
* gpg/t-signers.c (print_data): Likewise.
* gpgsm/t-decrypt.c (print_data): Likewise.
* gpgsm/t-encrypt.c (print_data): Likewise.
* gpgsm/t-export.c (print_data): Likewise.
* gpgsm/t-sign.c (print_data): Likewise.
* gpg/t-verify.c (main): Likewise for gpgme_op_verify.
* gpgsm/t-verify.c (main): Likewise for gpgme_op_verify.
* t-data.c (read_once_test): Likewise.
(write_test): Update for new behaviour of data objects.
(main): Remove type test.
2002-09-30 Werner Koch <wk@gnupg.org>
* gpgsm/t-keylist.c (doit): Add arg SECRET.
(main): Add option --secret.
2002-09-28 Marcus Brinkmann <marcus@g10code.de>
* t-version.c: Include <string.h>. Reported by Stéphane Corthésy.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-keylist.c (main): Test PATTERN for NULL before printing.
Reported by Dr. Stefan Dalibor <Dr.Stefan.Dalibor@bfa.de>.
2002-08-01 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-edit.c: Also add a test for the expire command (testing
the passphrase callback).
2002-07-28 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-edit.c: New file.
* gpg/Makefile (TESTS): Add t-edit.
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-encrypt-sym.c (main): Change type of I to size_t and
rename to LEN.
* gpg/t-verify.c (main): Likewise. Submitted by Stéphane
Corthésy.
2002-07-03 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-eventloop.c: New file.
* gpg/Makefile (TESTS): Add t-eventloop.
2002-06-26 Werner Koch <wk@gnupg.org>
* gpgsm/t-import.c (print_op_info): New.
(main): Print operation info.
2002-06-25 Werner Koch <wk@gnupg.org>
* gpgsm/Makefile.am (DISTCLEANFILES): new.
2002-06-25 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (TESTS): Add t-export.
gpgsm/t-export.c: New file.
2002-06-20 Werner Koch <wk@gnupg.org>
* gpgsm/t-sign.c (main): Also test a normal signature.
* gpg/Makefile (TESTS_ENVIRONMENT): Set GPG_AGENT_INFO empty.
* gpg/t-signers.c, gpg/t-sign.c, gpg/t-encrypt-sym.c
* gpg/t-encrypt-sign.c, gpg/t-decrypt.c
* gpg/t-decrypt-verify.c (main): Changed the GPG_AGENT_INFO check to
match the one in ../../gpgme/rungpg.c.
2002-06-12 Werner Koch <wk@gnupg.org>
* gpgsm/t-keylist.c (doit): Print operation info if available.
2002-06-10 Werner Koch <wk@gnupg.org>
* gpgsm/t-verify.c (print_sig_stat): Print the error token.
2002-06-04 Werner Koch <wk@gnupg.org>
* gpgsm/t-encrypt.c (main): Add a simple option parser and allow
to specify an encryption key.
2002-05-26 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (all-local): Remove dependency on ./secring.gpg.
(./secring.gpg): Remove target, and move all rules for this target
to ...
(./pubring.gpg): ... here. This was necessary because GnuPG 1.0.7
does create an empty secring.gpg file when importing public keys.
2002-05-08 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-verify.c (validity_string): New.
(print_sig_stat): Print expire time and validity.
(status_string): Add new exipred stati.
2002-05-03 Werner Koch <wk@gnupg.org>
* gpg/t-verify.c (validity_string): New.
(print_sig_stat): Print expire time and validity.
(status_string): Add new exipred stati.
2002-04-05 Marcus Brinkmann <marcus@g10code,de>
* gpgsm/Makefile.am (./trustlist.txt): Put more into this file to
prevent use of gpg-agent.
(./gpg-agent.conf): Remove target.
(all-local): Remove ./gpg-agent.conf.
2002-04-05 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c (main): Use gpgme_engine_check_version instead
gpgme_check_engine.
* gpgsm/t-encrypt.c (main): Likewise.
2002-03-06 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-encrypt-sym.c: New file.
* gpg/Makefile.am (TESTS): Add t-encrypt-sym.
2002-03-05 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (CLEANFILES): Remove random_seed, which is now
in DISTCLEANFILES.
2002-03-04 Werner Koch <wk@gnupg.org>
* gpg/Makefile.am (DISTCLEANFILES): Added.
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-verify.c (main): Add a few more sanity checks, and a check
for normal signatures.
2002-02-26 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-encrypt-sign.c: New file.
* gpg/Makefile.am (TESTS): Add t-encrypt-sign.
2002-02-13 Werner Koch <wk@gnupg.org>
* gpgsm/Makefile.am (private-keys-v1.d): Don't
fail when the directory already exists.
2002-02-12 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (CLEANFILES): New target.
(distclean-local): Rename to ...
(clean-local): ... this.
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (./private-keys-v1.d/$(key_id).key): Fix rule.
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-genkey.c: New file (not added to Makefile.am because of
gpg-agent bug).
2002-02-08 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (key_id): Update value.
(all-local): Add .key to keyid filename.
(./private-keys-v1.d/$(key_id)): Renamed to ...
(./private-keys-v1.d/$(key_id).key): ... this.
(all-local): Add ./gpgsm.conf, ./trustlist.txt.
(./gpgsm.conf, ./trustlist.txt): New target.
* gpgsm/567064FE6D14A17B2D811ABB407728BC558AA455: Renamed to ...
* gpgsm/32100C27173EF6E9C4E9A25D3D69F86D37A4F939: ... this.
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-import.c (print_op_info): New function.
(main): Use it.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-signers.c (passphrase_cb): Change type of r_hd to void**.
* gpg/t-sign.c (passphrase_cb): Likewise.
* gpg/t-decrypt-verify.c (passphrase_cb): Likewise.
* gpg/t-decrypt.c (passphrase_cb): Likewise.
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-decrypt-verify.c: Don't include `mcheck.h'. Reported by
Stéphane Corthésy.
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (EXTRA_DIST): Add missing line continuation.
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (EXTRA_DIST): Add $(key_id).
2001-12-16 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile: Rename `pubcerts.kbx' to `pubring.kbx'.
2001-12-15 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c (check_two_contexts): Set protocols.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-sign.c: New file.
* gpgsm/Makefile.am (TESTS): Add t-sign.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-decrypt.c: New file.
* gpgsm/567064FE6D14A17B2D811ABB407728BC558AA455: Likewise.
* gpgsm/Makefile.am (TESTS): Add t-decrypt.
(key_id): New variable.
(all-local): New target ./private-keys-v1.d/$(key_id) added.
(./private-keys-v1.d/$(key_id)): New target.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-verify.c: New file.
* gpgsm/Makefile.am (TESTS): Add t-verify.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (GPG): Set to @GPG_PATH@.
(./pubring.gpg): Use $(GPG) instead gpg.
(./secring.gpg): Likewise.
* gpgsm/t-import.c (main): Remove third test case.
* gpgsm/Makefile.am (GPGSM): Set to @GPGSM@.
(all-local): New target.
(./pubcerts.kbx): Likewise.
* gpgsm/t-encrypt.c: New file.
* gpgsm/Makefile.am (TESTS): Add t-encrypt.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/t-keylist.c: New file.
* gpgsm/Makefile.am (TESTS): Add t-keylist.
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/cert_dfn_pca01.der: New file.
* gpgsm/cert_dfn_pca15.der: Likewise.
* gpgsm/cert_g10code_test1.der: Likewise.
* gpgsm/t-import.c: Likewise.
* gpgsm/Makefile.am (EXTRADIST): Add new files.
(TESTS): Add t-import.
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* gpg/: New directory.
* Makefile.am, t-verify.c, t-encrypt.c, t-signers.c, t-trustlist.c,
t-sign.c, t-keylist.c, t-import.c, t-genkey.c, t-export.c,
t-decrypt-verify.c, t-decrypt.c, t-version.c, t-data.c, mkdemodirs.
cipher-1.asc, cipher-2.asc, geheim.txt, pubdemo.asc, pubkey-1.asc,
secdemo.asc, seckey-1.asc): Move to sub directory gpg/.
* gpg/Makefile.am (INCLUDES): Include gpgme/, not include/ and
intl/.
(LDD): Correct relative path to gpgme library.
(TESTS): Remove t-version and t-data.
* gpg/t-verify.c, gpg/t-encrypt.c, gpg/t-signers.c, gpg/t-trustlist.c,
gpg/t-sign.c, gpg/t-keylist.c, gpg/t-import.c, gpg/t-genkey.c,
gpg/t-export.c, gpg/t-decrypt-verify.c, gpg/t-decrypt.c,
t-version.c, t-data.c): Include gpgme.h, not "../gpgme/gpgme.h".
* Makefile.am: New file.
* gpgsm/: New directory.
* gpgsm/Makefile.am: New file.
2001-11-16 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (TESTS): Add t-decrypt-verify.
* t-decrypt-verify.c: New file.
* cipher-2.asc: Likewise.
2001-11-02 Marcus Brinkmann <marcus@g10code.de>
* t-data.c: Include stddef.h.
(read_once_test): Change type of READ to size_t.
(read_test): Likewise.
(write_test): Likewise.
2001-10-29 Marcus Brinkmann <marcus@g10code.de>
* t-signers.c: New file.
* Makefile.am (TESTS): Add t-signers.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (TEST_ENVIRONMENT): Revert last change.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (TEST_ENVIRONMENT): Set environment to $(srcdir),
not current directory.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* t-data.c (write_test): New function.
(main): Invoke write_test for all rounds except TEST_OUT_CB.
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (INCLUDES): Remove spurious duplicate to silence
automake.
2001-10-16 Marcus Brinkmann <marcus@g10code.de>
* t-version.c: New file.
* t-data.c: Likewise.
* t-data-1.txt: Likewise.
* t-data-2.txt: Likewise.
* Makefile.am (TESTS): Add t-version, t-data.
2001-09-17 Werner Koch <wk@gnupg.org>
* t-keylist.c (check_two_contexts): New.
2001-09-03 Werner Koch <wk@gnupg.org>
* t-encrypt.c (print_op_info): New and use it after each operation..
2001-08-28 Werner Koch <wk@gnupg.org>
* t-sign.c (print_op_info): New and use it after each operation.
2001-03-15 Werner Koch <wk@gnupg.org>
* t-keylist.c (doit): List subkeys too, show caps.
2001-02-13 Werner Koch <wk@gnupg.org>
* t-verify.c (print_sig_stat): Repaled ulong by unsigned long
because we don't use the config stuff here.
2001-02-12 Werner Koch <wk@gnupg.org>
* tests/t-verify.c (print_sig_stat): Print info about the keys.
Copyright 2001, 2004 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
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aee20ca1..ceabc999 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,48 +1,48 @@
# Makefile.am - Makefile for GPGME tests.
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2004 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
-TESTS_ENVIRONMENT = GNUPGHOME=.
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
TESTS = t-version t-data t-engine-info
EXTRA_DIST = t-data-1.txt t-data-2.txt
INCLUDES = -I$(top_srcdir)/gpgme
AM_CPPFLAGS = @GPG_ERROR_CFLAGS@
LDADD = ../gpgme/libgpgme.la @GPG_ERROR_LIBS@
noinst_PROGRAMS = $(TESTS)
if RUN_GPG_TESTS
gpgtests = gpg
else
gpgtests =
endif
if RUN_GPGSM_TESTS
gpgsmtests = gpgsm
else
gpgsmtests =
endif
SUBDIRS = ${gpgtests} ${gpgsmtests}
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index e5d9de9b..cac589f2 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -1,70 +1,70 @@
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2004, 2005 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
GPG = @GPG@
-TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO=
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
# The keylist tests must come after the import and the edit test.
noinst_HEADERS = t-support.h
if HAVE_W32_SYSTEM
tests_unix =
else
tests_unix = t-eventloop t-thread1
endif
TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
- t-encrypt-large t-file-name $(tests_unix)
+ t-encrypt-large t-file-name t-gpgconf $(tests_unix)
-CLEANFILES = secring.gpg pubring.gpg trustdb.gpg
+CLEANFILES = secring.gpg pubring.gpg trustdb.gpg dirmngr.conf
DISTCLEANFILES = pubring.gpg~ random_seed gpg.conf
EXTRA_DIST = mkdemodirs pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
geheim.txt pubkey-1.asc seckey-1.asc
INCLUDES = -I$(top_srcdir)/gpgme
AM_CPPFLAGS = @GPG_ERROR_CFLAGS@
LDADD = ../../gpgme/libgpgme.la
t_thread1_LDADD = ../../gpgme/libgpgme-pthread.la
# We don't run t-genkey in the test suite, because it takes too long
noinst_PROGRAMS = $(TESTS) t-genkey
clean-local:
$(srcdir)/mkdemodirs --clean
all-local: ./pubring.gpg ./gpg.conf
./pubring.gpg: $(srcdir)/pubdemo.asc ./Alpha/Secret.gpg
$(GPG) --homedir . --import $(srcdir)/pubdemo.asc
$(GPG) --homedir . --allow-secret-key-import \
--import Alpha/Secret.gpg Zulu/Secret.gpg
./Alpha/Secret.gpg: secdemo.asc
srcdir=$(srcdir) $(srcdir)/mkdemodirs
./gpg.conf:
# This is required for t-sig-notations.
echo no-force-v3-sigs > ./gpg.conf
diff --git a/tests/gpg/t-gpgconf.c b/tests/gpg/t-gpgconf.c
new file mode 100644
index 00000000..458bbe75
--- /dev/null
+++ b/tests/gpg/t-gpgconf.c
@@ -0,0 +1,305 @@
+/* t-gpgconf.c - Regression test.
+ Copyright (C) 2001, 2004, 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, 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 <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <string.h>
+
+#ifdef HAVE_W32_SYSTEM
+#include <windows.h>
+#endif
+
+#include <gpgme.h>
+
+
+#define fail_if_err(err) \
+ do \
+ { \
+ if (err) \
+ { \
+ fprintf (stderr, "%s:%d: %s: %s\n", \
+ __FILE__, __LINE__, gpgme_strsource (err), \
+ gpgme_strerror (err)); \
+ exit (1); \
+ } \
+ } \
+ while (0)
+
+
+void
+init_gpgme (gpgme_protocol_t proto)
+{
+ gpgme_error_t err;
+
+ gpgme_check_version (NULL);
+ setlocale (LC_ALL, "");
+ gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
+#ifndef HAVE_W32_SYSTEM
+ gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
+#endif
+
+ err = gpgme_engine_check_version (proto);
+ fail_if_err (err);
+}
+
+
+static char *
+spaces (char *str, int extra)
+{
+ static char buf[80];
+ int len = str ? strlen (str) : 0;
+ int n;
+
+#define TABSTOP 30
+ n = TABSTOP - len - extra;
+
+ memset (buf, ' ', sizeof (buf));
+ if (n < 1 || n > (sizeof (buf) - 1))
+ {
+ buf[0] = '\n';
+ n = TABSTOP + 1;
+ }
+
+ buf[n] = '\0';
+ return buf;
+}
+
+
+void
+dump_arg (int type, gpgme_conf_arg_t arg)
+{
+ if (!arg)
+ {
+ printf ("(none)");
+ return;
+ }
+
+ while (arg)
+ {
+ switch (type)
+ {
+ case GPGME_CONF_STRING:
+ case GPGME_CONF_PATHNAME:
+ case GPGME_CONF_LDAP_SERVER:
+ printf ("%s", arg->value.string);
+ break;
+
+ case GPGME_CONF_UINT32:
+ printf ("%u", arg->value.uint32);
+ break;
+
+ case GPGME_CONF_INT32:
+ printf ("%i", arg->value.int32);
+ break;
+
+ case GPGME_CONF_NONE:
+ printf ("%i (times)", arg->value.count);
+ break;
+
+ default:
+ printf ("(unknown type)");
+ }
+
+ arg = arg->next;
+ if (arg)
+ printf (" ");
+ }
+}
+
+
+void
+dump_opt (gpgme_conf_opt_t opt)
+{
+ char level;
+ char runtime = (opt->flags & GPGME_CONF_RUNTIME) ? 'r' : ' ';
+
+ switch (opt->level)
+ {
+ case GPGME_CONF_BASIC:
+ level = 'b';
+ break;
+ case GPGME_CONF_ADVANCED:
+ level = 'a';
+ break;
+ case GPGME_CONF_EXPERT:
+ level = 'e';
+ break;
+ case GPGME_CONF_INVISIBLE:
+ level = 'i';
+ break;
+ case GPGME_CONF_INTERNAL:
+ level = '#';
+ break;
+ default:
+ level = '?';
+ }
+
+ if (opt->flags & GPGME_CONF_GROUP)
+ {
+ printf ("\n");
+ printf ("%c%c [%s]%s%s\n", level, runtime, opt->name, spaces (opt->name, 5),
+ opt->description
+ ? opt->description : "");
+ }
+ else
+ {
+ if (opt->argname)
+ {
+ char *more = (opt->flags & GPGME_CONF_LIST) ? "..." : "";
+
+ if (opt->flags & GPGME_CONF_OPTIONAL)
+ {
+ printf ("%c%c --%s [%s%s] %s", level, runtime, opt->name, opt->argname, more,
+ spaces (opt->name, 9 + strlen (opt->argname) + strlen (more)));
+ }
+ else
+ {
+ printf ("%c%c --%s %s%s %s", level, runtime, opt->name, opt->argname, more,
+ spaces (opt->name, 7 + strlen (opt->argname) + strlen (more)));
+ }
+ }
+ else
+ printf ("%c%c --%s%s", level, runtime, opt->name, spaces (opt->name, 5));
+
+ if (opt->description)
+ printf ("%s", opt->description);
+ printf ("\n");
+
+ if (opt->flags & GPGME_CONF_DEFAULT)
+ {
+ printf ("%s%s = ", spaces (NULL, 0), opt->argname ? opt->argname : "(default)");
+ dump_arg (opt->type, opt->default_value);
+ printf ("\n");
+ }
+ else if (opt->flags & GPGME_CONF_DEFAULT_DESC)
+ printf ("%s%s = %s\n", spaces (NULL, 0), opt->argname ? opt->argname : "(default)",
+ opt->default_description);
+
+ if (opt->no_arg_value)
+ {
+ printf ("%sNo Arg Def = ", spaces (NULL, 0));
+ dump_arg (opt->type, opt->no_arg_value);
+ printf ("\n");
+ }
+ if (opt->value)
+ {
+ printf ("%sCurrent = ", spaces (NULL, 0));
+ dump_arg (opt->type, opt->value);
+ printf ("\n");
+ }
+ }
+
+#if 0
+ arg = comp->options;
+ while (opt)
+ {
+ dump_opt (opt);
+ opt = opt->next;
+ }
+#endif
+}
+
+
+void
+dump_comp (gpgme_conf_comp_t comp)
+{
+ gpgme_conf_opt_t opt;
+
+ printf ("COMPONENT\n");
+ printf ("=========\n");
+ printf (" Name: %s\n", comp->name);
+ if (comp->description)
+ printf (" Desc: %s\n", comp->description);
+ if (comp->program_name)
+ printf (" Path: %s\n", comp->program_name);
+ printf ("\n");
+
+ opt = comp->options;
+ while (opt)
+ {
+ dump_opt (opt);
+ opt = opt->next;
+ }
+}
+
+
+int
+main (int argc, char **argv)
+{
+ gpgme_ctx_t ctx;
+ gpgme_error_t err;
+ gpgme_conf_comp_t conf;
+ gpgme_conf_comp_t comp;
+ int first;
+ init_gpgme (GPGME_PROTOCOL_GPGCONF);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ err = gpgme_op_conf_load (ctx, &conf);
+ fail_if_err (err);
+
+ comp = conf;
+ first = 1;
+ while (comp)
+ {
+ if (!first)
+ printf ("\n");
+ else
+ first = 0;
+ dump_comp (comp);
+ comp = comp->next;
+ }
+
+#if 1
+ /* Now change something. */
+ {
+ unsigned int count = 1;
+ gpgme_conf_arg_t arg;
+ gpgme_conf_opt_t opt;
+
+ err = gpgme_conf_arg_new (&arg, GPGME_CONF_NONE, &count);
+ fail_if_err (err);
+
+ comp = conf;
+ while (comp && strcmp (comp->name, "dirmngr"))
+ comp = comp->next;
+ opt = comp->options;
+ while (opt && strcmp (opt->name, "verbose"))
+ opt = opt->next;
+
+ err = gpgme_conf_opt_change (opt, 0, arg);
+ fail_if_err (err);
+
+ err = gpgme_op_conf_save (ctx, comp);
+ fail_if_err (err);
+ }
+#endif
+
+ gpgme_conf_release (conf);
+
+ return 0;
+}
diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am
index 86c04b0d..4d34b91f 100644
--- a/tests/gpgsm/Makefile.am
+++ b/tests/gpgsm/Makefile.am
@@ -1,65 +1,65 @@
# 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 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
GPGSM = @GPGSM@
-TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO=
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
noinst_HEADERS = t-support.h
TESTS = t-import t-keylist t-encrypt t-verify t-decrypt t-sign t-export
EXTRA_DIST = cert_dfn_pca01.der cert_dfn_pca15.der cert_g10code_test1.der \
$(key_id)
INCLUDES = -I$(top_srcdir)/gpgme
AM_CPPFLAGS = @GPG_ERROR_CFLAGS@
LDADD = ../../gpgme/libgpgme.la
# We don't run t-genkey in the test suite, because it takes too long
# and needs a working pinentry.
noinst_PROGRAMS = $(TESTS) t-genkey
key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939
DISTCLEANFILES = pubring.kbx pubring.kbx~ gpgsm.conf trustlist.txt \
private-keys-v1.d/$(key_id).key random_seed
all-local: ./pubring.kbx ./gpgsm.conf ./private-keys-v1.d/$(key_id).key ./trustlist.txt
./pubring.kbx: $(srcdir)/cert_g10code_test1.der
$(GPGSM) --homedir . --import $(srcdir)/cert_g10code_test1.der
./gpgsm.conf:
echo disable-crl-checks > ./gpgsm.conf
echo faked-system-time 1008241200 >> ./gpgsm.conf
./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id)
test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
./trustlist.txt:
echo $(key_id) > ./trustlist.txt
echo >> ./trustlist.txt
echo "# CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE" >> ./trustlist.txt
echo "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S" >> ./trustlist.txt

File Metadata

Mime Type
text/x-diff
Expires
Sat, Feb 1, 9:34 AM (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
22/f4/8161c1f1fed088ffed371b21162b

Event Timeline