-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message This is a patch file to create version 1.1.3 from 1.1.2. Please check the signature of this patch file: zcat somepath/gpgme-1.1.2-1.1.3.diff.gz | gpg --verify Change to directory gpgme-1.1.2 (or however you renamed it) and give this command: zcat somepath/gpgme-1.1.2-1.1.3.diff.gz | patch -p1 It is a good idea to rename your current directory to gpgme-1.1.3 now. diff -urpNP gpgme-1.1.2/VERSION gpgme-1.1.3/VERSION --- gpgme-1.1.2/VERSION 2006-03-02 10:25:42.000000000 +0000 +++ gpgme-1.1.3/VERSION 2007-01-29 20:17:57.000000000 +0000 @@ -1 +1 @@ -1.1.2 +1.1.3 diff -urpNP gpgme-1.1.2/ChangeLog gpgme-1.1.3/ChangeLog --- gpgme-1.1.2/ChangeLog 2006-03-02 10:15:39.000000000 +0000 +++ gpgme-1.1.3/ChangeLog 2007-01-29 20:16:20.000000000 +0000 @@ -1,3 +1,64 @@ +2007-01-29 Marcus Brinkmann + + * Released 1.1.3. + + * configure.ac (LIBGPGME_LT_REVISION): Bump for release. + +2007-01-26 Werner Koch + + * 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 + + * configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION): Must define + after it may have been changed by an option. + +2007-01-08 Werner Koch + + * 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 + + * configure.ac: Add options --with-gpg-version and + --with-gpgsm-version to allow overriding the minimum version + requirements. + +2006-12-17 Marcus Brinkmann + + * configure.ac: Fix two typos in last change. + +2006-12-03 Marcus Brinkmann + + * 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 + + * configure.ac (NEED_GPG_VERSION): Bump to 1.3.0. + +2006-09-19 Marcus Brinkmann + + * configure.ac: Turn stpcpy into a replacement function. + Check for unistd.h and add setenv as replacement function. + +2006-07-29 Marcus Brinkmann + + * configure.ac: Check for network libraries and set NETLIBS. + +2006-07-06 Marcus Brinkmann + + * 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 * configure.ac (LIBGPGME_LT_REVISION): Bump for release. diff -urpNP gpgme-1.1.2/Makefile.am gpgme-1.1.3/Makefile.am --- gpgme-1.1.2/Makefile.am 2005-09-08 14:42:33.000000000 +0000 +++ gpgme-1.1.3/Makefile.am 2007-01-29 20:16:20.000000000 +0000 @@ -43,7 +43,7 @@ else tests = endif -SUBDIRS = ${assuan} gpgme ${tests} doc ${complus} +SUBDIRS = ${assuan} gpgme ${tests} doc ${complus} lang # Fix the version of the spec file and create a file named VERSION # to be used for patch's Prereq: feature. diff -urpNP gpgme-1.1.2/Makefile.in gpgme-1.1.3/Makefile.in --- gpgme-1.1.2/Makefile.in 2006-03-02 10:23:07.000000000 +0000 +++ gpgme-1.1.3/Makefile.in 2007-01-29 20:17:03.000000000 +0000 @@ -83,7 +83,7 @@ RECURSIVE_TARGETS = all-recursive check- uninstall-recursive ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = assuan gpgme tests doc complus +DIST_SUBDIRS = assuan gpgme tests doc complus lang DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -179,6 +179,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -202,6 +203,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ @@ -259,7 +262,7 @@ EXTRA_DIST = gpgme.spec.in autogen.sh @BUILD_COMPLUS_TRUE@complus = complus @RUN_GPG_TESTS_FALSE@tests = @RUN_GPG_TESTS_TRUE@tests = tests -SUBDIRS = ${assuan} gpgme ${tests} doc ${complus} +SUBDIRS = ${assuan} gpgme ${tests} doc ${complus} lang all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -460,7 +463,7 @@ distclean-tags: distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkdir_p) $(distdir)/gpgme $(distdir)/m4 + $(mkdir_p) $(distdir)/gpgme $(distdir)/lang/cl $(distdir)/m4 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ diff -urpNP gpgme-1.1.2/NEWS gpgme-1.1.3/NEWS --- gpgme-1.1.2/NEWS 2006-03-02 10:14:51.000000000 +0000 +++ gpgme-1.1.3/NEWS 2007-01-29 20:16:20.000000000 +0000 @@ -1,3 +1,11 @@ +Noteworthy changes in version 1.1.3 (2007-01-29) +------------------------------------------------ + + * Fixed a memory leak in gpgme_data_release_and_get_mem. + + * Fixed a bug in Windows command line quoting. + + Noteworthy changes in version 1.1.2 (2006-03-02) ------------------------------------------------ diff -urpNP gpgme-1.1.2/README gpgme-1.1.3/README --- gpgme-1.1.2/README 2005-09-08 14:42:33.000000000 +0000 +++ gpgme-1.1.3/README 2007-01-29 20:16:20.000000000 +0000 @@ -1,7 +1,7 @@ GPGME - GnuPG Made Easy --------------------------- - Copyright 2004 g10 Code GmbH + Copyright 2004, 2006 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 @@ -120,3 +120,4 @@ in the tests/gpg/ directory may also pro Please subscribe to the gnupg-devel@gnupg.org mailing list if you want to do serious work. + diff -urpNP gpgme-1.1.2/TODO gpgme-1.1.3/TODO --- gpgme-1.1.2/TODO 2006-02-22 11:27:27.000000000 +0000 +++ gpgme-1.1.3/TODO 2007-01-29 20:16:20.000000000 +0000 @@ -78,6 +78,8 @@ Hey Emacs, this is -*- outline -*- mode! release everything properly at a reset and at an error. Think hard about where to guarantee what (ie, what happens if start fails, are the fds unregistered immediately - i think so?) + Note that we need support in gpgsm to set include-certs to default + as RESET does not reset it. ** Optimize the case where a data object has 0an underlying fd we can pass directly to the engine. This will be automatic with socket I/O and descriptor passing. @@ -86,8 +88,25 @@ Hey Emacs, this is -*- outline -*- mode! (it's an internal error, as select_protocol checks already). ** When server mode is implemented properly, more care has to be taken to release all resources on error (for example to free assuan_cmd). +* GPG breakage: +** gpg 1.4.2 lacks error reporting if sign/encrypt with revoked key. +** gpg 1.4.2 does crappy error reporting (namely none at all) when + smart card is missing for sign operation: + [GNUPG:] CARDCTRL 4 + gpg: selecting openpgp failed: ec=6.110 + gpg: signing failed: general error + [GNUPG:] BEGIN_ENCRYPTION 2 10 + gpg: test: sign+encrypt failed: general error +** Without agent and with wrong passphrase, gpg 1.4.2 enters into an + infinite loop. +** Use correct argv[0] + In rungpg.c:build_argv we use + argv[argc] = strdup ("gpg"); /* argv[0] */ + This should be changed to take the real file name used in account. + * Operations +** Include cert values -2, -1, 0 and 1 should be defined as macros. ** If an operation failed, make sure that the result functions don't return corrupt partial information. !!! NOTE: The EOF status handler is not called in this case !!! diff -urpNP gpgme-1.1.2/assuan/ChangeLog gpgme-1.1.3/assuan/ChangeLog diff -urpNP gpgme-1.1.2/assuan/ChangeLog gpgme-1.1.3/assuan/ChangeLog --- gpgme-1.1.2/assuan/ChangeLog 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/assuan/ChangeLog 2007-01-29 20:16:19.000000000 +0000 @@ -1,3 +1,238 @@ +2006-11-22 Werner Koch + + * assuan-handler.c (fun1_cookie_write, fun2_cookie_write): New. + (assuan_get_data_fp) [HAVE_FUNOPEN]: Use it. + +2006-11-21 Werner Koch + + * Makefile.am (libassuan_pth_a_CFLAGS): New. + + * assuan-pipe-server.c (_assuan_release_context): Free CMDTBL. + +2006-11-14 Werner Koch + + * libassuan.m4 (AM_CHECK_LIBASSUAN): New. + + * assuan-handler.c (assuan_register_post_cmd_notify) + (assuan_register_post_cmd_notify): New. + * assuan-util.c (assuan_set_io_monitor): New. + * assuan-buffer.c (_assuan_read_line): Use it. + (_assuan_write_line): Ditto. + (_assuan_cookie_write_data): Ditto. + (_assuan_cookie_write_flush): Ditto. + +2006-10-18 Werner Koch + + * libassuan.m4: Pass "pthread" to the common macro. Reported by + Rex Dieter. + +2006-10-16 Werner Koch + + * mkerrors: Map ASSUAN_Not_Confirmed. + +2006-10-10 Werner Koch + + * libassuan.m4 (AM_PATH_LIBASSUAN_PTH) + (AM_PATH_LIBASSUAN_PTHREAD): Fixed. + + * assuan-buffer.c (assuan_sendfd): Implement a runtime detection + of implemented descripotr passing. + + * assuan-uds.c: Take care of USE_DESCRIPTOR_PASSING. + + * assuan-defs.h: Add missing semicolon. + +2006-10-09 Werner Koch + + * assuan-handler.c (process_request): Use weak pragma for the sake + of old gcc's. Reported by Alain Guibert. + + * assuan-io.c: Removed Pth support. + * assuan-io-pth.c: New. Based on assuan-io.c + +2006-10-06 Werner Koch + + * libassuan-config.in: New options --api-version and --thread. + +2006-10-04 Werner Koch + + * assuan-client.c (assuan_transact): Need to map old assuan status + codes so that for example CANCELED is correctly mapped. + +2006-09-28 Marcus Brinkmann + + * assuan-client.c (assuan_transact): Do not convert error on + status line, it is already a gpg-error. Do convert + ASSUAN_Server_Fault. + +2006-09-19 Marcus Brinkmann + + * assuan.h (assuan_init_socket_server_ext) + [_ASSUAN_EXT_SYM_PREFIX]: Fix typo in macro. + +2006-09-19 Werner Koch + + * assuan-defs.h (putc_unlocked): Add prototype. + + * assuan-socket-server.c (accept_connection): Made LEN a socklen_t. + + * assuan.h: Replaced assuan error code enum by simple defines and + made assuan_error_t an int. + * mkerrors: Changed parser accordingly. + +2006-09-19 Marcus Brinkmann + + * assuan-pipe-connect.c: Add hacks for Slowaris. + * assuan-socket.c: Likewise here. + + * assuan.h (enum): Avoid trailing comma in enumerator list. Ugh. + + * mkerrors (_assuan_error): Change return type to assuan_error_t. + * assuan-buffer.c (_assuan_read_line): Change return type to + assuan_error_t. Map returned value of -1. + (_assuan_write_line): Change type of RC to assuan_error_t. + * assuan-defs.h (_assuan_read_line, _assuan_error): Likewise for + prototypes. + + * assuan-defs.h (unsetenv): Define correctly. + +2006-09-14 Werner Koch + + * assuan-io.c (_assuan_waitpid): New. Changed all waitpid calls + to this. + + * assuan.h (_ASSUAN_DEPRECATED): New internal macro. + (assuan_pipe_connect2): Declare deprecated. + (assuan_init_connected_socket_server): Declare deprecated. + + * assuan-connect.c (assuan_get_peercred): New. + * assuan-socket-server.c (accept_connection_bottom): Save uid and gid. + +2006-09-13 Werner Koch + + * assuan-client.c (assuan_transact): Need to map the error code. + * mkerrors: Need to map ASSUAN_No_Secret_Key. + + * assuan-pipe-server.c (is_valid_socket): New. + (assuan_init_pipe_server): Use UDS with the environmet variable is + set and a valid descriptor is given. Ignore FILEDES in this case. + + * assuan-socket-server.c (assuan_init_socket_server_ext): New. + Changed other init fucntions to make use of it. + + * assuan-handler.c (assuan_command_parse_fd): Allow for lowercase + "fd". + (std_handler_reset): Close pending fds. + * assuan-uds.c (uds_receivefd): Fixed. + (_assuan_uds_close_fds): New. + + * assuan-socket-connect.c (assuan_socket_connect_ext): New. Takes + all code of assuan_socket_connect plus an option to use sendmsg. + * assuan-pipe-connect.c (assuan_pipe_connect_ext): New arg FLAGS. + +2006-09-12 Werner Koch + + * assuan-buffer.c (_assuan_write_line): Also log the prefix. + + * assuan-defs.h (DIM, DIMof): New. + + * assuan-domain-server.c: Removed. + * assuan-domain-connect.c: Renamed to .. + * assuan-uds.c: this. + (domain_reader, domain_writer, domain_sendfd, domain_receivefd) + (assuan_domain_connect, _assuan_domain_init): Removed. + (uds_reader, uds_writer, uds_sendfd, uds_receivefd) + (_assuan_init_uds_io): New. + (_assuan_uds_deinit): New. + + * assuan-io.c (_assuan_simple_sendmsg, _assuan_simple_recvmsg): New. + (my_pth_fdmode, my_pth_select): New. + +2006-09-11 Werner Koch + + * assuan-pipe-server.c (assuan_init_pipe_server): Allow for + FILEDES to be NULL and try to start as a socketpair server in this + case. + + * assuan-pipe-connect.c (assuan_pipe_connect2): Split up into two + functions (unix and w32) for clarity. + (pipe_connect_unix): This is the new fucntion. Add USE_CMSG flag. + (pipe_connect_w32): Ditto. + (initial_handshake): Factored out code. + (socketpair_connect): New. + (assuan_pipe_connect_ext): New. + (do_finish): Handle case if outbound and inbound fd are the same. + This is to support socketpairs. + +2006-09-10 Werner Koch + + * assuan-util.c (_assuan_log_print_buffer) + (_assuan_log_sanitized_string,assuan_set_log_stream): Moved to .. + * assuan-logging.c: .. here. + (_assuan_log_print_buffer): Only print the leading bytes in hex + log mode unless the new env variable ASSUAN_FULL_LOGGING has been + set. + (_assuan_set_default_log_stream): Test this env variable. + +2006-09-06 Werner Koch + + * assuan.h (_ASSUAN_ONLY_GPG_ERRORS): New. + + * assuan-handler.c (dispatch_command): Use Syntax_Error instead of + Invalid_Command. + + * assuan-domain-connect.c: Changed alloc malloc/free/realloc to + xtrymalloc et al. + (read_int, write_int): Make args void pointers. + (domain_receivefd): Take care of realloc shrinking failure. + + * assuan-buffer.c (_assuan_read_line, _assuan_write_line) + (assuan_write_line, _assuan_cookie_write_data) + (_assuan_cookie_write_flush): Print the inbound fd instead of the + address of the context when logging I/0. This makes it more + readable. + +2006-09-05 Werner Koch + + * assuan-defs.h (err_code, err_is_eof): New. + + * mkerrors (_assuan_error): New. Wrapped all error code + assignments in a call to this. + (assuan_strerror): Map gpg-style error codes back. Also print a + string for the old EOF code. + (assuan_set_assuan_err_source): New. + + * assuan-logging.c (_assuan_log_printf): Do not change ERRNO and + print the pid. + + * assuan-domain-connect.c (domain_reader): Replaced plain printf + by assuan_log function. + +2005-10-24 Werner Koch + + * putc_unlocked.c, memrchr.c, isascii.c, funopen.c: Changed + distribution terms to LGPL. This are small and trivial files so + there are no obstacles of doing so. + * assuan-socket.c: Likewise, the stated GPL was not intended. + +2005-10-08 Marcus Brinkmann + + * assuan-defs.h (setenv, unsetenv, clearenv) [!HAVE_SETENV]: + Define to _assuan_*. + * setenv.c: Include "assuan-defs.h". + (__add_to_environ): Make static. + +2005-10-07 Marcus Brinkmann + + * assuan-defs.h (memrchr) [!HAVE_MEMRCHR]: New prototype. + (stpcpy) [!HAVE_STPCPY]: Likewise. + * stpcpy.c: New LGPL'ed file from the GNU C Library. + * setenv.c: New file. + * assuan-domain-connect.c (read_int): New function. + (write_int): New function. + (domain_reader): Use read_int. + (domain_sendfd): Use write_int. + 2005-10-01 Marcus Brinkmann * assuan.h (assuan_pipe_connect, assuan_pipe_connect2): Make type diff -urpNP gpgme-1.1.2/assuan/Makefile.am gpgme-1.1.3/assuan/Makefile.am --- gpgme-1.1.2/assuan/Makefile.am 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/Makefile.am 2007-01-29 20:16:18.000000000 +0000 @@ -15,7 +15,7 @@ # # 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 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA ## Process this file with automake to produce Makefile.in @@ -44,12 +44,11 @@ libassuan_la_SOURCES = \ assuan-socket-server.c \ assuan-pipe-connect.c \ assuan-socket-connect.c \ - assuan-socket.c \ + assuan-uds.c \ funopen.c \ assuan-io.c \ - assuan-domain-connect.c \ - assuan-domain-server.c \ - assuan-logging.c + assuan-logging.c \ + assuan-socket.c -assuan-errors.c : assuan.h +assuan-errors.c : assuan.h mkerrors $(srcdir)/mkerrors < $(srcdir)/assuan.h > assuan-errors.c diff -urpNP gpgme-1.1.2/assuan/Makefile.in gpgme-1.1.3/assuan/Makefile.in --- gpgme-1.1.2/assuan/Makefile.in 2006-03-02 10:23:06.000000000 +0000 +++ gpgme-1.1.3/assuan/Makefile.in 2007-01-29 20:16:58.000000000 +0000 @@ -31,7 +31,7 @@ # # 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 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -73,10 +73,8 @@ am_libassuan_la_OBJECTS = assuan-util.lo assuan-buffer.lo assuan-handler.lo assuan-inquire.lo \ assuan-listen.lo assuan-connect.lo assuan-client.lo \ assuan-pipe-server.lo assuan-socket-server.lo \ - assuan-pipe-connect.lo assuan-socket-connect.lo \ - assuan-socket.lo funopen.lo assuan-io.lo \ - assuan-domain-connect.lo assuan-domain-server.lo \ - assuan-logging.lo + assuan-pipe-connect.lo assuan-socket-connect.lo assuan-uds.lo \ + funopen.lo assuan-io.lo assuan-logging.lo assuan-socket.lo libassuan_la_OBJECTS = $(am_libassuan_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -178,6 +176,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -201,6 +200,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ @@ -272,12 +273,11 @@ libassuan_la_SOURCES = \ assuan-socket-server.c \ assuan-pipe-connect.c \ assuan-socket-connect.c \ - assuan-socket.c \ + assuan-uds.c \ funopen.c \ assuan-io.c \ - assuan-domain-connect.c \ - assuan-domain-server.c \ - assuan-logging.c + assuan-logging.c \ + assuan-socket.c all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -334,8 +334,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-buffer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-connect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-domain-connect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-domain-server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-errors.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-handler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-inquire.Plo@am__quote@ @@ -347,6 +345,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-socket-connect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-socket-server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-socket.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-uds.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funopen.Plo@am__quote@ @@ -552,7 +551,7 @@ uninstall-am: uninstall-info-am uninstall-info-am -assuan-errors.c : assuan.h +assuan-errors.c : assuan.h mkerrors $(srcdir)/mkerrors < $(srcdir)/assuan.h > assuan-errors.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -urpNP gpgme-1.1.2/assuan/assuan-buffer.c gpgme-1.1.3/assuan/assuan-buffer.c --- gpgme-1.1.2/assuan/assuan-buffer.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-buffer.c 2007-01-29 20:16:18.000000000 +0000 @@ -1,5 +1,5 @@ /* assuan-buffer.c - read and send data - * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. * * This file is part of Assuan. * @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -30,8 +31,11 @@ #endif #include "assuan-defs.h" + +/* Extended version of write(2) to guarantee that all bytes are + written. Returns 0 on success or -1 and ERRNO on failure. */ static int -writen (ASSUAN_CONTEXT ctx, const char *buffer, size_t length) +writen (assuan_context_t ctx, const char *buffer, size_t length) { while (length) { @@ -49,9 +53,11 @@ writen (ASSUAN_CONTEXT ctx, const char * return 0; /* okay */ } -/* Read an entire line. */ +/* Read an entire line. Returns 0 on success or -1 and ERRNo on + failure. EOF is indictated by setting the integer at address + R_EOF. */ static int -readline (ASSUAN_CONTEXT ctx, char *buf, size_t buflen, +readline (assuan_context_t ctx, char *buf, size_t buflen, int *r_nread, int *r_eof) { size_t nleft = buflen; @@ -88,8 +94,9 @@ readline (ASSUAN_CONTEXT ctx, char *buf, } -int -_assuan_read_line (ASSUAN_CONTEXT ctx) +/* Function returns an Assuan error. */ +assuan_error_t +_assuan_read_line (assuan_context_t ctx) { char *line = ctx->inbound.line; int nread, atticlen; @@ -97,7 +104,7 @@ _assuan_read_line (ASSUAN_CONTEXT ctx) char *endp = 0; if (ctx->inbound.eof) - return -1; + return _assuan_error (-1); atticlen = ctx->inbound.attic.linelen; if (atticlen) @@ -128,19 +135,20 @@ _assuan_read_line (ASSUAN_CONTEXT ctx) if (rc) { if (ctx->log_fp) - fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- [Error: %s]\n", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Error: %s]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx, strerror (errno)); - return ASSUAN_Read_Error; + (unsigned int)getpid (), ctx->inbound.fd, + strerror (errno)); + return _assuan_error (ASSUAN_Read_Error); } if (!nread) { assert (ctx->inbound.eof); if (ctx->log_fp) - fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- [EOF]\n", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [EOF]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); - return -1; + (unsigned int)getpid (), ctx->inbound.fd); + return _assuan_error (-1); } ctx->inbound.attic.pending = 0; @@ -151,7 +159,9 @@ _assuan_read_line (ASSUAN_CONTEXT ctx) if (endp) { + unsigned monitor_result; int n = endp - line + 1; + if (n < nread) /* LINE contains more than one line. We copy it to the attic now as handlers are allowed to modify the passed @@ -168,11 +178,20 @@ _assuan_read_line (ASSUAN_CONTEXT ctx) *endp = 0; ctx->inbound.linelen = endp - line; - if (ctx->log_fp) + + monitor_result = (ctx->io_monitor + ? ctx->io_monitor (ctx, 0, + ctx->inbound.line, + ctx->inbound.linelen) + : 0); + if ( (monitor_result & 2) ) + ctx->inbound.linelen = 0; + + if (ctx->log_fp && !(monitor_result & 1)) { - fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- ", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); else @@ -186,13 +205,14 @@ _assuan_read_line (ASSUAN_CONTEXT ctx) else { if (ctx->log_fp) - fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- [Invalid line]\n", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Invalid line]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); *line = 0; ctx->inbound.linelen = 0; - return ctx->inbound.eof ? ASSUAN_Line_Not_Terminated - : ASSUAN_Line_Too_Long; + return _assuan_error (ctx->inbound.eof + ? ASSUAN_Line_Not_Terminated + : ASSUAN_Line_Too_Long); } } @@ -207,12 +227,12 @@ _assuan_read_line (ASSUAN_CONTEXT ctx) See also: assuan_pending_line(). */ assuan_error_t -assuan_read_line (ASSUAN_CONTEXT ctx, char **line, size_t *linelen) +assuan_read_line (assuan_context_t ctx, char **line, size_t *linelen) { assuan_error_t err; if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); err = _assuan_read_line (ctx); *line = ctx->inbound.line; @@ -224,7 +244,7 @@ assuan_read_line (ASSUAN_CONTEXT ctx, ch /* Return true if a full line is buffered (i.e. an entire line may be read without any I/O). */ int -assuan_pending_line (ASSUAN_CONTEXT ctx) +assuan_pending_line (assuan_context_t ctx) { return ctx && ctx->inbound.attic.pending; } @@ -234,52 +254,61 @@ assuan_error_t _assuan_write_line (assuan_context_t ctx, const char *prefix, const char *line, size_t len) { - int rc = 0; + assuan_error_t rc = 0; size_t prefixlen = prefix? strlen (prefix):0; + unsigned int monitor_result; /* Make sure that the line is short enough. */ if (len + prefixlen + 2 > ASSUAN_LINELENGTH) { if (ctx->log_fp) - fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> " + fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> " "[supplied line too long -truncated]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); if (prefixlen > 5) prefixlen = 5; if (len > ASSUAN_LINELENGTH - prefixlen - 2) len = ASSUAN_LINELENGTH - prefixlen - 2 - 1; } + monitor_result = (ctx->io_monitor + ? ctx->io_monitor (ctx, 1, line, len) + : 0); + /* Fixme: we should do some kind of line buffering. */ - if (ctx->log_fp) + if (ctx->log_fp && !(monitor_result & 1)) { - fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> ", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); else - _assuan_log_print_buffer (ctx->log_fp, line, len); + { + if (prefixlen) + _assuan_log_print_buffer (ctx->log_fp, prefix, prefixlen); + _assuan_log_print_buffer (ctx->log_fp, line, len); + } putc ('\n', ctx->log_fp); } - if (prefixlen) + if (prefixlen && !(monitor_result & 2)) { rc = writen (ctx, prefix, prefixlen); if (rc) - rc = ASSUAN_Write_Error; + rc = _assuan_error (ASSUAN_Write_Error); } - if (!rc) + if (!rc && !(monitor_result & 2)) { rc = writen (ctx, line, len); if (rc) - rc = ASSUAN_Write_Error; + rc = _assuan_error (ASSUAN_Write_Error); if (!rc) { rc = writen (ctx, "\n", 1); if (rc) - rc = ASSUAN_Write_Error; + rc = _assuan_error (ASSUAN_Write_Error); } } return rc; @@ -287,13 +316,13 @@ _assuan_write_line (assuan_context_t ctx assuan_error_t -assuan_write_line (ASSUAN_CONTEXT ctx, const char *line) +assuan_write_line (assuan_context_t ctx, const char *line) { size_t len; const char *s; if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); /* Make sure that we never take a LF from the user - this might violate the protocol. */ @@ -301,10 +330,10 @@ assuan_write_line (ASSUAN_CONTEXT ctx, c len = s? (s-line) : strlen (line); if (ctx->log_fp && s) - fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> " - "[supplied line contained a LF -truncated]\n", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> " + "[supplied line contained a LF - truncated]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); return _assuan_write_line (ctx, NULL, line, len); } @@ -312,11 +341,11 @@ assuan_write_line (ASSUAN_CONTEXT ctx, c /* Write out the data in buffer as datalines with line wrapping and - percent escaping. This function is used for GNU's custom streams */ + percent escaping. This function is used for GNU's custom streams. */ int _assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size) { - ASSUAN_CONTEXT ctx = cookie; + assuan_context_t ctx = cookie; size_t size = orig_size; char *line; size_t linelen; @@ -329,7 +358,9 @@ _assuan_cookie_write_data (void *cookie, line += linelen; while (size) { - /* insert data line header */ + unsigned int monitor_result; + + /* Insert data line header. */ if (!linelen) { *line++ = 'D'; @@ -337,7 +368,7 @@ _assuan_cookie_write_data (void *cookie, linelen += 2; } - /* copy data, keep some space for the CRLF and to escape one character */ + /* Copy data, keep space for the CRLF and to escape one character. */ while (size && linelen < LINELENGTH-2-2) { if (*buffer == '%' || *buffer == '\r' || *buffer == '\n') @@ -355,13 +386,19 @@ _assuan_cookie_write_data (void *cookie, size--; } + + monitor_result = (ctx->io_monitor + ? ctx->io_monitor (ctx, 1, + ctx->outbound.data.line, linelen) + : 0); + if (linelen >= LINELENGTH-2-2) { - if (ctx->log_fp) + if (ctx->log_fp && !(monitor_result & 1)) { - fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> ", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); @@ -373,9 +410,10 @@ _assuan_cookie_write_data (void *cookie, } *line++ = '\n'; linelen++; - if (writen (ctx, ctx->outbound.data.line, linelen)) + if ( !(monitor_result & 2) + && writen (ctx, ctx->outbound.data.line, linelen)) { - ctx->outbound.data.error = ASSUAN_Write_Error; + ctx->outbound.data.error = _assuan_error (ASSUAN_Write_Error); return 0; } line = ctx->outbound.data.line; @@ -393,9 +431,10 @@ _assuan_cookie_write_data (void *cookie, int _assuan_cookie_write_flush (void *cookie) { - ASSUAN_CONTEXT ctx = cookie; + assuan_context_t ctx = cookie; char *line; size_t linelen; + unsigned int monitor_result; if (ctx->outbound.data.error) return 0; @@ -403,13 +442,19 @@ _assuan_cookie_write_flush (void *cookie line = ctx->outbound.data.line; linelen = ctx->outbound.data.linelen; line += linelen; + + monitor_result = (ctx->io_monitor + ? ctx->io_monitor (ctx, 1, + ctx->outbound.data.line, linelen) + : 0); + if (linelen) { - if (ctx->log_fp) + if (ctx->log_fp && !(monitor_result & 1)) { - fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> ", + fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), ctx->inbound.fd); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); else @@ -419,9 +464,10 @@ _assuan_cookie_write_flush (void *cookie } *line++ = '\n'; linelen++; - if (writen (ctx, ctx->outbound.data.line, linelen)) + if ( !(monitor_result & 2) + && writen (ctx, ctx->outbound.data.line, linelen)) { - ctx->outbound.data.error = ASSUAN_Write_Error; + ctx->outbound.data.error = _assuan_error (ASSUAN_Write_Error); return 0; } ctx->outbound.data.linelen = 0; @@ -449,12 +495,12 @@ _assuan_cookie_write_flush (void *cookie **/ assuan_error_t -assuan_send_data (ASSUAN_CONTEXT ctx, const void *buffer, size_t length) +assuan_send_data (assuan_context_t ctx, const void *buffer, size_t length) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!buffer && length) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!buffer) { /* flush what we have */ @@ -475,8 +521,17 @@ assuan_send_data (ASSUAN_CONTEXT ctx, co } assuan_error_t -assuan_sendfd (ASSUAN_CONTEXT ctx, int fd) +assuan_sendfd (assuan_context_t ctx, int fd) { + /* It is explicitly allowed to use (NULL, -1) as a runtime test to + check whether descriptor passing is available. */ + if (!ctx && fd == -1) +#ifdef USE_DESCRIPTOR_PASSING + return 0; +#else + return _assuan_error (ASSUAN_Not_Implemented); +#endif + if (! ctx->io->sendfd) return set_error (ctx, Not_Implemented, "server does not support sending and receiving " @@ -485,7 +540,7 @@ assuan_sendfd (ASSUAN_CONTEXT ctx, int f } assuan_error_t -assuan_receivefd (ASSUAN_CONTEXT ctx, int *fd) +assuan_receivefd (assuan_context_t ctx, int *fd) { if (! ctx->io->receivefd) return set_error (ctx, Not_Implemented, diff -urpNP gpgme-1.1.2/assuan/assuan-client.c gpgme-1.1.3/assuan/assuan-client.c --- gpgme-1.1.2/assuan/assuan-client.c 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-client.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -33,7 +34,7 @@ assuan_error_t -_assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off) +_assuan_read_from_server (assuan_context_t ctx, int *okay, int *off) { char *line; int linelen; @@ -103,7 +104,7 @@ _assuan_read_from_server (ASSUAN_CONTEXT *off = 3; } else - rc = ASSUAN_Invalid_Response; + rc = _assuan_error (ASSUAN_Invalid_Response); return rc; } @@ -112,7 +113,7 @@ _assuan_read_from_server (ASSUAN_CONTEXT /** * assuan_transact: * @ctx: The Assuan context - * @command: Coimmand line to be send to server + * @command: Command line to be send to the server * @data_cb: Callback function for data lines * @data_cb_arg: first argument passed to @data_cb * @inquire_cb: Callback function for a inquire response @@ -124,19 +125,22 @@ _assuan_read_from_server (ASSUAN_CONTEXT * * Return value: 0 on success or error code. The error code may be * the one one returned by the server in error lines or from the - * callback functions. + * callback functions. Take care: When a callback returns an error + * this function returns immediately with an error and thus the caller + * will altter return an Assuan error (write erro in most cases). **/ assuan_error_t -assuan_transact (ASSUAN_CONTEXT ctx, +assuan_transact (assuan_context_t ctx, const char *command, - assuan_error_t (*data_cb)(void *, const void *, size_t), + int (*data_cb)(void *, const void *, size_t), void *data_cb_arg, - assuan_error_t (*inquire_cb)(void*, const char *), + int (*inquire_cb)(void*, const char *), void *inquire_cb_arg, - assuan_error_t (*status_cb)(void*, const char *), + int (*status_cb)(void*, const char *), void *status_cb_arg) { - int rc, okay, off; + assuan_error_t rc; + int okay, off; char *line; int linelen; @@ -158,13 +162,15 @@ assuan_transact (ASSUAN_CONTEXT ctx, if (!okay) { rc = atoi (line); - if (rc < 100) - rc = ASSUAN_Server_Fault; + if (rc > 0 && rc < 100) + rc = _assuan_error (ASSUAN_Server_Fault); + else if (rc > 0 && rc <= 128) + rc = _assuan_error (rc); } else if (okay == 2) { if (!data_cb) - rc = ASSUAN_No_Data_Callback; + rc = _assuan_error (ASSUAN_No_Data_Callback); else { char *s, *d; @@ -193,7 +199,7 @@ assuan_transact (ASSUAN_CONTEXT ctx, { assuan_write_line (ctx, "END"); /* get out of inquire mode */ _assuan_read_from_server (ctx, &okay, &off); /* dummy read */ - rc = ASSUAN_No_Inquire_Callback; + rc = _assuan_error (ASSUAN_No_Inquire_Callback); } else { @@ -214,7 +220,7 @@ assuan_transact (ASSUAN_CONTEXT ctx, else if (okay == 5) { if (!data_cb) - rc = ASSUAN_No_Data_Callback; + rc = _assuan_error (ASSUAN_No_Data_Callback); else { rc = data_cb (data_cb_arg, NULL, 0); diff -urpNP gpgme-1.1.2/assuan/assuan-connect.c gpgme-1.1.3/assuan/assuan-connect.c --- gpgme-1.1.2/assuan/assuan-connect.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-connect.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifdef HAVE_CONFIG_H @@ -49,10 +50,30 @@ assuan_disconnect (assuan_context_t ctx) } } -/* Return the PID of the peer or -1 if not known. */ +/* Return the PID of the peer or -1 if not known. This function works + in some situations where assuan_get_ucred fails. */ pid_t assuan_get_pid (assuan_context_t ctx) { return (ctx && ctx->pid)? ctx->pid : -1; } + +/* Return user credentials. PID, UID and GID amy be gived as NULL if + you are not interested in this value. For getting the pid of the + peer the assuan_get_pid is usually better suited. */ +assuan_error_t +assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid) +{ + if (!ctx) + return _assuan_error (ASSUAN_Invalid_Value); + if (!ctx->peercred.valid) + return _assuan_error (ASSUAN_General_Error); + if (pid) + *pid = ctx->peercred.pid; + if (uid) + *uid = ctx->peercred.uid; + if (gid) + *gid = ctx->peercred.gid; + return 0; +} diff -urpNP gpgme-1.1.2/assuan/assuan-defs.h gpgme-1.1.3/assuan/assuan-defs.h --- gpgme-1.1.2/assuan/assuan-defs.h 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-defs.h 2007-01-29 20:16:19.000000000 +0000 @@ -1,5 +1,5 @@ /* assuan-defs.c - Internal definitions to Assuan - * Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. * * This file is part of Assuan. * @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifndef ASSUAN_DEFS_H @@ -62,24 +63,30 @@ char * stpcpy (char *dest, const char *s #define LINELENGTH ASSUAN_LINELENGTH + struct cmdtbl_s { const char *name; - int (*handler)(ASSUAN_CONTEXT, char *line); + int (*handler)(assuan_context_t, char *line); }; + +/* A structure to dispatch I/O functions. All these functions need to + return 0 on success and set ERRNO on failure. */ struct assuan_io { /* Routine to read from input_fd. */ - ssize_t (*readfnc) (ASSUAN_CONTEXT, void *, size_t); + ssize_t (*readfnc) (assuan_context_t, void *, size_t); /* Routine to write to output_fd. */ - ssize_t (*writefnc) (ASSUAN_CONTEXT, const void *, size_t); + ssize_t (*writefnc) (assuan_context_t, const void *, size_t); /* Send a file descriptor. */ - assuan_error_t (*sendfd) (ASSUAN_CONTEXT, int); + assuan_error_t (*sendfd) (assuan_context_t, int); /* Receive a file descriptor. */ - assuan_error_t (*receivefd) (ASSUAN_CONTEXT, int *); -}; + assuan_error_t (*receivefd) (assuan_context_t, int *); +}; + +/* The context we use with most functions. */ struct assuan_context_s { assuan_error_t err_no; @@ -88,18 +95,18 @@ struct assuan_context_s error codes. */ /* Context specific flags (cf. assuan_flag_t). */ - struct + struct { unsigned int no_waitpid:1; /* See ASSUAN_NO_WAITPID. */ - } flags; + } flags; int confidential; int is_server; /* Set if this is context belongs to a server */ int in_inquire; char *hello_line; char *okay_line; /* See assuan_set_okay_line() */ - - void *user_pointer; /* For assuan_get_pointer and assuan-set_pointer (). */ + + void *user_pointer; /* For assuan_get_pointer and assuan_set_pointer (). */ FILE *log_fp; @@ -109,7 +116,7 @@ struct assuan_context_s char line[LINELENGTH]; int linelen; /* w/o CR, LF - might not be the same as strlen(line) due to embedded nuls. However a nul - is always written at this pos */ + is always written at this pos. */ struct { char line[LINELENGTH]; int linelen ; @@ -122,49 +129,69 @@ struct assuan_context_s struct { FILE *fp; char line[LINELENGTH]; - int linelen; + int linelen; int error; - } data; + } data; } outbound; int pipe_mode; /* We are in pipe mode, i.e. we can handle just one - connection and must terminate then */ - pid_t pid; /* The the pid of the peer. */ + connection and must terminate then. */ + pid_t pid; /* The pid of the peer. */ int listen_fd; /* The fd we are listening on (used by socket servers) */ int connected_fd; /* helper */ + struct { + int valid; /* Whether this structure has valid information. */ + pid_t pid; /* The pid of the peer. */ + uid_t uid; /* The uid of the peer. */ + gid_t gid; /* The gid of the peer. */ + } peercred; /* Used for Unix domain sockets. */ struct sockaddr_un myaddr; struct sockaddr_un serveraddr; - /* When reading from datagram sockets, we must read an entire - message at a time. This means that we have to do our own - buffering to be able to get the semantics of read. */ - void *domainbuffer; - /* Offset of start of buffer. */ - int domainbufferoffset; - /* Bytes buffered. */ - int domainbuffersize; - /* Memory allocated. */ - int domainbufferallocated; - - int *pendingfds; - int pendingfdscount; - - void (*deinit_handler)(ASSUAN_CONTEXT); - int (*accept_handler)(ASSUAN_CONTEXT); - int (*finish_handler)(ASSUAN_CONTEXT); + + /* Structure used for unix domain socket buffering. FIXME: We don't + use datagrams anymore thus we could get away with a simpler + buffering approach. */ + struct { + void *buffer; /* Malloced buffer. */ + int bufferallocated; /* Memory allocated. */ + int bufferoffset; /* Offset of start of buffer. */ + int buffersize; /* Bytes buffered. */ + + int pendingfds[5]; /* Array to save received descriptors. */ + int pendingfdscount; /* Number of received descriptors. */ + } uds; + + void (*deinit_handler)(assuan_context_t); + int (*accept_handler)(assuan_context_t); + int (*finish_handler)(assuan_context_t); struct cmdtbl_s *cmdtbl; size_t cmdtbl_used; /* used entries */ size_t cmdtbl_size; /* allocated size of table */ - void (*bye_notify_fnc)(ASSUAN_CONTEXT); - void (*reset_notify_fnc)(ASSUAN_CONTEXT); - void (*cancel_notify_fnc)(ASSUAN_CONTEXT); - int (*option_handler_fnc)(ASSUAN_CONTEXT,const char*, const char*); - void (*input_notify_fnc)(ASSUAN_CONTEXT, const char *); - void (*output_notify_fnc)(ASSUAN_CONTEXT, const char *); + void (*bye_notify_fnc)(assuan_context_t); + void (*reset_notify_fnc)(assuan_context_t); + void (*cancel_notify_fnc)(assuan_context_t); + int (*option_handler_fnc)(assuan_context_t,const char*, const char*); + void (*input_notify_fnc)(assuan_context_t, const char *); + void (*output_notify_fnc)(assuan_context_t, const char *); + + /* This function is called right after a command has been processed. + It may be used to command related cleanup. */ + void (*post_cmd_notify_fnc)(assuan_context_t, int); + + /* If set, this is called right before logging an I/O line. With + DIRECTION set to 1 it is called for an output oeration; 0 means + an input operation. If bit 0 is set in the return value, the + logging of the will be suppressed. With bit 1 set, the entire + line will be ignored. */ + unsigned int (*io_monitor)(assuan_context_t ctx, + int direction, + const char *line, + size_t linelen); int input_fd; /* set by INPUT command */ int output_fd; /* set by OUTPUT command */ @@ -174,29 +201,45 @@ struct assuan_context_s }; /*-- assuan-pipe-server.c --*/ -int _assuan_new_context (ASSUAN_CONTEXT *r_ctx); -void _assuan_release_context (ASSUAN_CONTEXT ctx); +int _assuan_new_context (assuan_context_t *r_ctx); +void _assuan_release_context (assuan_context_t ctx); + +/*-- assuan-uds.c --*/ +void _assuan_uds_close_fds (assuan_context_t ctx); +void _assuan_uds_deinit (assuan_context_t ctx); +void _assuan_init_uds_io (assuan_context_t ctx); -/*-- assuan-domain-connect.c --*/ -/* Make a connection to the Unix domain socket NAME and return a new - Assuan context in CTX. SERVER_PID is currently not used but may - become handy in the future. */ -assuan_error_t _assuan_domain_init (ASSUAN_CONTEXT *r_ctx, - int rendezvousfd, - pid_t peer); /*-- assuan-handler.c --*/ -int _assuan_register_std_commands (ASSUAN_CONTEXT ctx); +int _assuan_register_std_commands (assuan_context_t ctx); /*-- assuan-buffer.c --*/ -int _assuan_read_line (ASSUAN_CONTEXT ctx); +assuan_error_t _assuan_read_line (assuan_context_t ctx); int _assuan_cookie_write_data (void *cookie, const char *buffer, size_t size); int _assuan_cookie_write_flush (void *cookie); assuan_error_t _assuan_write_line (assuan_context_t ctx, const char *prefix, const char *line, size_t len); /*-- assuan-client.c --*/ -assuan_error_t _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off); +assuan_error_t _assuan_read_from_server (assuan_context_t ctx, + int *okay, int *off); + +/*-- assuan-error.c --*/ + + +/* Map error codes as used in this implementaion to the libgpg-error + codes. */ +assuan_error_t _assuan_error (int oldcode); + +/* Extrac the erro code from A. This works for both the old and the + new style error codes. This needs to be whenever an error code is + compared. */ +#define err_code(a) ((a) & 0x00ffffff) + +/* Check whether A is the erro code for EOF. We allow forold and new + style EOF error codes here. */ +#define err_is_eof(a) ((a) == (-1) || err_code (a) == 16383) + /*-- assuan-util.c --*/ @@ -210,10 +253,8 @@ void _assuan_free (void *p); #define xtryrealloc(a,b) _assuan_realloc((a),(b)) #define xfree(a) _assuan_free ((a)) -#define set_error(c,e,t) assuan_set_error ((c), ASSUAN_ ## e, (t)) - -void _assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length); -void _assuan_log_sanitized_string (const char *string); +#define set_error(c,e,t) \ + assuan_set_error ((c), _assuan_error (ASSUAN_ ## e), (t)) #ifdef HAVE_W32_SYSTEM const char *_assuan_w32_strerror (int ec); @@ -229,11 +270,18 @@ void _assuan_log_printf (const char *for __attribute__ ((format (printf,1,2))) #endif ; +void _assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length); +void _assuan_log_sanitized_string (const char *string); + /*-- assuan-io.c --*/ -ssize_t _assuan_simple_read (ASSUAN_CONTEXT ctx, void *buffer, size_t size); -ssize_t _assuan_simple_write (ASSUAN_CONTEXT ctx, const void *buffer, +pid_t _assuan_waitpid (pid_t pid, int *status, int options); + +ssize_t _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size); +ssize_t _assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size); +ssize_t _assuan_simple_sendmsg (assuan_context_t ctx, struct msghdr *msg); +ssize_t _assuan_simple_recvmsg (assuan_context_t ctx, struct msghdr *msg); /*-- assuan-socket.c --*/ int _assuan_close (int fd); @@ -251,5 +299,25 @@ FILE *_assuan_funopen(void *cookie, #define funopen(a,r,w,s,c) _assuan_funopen ((a), (r), (w), (s), (c)) #endif /*HAVE_FOPENCOOKIE*/ -#endif /*ASSUAN_DEFS_H*/ +/* Prototypes for replacement functions. */ +#ifndef HAVE_MEMRCHR +void *memrchr (const void *block, int c, size_t size); +#endif +#ifndef HAVE_STPCPY +char *stpcpy (char *dest, const char *src); +#endif +#ifndef HAVE_SETENV +#define setenv _assuan_setenv +#define unsetenv _assuan_unsetenv +#define clearenv _assuan_clearenv +int setenv (const char *name, const char *value, int replace); +#endif +#ifndef HAVE_PUTC_UNLOCKED +int putc_unlocked (int c, FILE *stream); +#endif +#define DIM(v) (sizeof(v)/sizeof((v)[0])) +#define DIMof(type,member) DIM(((type *)0)->member) + + +#endif /*ASSUAN_DEFS_H*/ diff -urpNP gpgme-1.1.2/assuan/assuan-domain-connect.c gpgme-1.1.3/assuan/assuan-domain-connect.c --- gpgme-1.1.2/assuan/assuan-domain-connect.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-domain-connect.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ -/* assuan-domain-connect.c - Assuan unix domain socket based client - * Copyright (C) 2002, 2003 Free Software Foundation, Inc. - * - * This file is part of Assuan. - * - * Assuan 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. - * - * Assuan 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 -#endif - -#include -#include -#include -#include -#include -#ifndef HAVE_W32_SYSTEM -#include -#include -#else -#include -#endif -#if HAVE_SYS_UIO_H -#include -#endif -#include -#include -#include -#include - -#include "assuan-defs.h" - -#ifndef PF_LOCAL -# ifdef PF_UNIX -# define PF_LOCAL PF_UNIX -# else -# define PF_LOCAL AF_UNIX -# endif -# ifndef AF_LOCAL -# define AF_LOCAL AF_UNIX -# endif -#endif - - -static void -do_deinit (assuan_context_t ctx) -{ - if (ctx->inbound.fd != -1) - _assuan_close (ctx->inbound.fd); - ctx->inbound.fd = -1; - ctx->outbound.fd = -1; - - if (ctx->domainbuffer) - { - assert (ctx->domainbufferallocated); - free (ctx->domainbuffer); - } - - if (ctx->pendingfds) - { - int i; - - assert (ctx->pendingfdscount > 0); - for (i = 0; i < ctx->pendingfdscount; i ++) - _assuan_close (ctx->pendingfds[i]); - - free (ctx->pendingfds); - } - - unlink (ctx->myaddr.sun_path); -} - - -/* Read from the socket server. */ -static ssize_t -domain_reader (assuan_context_t ctx, void *buf, size_t buflen) -{ - int len = ctx->domainbuffersize; - -#ifndef HAVE_W32_SYSTEM - start: - if (len == 0) - /* No data is buffered. */ - { - struct msghdr msg; - struct iovec iovec; - struct sockaddr_un sender; - struct - { - struct cmsghdr hdr; - int fd; - } - cmsg; - - memset (&msg, 0, sizeof (msg)); - - for (;;) - { - msg.msg_name = &sender; - msg.msg_namelen = sizeof (struct sockaddr_un); - msg.msg_iov = &iovec; - msg.msg_iovlen = 1; - iovec.iov_base = ctx->domainbuffer; - iovec.iov_len = ctx->domainbufferallocated; - msg.msg_control = &cmsg; - msg.msg_controllen = sizeof cmsg; - - /* Peek first: if the buffer we have is too small then it - will be truncated. */ - len = recvmsg (ctx->inbound.fd, &msg, MSG_PEEK); - if (len < 0) - { - printf ("domain_reader: %m\n"); - return -1; - } - - if (strcmp (ctx->serveraddr.sun_path, - ((struct sockaddr_un *) msg.msg_name)->sun_path) != 0) - { - /* XXX: Arg. Not from whom we expected! What do we - want to do? Should we just ignore it? Either way, - we still need to consume the message. */ - break; - } - - if (msg.msg_flags & MSG_TRUNC) - /* Enlarge the buffer and try again. */ - { - int size = ctx->domainbufferallocated; - void *tmp; - - if (size == 0) - size = 4 * 1024; - else - size *= 2; - - tmp = malloc (size); - if (! tmp) - return -1; - - free (ctx->domainbuffer); - ctx->domainbuffer = tmp; - ctx->domainbufferallocated = size; - } - else - /* We have enough space! */ - break; - } - - /* Now we have to actually consume it (remember, we only - peeked). */ - msg.msg_name = &sender; - msg.msg_namelen = sizeof (struct sockaddr_un); - msg.msg_iov = &iovec; - msg.msg_iovlen = 1; - iovec.iov_base = ctx->domainbuffer; - iovec.iov_len = ctx->domainbufferallocated; - msg.msg_control = &cmsg; - msg.msg_controllen = sizeof cmsg; - - if (strcmp (ctx->serveraddr.sun_path, - ((struct sockaddr_un *) msg.msg_name)->sun_path) != 0) - { - /* XXX: Arg. Not from whom we expected! What do we want to - do? Should we just ignore it? We shall do the latter - for the moment. */ - _assuan_log_printf ("not setup to receive messages from `%s'\n", - ((struct sockaddr_un *) msg.msg_name)->sun_path); - goto start; - } - - len = recvmsg (ctx->inbound.fd, &msg, 0); - if (len < 0) - { - _assuan_log_printf ("domain_reader: %s\n", strerror (errno)); - return -1; - } - - ctx->domainbuffersize = len; - ctx->domainbufferoffset = 0; - - if (sizeof (cmsg) == msg.msg_controllen) - /* We received a file descriptor. */ - { - void *tmp; - - tmp = realloc (ctx->pendingfds, - sizeof (int) * (ctx->pendingfdscount + 1)); - if (! tmp) - { - _assuan_log_printf ("domain_reader: %s\n", strerror (errno)); - return -1; - } - - ctx->pendingfds = tmp; - ctx->pendingfds[ctx->pendingfdscount++] - = *(int *) CMSG_DATA (&cmsg.hdr); - - _assuan_log_printf ("received file descriptor %d from peer\n", - ctx->pendingfds[ctx->pendingfdscount - 1]); - } - - if (len == 0) - goto start; - } -#else - len = recvfrom (ctx->inbound.fd, buf, buflen, 0, NULL, NULL); -#endif - - /* Return some data to the user. */ - - if (len > buflen) - /* We have more than the user requested. */ - len = buflen; - - memcpy (buf, ctx->domainbuffer + ctx->domainbufferoffset, len); - ctx->domainbuffersize -= len; - assert (ctx->domainbuffersize >= 0); - ctx->domainbufferoffset += len; - assert (ctx->domainbufferoffset <= ctx->domainbufferallocated); - - return len; -} - -/* Write to the domain server. */ -static ssize_t -domain_writer (assuan_context_t ctx, const void *buf, size_t buflen) -{ -#ifndef HAVE_W32_SYSTEM - struct msghdr msg; - struct iovec iovec; - ssize_t len; - - memset (&msg, 0, sizeof (msg)); - - msg.msg_name = &ctx->serveraddr; - msg.msg_namelen = offsetof (struct sockaddr_un, sun_path) - + strlen (ctx->serveraddr.sun_path) + 1; - - msg.msg_iovlen = 1; - msg.msg_iov = &iovec; - iovec.iov_base = (void *) buf; - iovec.iov_len = buflen; - msg.msg_control = 0; - msg.msg_controllen = 0; - - len = sendmsg (ctx->outbound.fd, &msg, 0); - if (len < 0) - _assuan_log_printf ("domain_writer: %s\n", strerror (errno)); -#else - int len; - - len = sendto (ctx->outbound.fd, buf, buflen, 0, - (struct sockaddr *)&ctx->serveraddr, - sizeof (struct sockaddr_in)); -#endif - return len; -} - -static assuan_error_t -domain_sendfd (assuan_context_t ctx, int fd) -{ -#ifndef HAVE_W32_SYSTEM - struct msghdr msg; - struct - { - struct cmsghdr hdr; - int fd; - } - cmsg; - int len; - - memset (&msg, 0, sizeof (msg)); - - msg.msg_name = &ctx->serveraddr; - msg.msg_namelen = offsetof (struct sockaddr_un, sun_path) - + strlen (ctx->serveraddr.sun_path) + 1; - - msg.msg_iovlen = 0; - msg.msg_iov = 0; - - cmsg.hdr.cmsg_level = SOL_SOCKET; - cmsg.hdr.cmsg_type = SCM_RIGHTS; - cmsg.hdr.cmsg_len = sizeof (cmsg); - - msg.msg_control = &cmsg; - msg.msg_controllen = sizeof (cmsg); - - *(int *) CMSG_DATA (&cmsg.hdr) = fd; - - len = sendmsg (ctx->outbound.fd, &msg, 0); - if (len < 0) - { - _assuan_log_printf ("domain_sendfd: %s\n", strerror (errno)); - return ASSUAN_General_Error; - } - else - return 0; -#else - return 0; -#endif -} - -static assuan_error_t -domain_receivefd (assuan_context_t ctx, int *fd) -{ -#ifndef HAVE_W32_SYSTEM - if (ctx->pendingfds == 0) - { - _assuan_log_printf ("no pending file descriptors!\n"); - return ASSUAN_General_Error; - } - - *fd = ctx->pendingfds[0]; - if (-- ctx->pendingfdscount == 0) - { - free (ctx->pendingfds); - ctx->pendingfds = 0; - } - else - /* Fix the array. */ - { - memmove (ctx->pendingfds, ctx->pendingfds + 1, - ctx->pendingfdscount * sizeof (int)); - ctx->pendingfds = realloc (ctx->pendingfds, - ctx->pendingfdscount * sizeof (int)); - } -#endif - return 0; -} - - - -/* Make a connection to the Unix domain socket NAME and return a new - Assuan context in CTX. SERVER_PID is currently not used but may - become handy in the future. */ -assuan_error_t -_assuan_domain_init (assuan_context_t *r_ctx, int rendezvousfd, pid_t peer) -{ - static struct assuan_io io = { domain_reader, domain_writer, - domain_sendfd, domain_receivefd }; - - assuan_error_t err; - assuan_context_t ctx; - int fd; - size_t len; - int tries; - - if (!r_ctx) - return ASSUAN_Invalid_Value; - *r_ctx = NULL; - - err = _assuan_new_context (&ctx); - if (err) - return err; - - /* Save it in case we need it later. */ - ctx->pid = peer; - - /* Override the default (NOP) handlers. */ - ctx->deinit_handler = do_deinit; - - /* Setup the socket. */ - - fd = _assuan_sock_new (PF_LOCAL, SOCK_DGRAM, 0); - if (fd == -1) - { - _assuan_log_printf ("can't create socket: %s\n", strerror (errno)); - _assuan_release_context (ctx); - return ASSUAN_General_Error; - } - - ctx->inbound.fd = fd; - ctx->outbound.fd = fd; - - /* And the io buffers. */ - - ctx->io = &io; - ctx->domainbuffer = 0; - ctx->domainbufferoffset = 0; - ctx->domainbuffersize = 0; - ctx->domainbufferallocated = 0; - ctx->pendingfds = 0; - ctx->pendingfdscount = 0; - - /* Get usable name and bind to it. */ - - for (tries = 0; tries < TMP_MAX; tries ++) - { - char *p; - char buf[L_tmpnam]; - - /* XXX: L_tmpnam must be shorter than sizeof (sun_path)! */ - assert (L_tmpnam < sizeof (ctx->myaddr.sun_path)); - - /* XXX: W32 tmpnam is broken */ - p = tmpnam (buf); - if (! p) - { - _assuan_log_printf ("cannot determine an appropriate temporary file " - "name. DoS in progress?\n"); - _assuan_release_context (ctx); - _assuan_close (fd); - return ASSUAN_General_Error; - } - - memset (&ctx->myaddr, 0, sizeof ctx->myaddr); - ctx->myaddr.sun_family = AF_LOCAL; - len = strlen (buf) + 1; - memcpy (ctx->myaddr.sun_path, buf, len); - len += offsetof (struct sockaddr_un, sun_path); - - err = _assuan_sock_bind (fd, (struct sockaddr *) &ctx->myaddr, len); - if (! err) - break; - } - - if (err) - { - _assuan_log_printf ("can't bind to `%s': %s\n", ctx->myaddr.sun_path, - strerror (errno)); - _assuan_release_context (ctx); - _assuan_close (fd); - return ASSUAN_Connect_Failed; - } - - /* Rendezvous with our peer. */ - { - FILE *fp; - char *p; - - fp = fdopen (rendezvousfd, "w+"); - if (! fp) - { - _assuan_log_printf ("can't open rendezvous port: %s\n", strerror (errno)); - return ASSUAN_Connect_Failed; - } - - /* Send our address. */ - fprintf (fp, "%s\n", ctx->myaddr.sun_path); - fflush (fp); - - /* And receive our peer's. */ - memset (&ctx->serveraddr, 0, sizeof ctx->serveraddr); - for (p = ctx->serveraddr.sun_path; - p < (ctx->serveraddr.sun_path - + sizeof ctx->serveraddr.sun_path - 1); - p ++) - { - *p = fgetc (fp); - if (*p == '\n') - break; - } - *p = '\0'; - fclose (fp); - - ctx->serveraddr.sun_family = AF_LOCAL; - } - - *r_ctx = ctx; - return 0; -} - -assuan_error_t -assuan_domain_connect (assuan_context_t * r_ctx, int rendezvousfd, pid_t peer) -{ - assuan_error_t aerr; - int okay, off; - - aerr = _assuan_domain_init (r_ctx, rendezvousfd, peer); - if (aerr) - return aerr; - - /* Initial handshake. */ - aerr = _assuan_read_from_server (*r_ctx, &okay, &off); - if (aerr) - _assuan_log_printf ("can't connect to server: %s\n", - assuan_strerror (aerr)); - else if (okay != 1) - { - _assuan_log_printf ("can't connect to server: `"); - _assuan_log_sanitized_string ((*r_ctx)->inbound.line); - fprintf (assuan_get_assuan_log_stream (), "'\n"); - aerr = ASSUAN_Connect_Failed; - } - - if (aerr) - assuan_disconnect (*r_ctx); - - return aerr; -} diff -urpNP gpgme-1.1.2/assuan/assuan-domain-server.c gpgme-1.1.3/assuan/assuan-domain-server.c --- gpgme-1.1.2/assuan/assuan-domain-server.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-domain-server.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* assuan-socket-server.c - Assuan socket based server - * Copyright (C) 2002 Free Software Foundation, Inc. - * - * This file is part of Assuan. - * - * Assuan 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. - * - * Assuan 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 -#endif - -#include - -#include "assuan-defs.h" - -/* Initialize a server. */ -assuan_error_t -assuan_init_domain_server (ASSUAN_CONTEXT *r_ctx, - int rendezvousfd, - pid_t peer) -{ - assuan_error_t err; - - err = _assuan_domain_init (r_ctx, rendezvousfd, peer); - if (err) - return err; - - (*r_ctx)->is_server = 1; - /* A domain server can only be used once. */ - (*r_ctx)->pipe_mode = 1; - - return 0; -} diff -urpNP gpgme-1.1.2/assuan/assuan-errors.c gpgme-1.1.3/assuan/assuan-errors.c --- gpgme-1.1.2/assuan/assuan-errors.c 2006-03-02 10:23:52.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-errors.c 2007-01-29 20:17:47.000000000 +0000 @@ -1,13 +1,113 @@ /* Generated automatically by mkerrors */ -/* Do not edit! */ +/* Do not edit! See mkerrors for copyright notice. */ #ifdef HAVE_CONFIG_H #include #endif #include +#include +#include + +#undef _ASSUAN_IN_LIBASSUAN /* undef to get all error codes. */ #include "assuan.h" +/* If true the modern gpg-error style error codes are used in the + API. */ +static unsigned int err_source; + +/* Enable gpg-error style error codes. ERRSOURCE is one of gpg-error + sources. Note, that this function is not thread-safe and should be + used right at startup. Switching back to the old style mode is not + supported. */ +void +assuan_set_assuan_err_source (int errsource) +{ + errsource &= 0xff; + err_source = errsource? errsource : 31 /*GPG_ERR_SOURCE_ANY*/; +} + + +/* Helper to map old style Assuan error codes to gpg-error codes. + This is used internally to keep an compatible ABI. */ +assuan_error_t +_assuan_error (int oldcode) +{ + unsigned int n; + + if (!err_source) + return (oldcode & 0x00ffffff); /* Make sure that the gpg-error + source part is cleared. */ + + switch (oldcode) + { + case ASSUAN_General_Error: n = 257; break; + case ASSUAN_Accept_Failed: n = 258; break; + case ASSUAN_Connect_Failed: n = 259; break; + case ASSUAN_Invalid_Response: n = 260; break; + case ASSUAN_Invalid_Value: n = 261; break; + case ASSUAN_Line_Not_Terminated: n = 262; break; + case ASSUAN_Line_Too_Long: n = 263; break; + case ASSUAN_Nested_Commands: n = 264; break; + case ASSUAN_No_Data_Callback: n = 265; break; + case ASSUAN_No_Inquire_Callback: n = 266; break; + case ASSUAN_Not_A_Server: n = 267; break; + case ASSUAN_Not_Implemented: n = 69; break; + case ASSUAN_Parameter_Conflict: n = 280; break; + case ASSUAN_Problem_Starting_Server: n = 269; break; + case ASSUAN_Server_Fault: n = 80; break; + case ASSUAN_Syntax_Error: n = 276; break; + case ASSUAN_Too_Much_Data: n = 273; break; + case ASSUAN_Unexpected_Command: n = 274; break; + case ASSUAN_Unknown_Command: n = 275; break; + case ASSUAN_Canceled: n = 277; break; + case ASSUAN_No_Secret_Key: n = 17; break; + case ASSUAN_Not_Confirmed: n = 114; break; + + case ASSUAN_Read_Error: + switch (errno) + { + case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break; + default: n = 270; /*GPG_ERR_ASS_READ_ERROR*/ break; + } + break; + + case ASSUAN_Write_Error: + switch (errno) + { + case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break; + default: n = 271; /*GPG_ERR_ASS_WRITE_ERROR*/ break; + } + break; + + case ASSUAN_Out_Of_Core: + switch (errno) + { + case 0: /* Should not happen but a user might have provided + an incomplete implemented malloc function. Give + him a chance to correct this fault but make sure + an error is indeed returned. */ + n = 16381; /*GPG_ERR_MISSING_ERRNO*/ + break; + case ENOMEM: n = (1 << 15) | 86; break; + default: + n = 16382; /*GPG_ERR_UNKNOWN_ERRNO*/ + break; + } + break; + + case -1: n = 16383 /*GPG_ERR_EOF*/; break; + + default: + n = 257; + break; + } + + return ((err_source << 24) | (n & 0x00ffffff)); + +} + + /** * assuan_strerror: * @err: Error code @@ -19,7 +119,7 @@ * Return value: String with the error description. **/ const char * -assuan_strerror (AssuanError err) +assuan_strerror (assuan_error_t err) { const char *s; static char buf[50]; @@ -91,18 +191,60 @@ assuan_strerror (AssuanError err) case ASSUAN_Invalid_Id: s="invalid id"; break; case ASSUAN_USER_ERROR_FIRST: s="user error first"; break; case ASSUAN_USER_ERROR_LAST: s="user error last"; break; + case -1: s = "EOF (-1)"; break; default: { - unsigned int source, code; + unsigned int source, code, n; source = ((err >> 24) & 0xff); code = (err & 0x00ffffff); - if (source) /* Assume this is an libgpg-error. */ - sprintf (buf, "ec=%u.%u", source, code ); + if (source) + { + /* Assume this is an libgpg-error and try to map the codes + back. */ + switch (code) + { + case 257: n = ASSUAN_General_Error ; break; + case 258: n = ASSUAN_Accept_Failed ; break; + case 259: n = ASSUAN_Connect_Failed ; break; + case 260: n = ASSUAN_Invalid_Response ; break; + case 261: n = ASSUAN_Invalid_Value ; break; + case 262: n = ASSUAN_Line_Not_Terminated ; break; + case 263: n = ASSUAN_Line_Too_Long ; break; + case 264: n = ASSUAN_Nested_Commands ; break; + case 265: n = ASSUAN_No_Data_Callback ; break; + case 266: n = ASSUAN_No_Inquire_Callback ; break; + case 267: n = ASSUAN_Not_A_Server ; break; + case 69: n = ASSUAN_Not_Implemented ; break; + case 280: n = ASSUAN_Parameter_Conflict ; break; + case 269: n = ASSUAN_Problem_Starting_Server; break; + case 270: n = ASSUAN_Read_Error ; break; + case 271: n = ASSUAN_Write_Error ; break; + case 80: n = ASSUAN_Server_Fault ; break; + case 276: n = ASSUAN_Syntax_Error ; break; + case 273: n = ASSUAN_Too_Much_Data ; break; + case 274: n = ASSUAN_Unexpected_Command ; break; + case 275: n = ASSUAN_Unknown_Command ; break; + case 277: n = ASSUAN_Canceled ; break; + case 114: n = ASSUAN_Not_Confirmed ; break; + case ((1<<15)|86): n = ASSUAN_Out_Of_Core ; break; + default: n = 0; break; + } + if (n) + s = assuan_strerror (n); + else + { + sprintf (buf, "ec=%u.%u", source, code ); + s=buf; + } + } else - sprintf (buf, "ec=%d", err ); - s=buf; break; + { + sprintf (buf, "ec=%d", err ); + s=buf; + } } + break; } return s; diff -urpNP gpgme-1.1.2/assuan/assuan-handler.c gpgme-1.1.3/assuan/assuan-handler.c --- gpgme-1.1.2/assuan/assuan-handler.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-handler.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -36,20 +37,20 @@ static int my_strcasecmp (const char *a, static int -dummy_handler (ASSUAN_CONTEXT ctx, char *line) +dummy_handler (assuan_context_t ctx, char *line) { return set_error (ctx, Server_Fault, "no handler registered"); } static int -std_handler_nop (ASSUAN_CONTEXT ctx, char *line) +std_handler_nop (assuan_context_t ctx, char *line) { return 0; /* okay */ } static int -std_handler_cancel (ASSUAN_CONTEXT ctx, char *line) +std_handler_cancel (assuan_context_t ctx, char *line) { if (ctx->cancel_notify_fnc) ctx->cancel_notify_fnc (ctx); @@ -57,7 +58,7 @@ std_handler_cancel (ASSUAN_CONTEXT ctx, } static int -std_handler_option (ASSUAN_CONTEXT ctx, char *line) +std_handler_option (assuan_context_t ctx, char *line) { char *key, *value, *p; @@ -104,7 +105,7 @@ std_handler_option (ASSUAN_CONTEXT ctx, } static int -std_handler_bye (ASSUAN_CONTEXT ctx, char *line) +std_handler_bye (assuan_context_t ctx, char *line) { if (ctx->bye_notify_fnc) ctx->bye_notify_fnc (ctx); @@ -114,33 +115,35 @@ std_handler_bye (ASSUAN_CONTEXT ctx, cha } static int -std_handler_auth (ASSUAN_CONTEXT ctx, char *line) +std_handler_auth (assuan_context_t ctx, char *line) { return set_error (ctx, Not_Implemented, NULL); } static int -std_handler_reset (ASSUAN_CONTEXT ctx, char *line) +std_handler_reset (assuan_context_t ctx, char *line) { if (ctx->reset_notify_fnc) ctx->reset_notify_fnc (ctx); assuan_close_input_fd (ctx); assuan_close_output_fd (ctx); + _assuan_uds_close_fds (ctx); return 0; } static int -std_handler_end (ASSUAN_CONTEXT ctx, char *line) +std_handler_end (assuan_context_t ctx, char *line) { return set_error (ctx, Not_Implemented, NULL); } assuan_error_t -assuan_command_parse_fd (ASSUAN_CONTEXT ctx, char *line, int *rfd) +assuan_command_parse_fd (assuan_context_t ctx, char *line, int *rfd) { char *endp; - if (strncmp (line, "FD", 2) != 0 || (line[2] != '=' && line[2] != '\0')) + if ( (strncmp (line, "FD", 2) && strncmp (line, "fd", 2)) + || (line[2] != '=' && line[2] != '\0')) return set_error (ctx, Syntax_Error, "FD[=] expected"); line += 2; if (*line == '=') @@ -149,7 +152,7 @@ assuan_command_parse_fd (ASSUAN_CONTEXT if (!digitp (*line)) return set_error (ctx, Syntax_Error, "number required"); *rfd = strtoul (line, &endp, 10); - /* remove that argument so that a notify handler won't see it */ + /* Remove that argument so that a notify handler won't see it. */ memset (line, ' ', endp? (endp-line):strlen(line)); if (*rfd == ctx->inbound.fd) @@ -165,7 +168,7 @@ assuan_command_parse_fd (ASSUAN_CONTEXT /* Format is INPUT FD= */ static int -std_handler_input (ASSUAN_CONTEXT ctx, char *line) +std_handler_input (assuan_context_t ctx, char *line) { int rc, fd; @@ -180,7 +183,7 @@ std_handler_input (ASSUAN_CONTEXT ctx, c /* Format is OUTPUT FD= */ static int -std_handler_output (ASSUAN_CONTEXT ctx, char *line) +std_handler_output (assuan_context_t ctx, char *line) { int rc, fd; @@ -202,7 +205,7 @@ std_handler_output (ASSUAN_CONTEXT ctx, with default handlers */ static struct { const char *name; - int (*handler)(ASSUAN_CONTEXT, char *line); + int (*handler)(assuan_context_t, char *line); int always; /* always initialize this command */ } std_cmd_table[] = { { "NOP", std_handler_nop, 1 }, @@ -234,9 +237,9 @@ static struct { * Return value: 0 on success or an error code **/ int -assuan_register_command (ASSUAN_CONTEXT ctx, +assuan_register_command (assuan_context_t ctx, const char *cmd_name, - int (*handler)(ASSUAN_CONTEXT, char *)) + int (*handler)(assuan_context_t, char *)) { int i; const char *s; @@ -245,7 +248,7 @@ assuan_register_command (ASSUAN_CONTEXT cmd_name = NULL; if (!cmd_name) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!handler) { /* find a default handler. */ @@ -268,7 +271,7 @@ assuan_register_command (ASSUAN_CONTEXT ctx->cmdtbl_size = 50; ctx->cmdtbl = xtrycalloc ( ctx->cmdtbl_size, sizeof *ctx->cmdtbl); if (!ctx->cmdtbl) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); ctx->cmdtbl_used = 0; } else if (ctx->cmdtbl_used >= ctx->cmdtbl_size) @@ -277,7 +280,7 @@ assuan_register_command (ASSUAN_CONTEXT x = xtryrealloc ( ctx->cmdtbl, (ctx->cmdtbl_size+10) * sizeof *x); if (!x) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); ctx->cmdtbl = x; ctx->cmdtbl_size += 50; } @@ -289,59 +292,72 @@ assuan_register_command (ASSUAN_CONTEXT } int -assuan_register_bye_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT)) +assuan_register_post_cmd_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, int)) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); + ctx->post_cmd_notify_fnc = fnc; + return 0; +} + +int +assuan_register_bye_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t)) +{ + if (!ctx) + return _assuan_error (ASSUAN_Invalid_Value); ctx->bye_notify_fnc = fnc; return 0; } int -assuan_register_reset_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT)) +assuan_register_reset_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t)) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); ctx->reset_notify_fnc = fnc; return 0; } int -assuan_register_cancel_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT)) +assuan_register_cancel_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t)) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); ctx->cancel_notify_fnc = fnc; return 0; } int -assuan_register_option_handler (ASSUAN_CONTEXT ctx, - int (*fnc)(ASSUAN_CONTEXT, +assuan_register_option_handler (assuan_context_t ctx, + int (*fnc)(assuan_context_t, const char*, const char*)) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); ctx->option_handler_fnc = fnc; return 0; } int -assuan_register_input_notify (ASSUAN_CONTEXT ctx, - void (*fnc)(ASSUAN_CONTEXT, const char *)) +assuan_register_input_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, const char *)) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); ctx->input_notify_fnc = fnc; return 0; } int -assuan_register_output_notify (ASSUAN_CONTEXT ctx, - void (*fnc)(ASSUAN_CONTEXT, const char *)) +assuan_register_output_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, const char *)) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); ctx->output_notify_fnc = fnc; return 0; } @@ -349,7 +365,7 @@ assuan_register_output_notify (ASSUAN_CO /* Helper to register the standards commands */ int -_assuan_register_std_commands (ASSUAN_CONTEXT ctx) +_assuan_register_std_commands (assuan_context_t ctx) { int i, rc; @@ -370,7 +386,7 @@ _assuan_register_std_commands (ASSUAN_CO /* Process the special data lines. The "D " has already been removed from the line. As all handlers this function may modify the line. */ static int -handle_data_line (ASSUAN_CONTEXT ctx, char *line, int linelen) +handle_data_line (assuan_context_t ctx, char *line, int linelen) { return set_error (ctx, Not_Implemented, NULL); } @@ -394,7 +410,7 @@ my_strcasecmp (const char *a, const char table, remove leading and white spaces from the arguments, call the handler with the argument line and return the error */ static int -dispatch_command (ASSUAN_CONTEXT ctx, char *line, int linelen) +dispatch_command (assuan_context_t ctx, char *line, int linelen) { char *p; const char *s; @@ -406,7 +422,7 @@ dispatch_command (ASSUAN_CONTEXT ctx, ch for (p=line; *p && *p != ' ' && *p != '\t'; p++) ; if (p==line) - return set_error (ctx, Invalid_Command, "leading white-space"); + return set_error (ctx, Syntax_Error, "leading white-space"); if (*p) { /* Skip over leading WS after the keyword */ *p++ = 0; @@ -441,12 +457,12 @@ dispatch_command (ASSUAN_CONTEXT ctx, ch static int -process_request (ASSUAN_CONTEXT ctx) +process_request (assuan_context_t ctx) { int rc; if (ctx->in_inquire) - return ASSUAN_Nested_Commands; + return _assuan_error (ASSUAN_Nested_Commands); rc = _assuan_read_line (ctx); if (rc) @@ -477,8 +493,8 @@ process_request (ASSUAN_CONTEXT ctx) { rc = assuan_write_line (ctx, ctx->okay_line? ctx->okay_line : "OK"); } - else if (rc == -1) - { /* No error checking because the peer may have already disconnect */ + else if (err_is_eof (rc)) + { /* No error checking because the peer may have already disconnect. */ assuan_write_line (ctx, "OK closing connection"); ctx->finish_handler (ctx); } @@ -488,7 +504,7 @@ process_request (ASSUAN_CONTEXT ctx) if (rc < 100) sprintf (errline, "ERR %d server fault (%.50s)", - ASSUAN_Server_Fault, assuan_strerror (rc)); + _assuan_error (ASSUAN_Server_Fault), assuan_strerror (rc)); else { const char *text = ctx->err_no == rc? ctx->err_str:NULL; @@ -498,16 +514,22 @@ process_request (ASSUAN_CONTEXT ctx) strings from libgpg-error without creating a dependency. They are used for debugging purposes only, so there is no problem if they are not available. We need to make sure - that we are using elf because only this guarantees that + that we are using ELF because only this guarantees that weak symbol support is available in case GNU ld is not - used. */ + used. It seems that old gcc versions don't implement the + weak attribute properly but it works with the weak + pragma. */ + unsigned int source, code; int gpg_strerror_r (unsigned int err, char *buf, size_t buflen) __attribute__ ((weak)); - const char *gpg_strsource (unsigned int err) __attribute__ ((weak)); +#if !defined(HAVE_W32_SYSTEM) && __GNUC__ < 3 +#pragma weak gpg_strerror_r +#pragma weak gpg_strsource +#endif source = ((rc >> 24) & 0xff); code = (rc & 0x00ffffff); @@ -531,6 +553,9 @@ process_request (ASSUAN_CONTEXT ctx) rc = assuan_write_line (ctx, errline); } + if (ctx->post_cmd_notify_fnc) + ctx->post_cmd_notify_fnc (ctx, rc); + ctx->confidential = 0; if (ctx->okay_line) { @@ -552,7 +577,7 @@ process_request (ASSUAN_CONTEXT ctx) * failed. Note, that no error is returned for operational errors. **/ int -assuan_process (ASSUAN_CONTEXT ctx) +assuan_process (assuan_context_t ctx) { int rc; @@ -560,7 +585,7 @@ assuan_process (ASSUAN_CONTEXT ctx) rc = process_request (ctx); } while (!rc); - if (rc == -1) + if (err_is_eof (rc)) rc = 0; return rc; @@ -579,7 +604,7 @@ assuan_process (ASSUAN_CONTEXT ctx) * Return value: -1 for end of server, 0 on success or an error code **/ int -assuan_process_next (ASSUAN_CONTEXT ctx) +assuan_process_next (assuan_context_t ctx) { return process_request (ctx); } @@ -603,7 +628,7 @@ assuan_process_next (ASSUAN_CONTEXT ctx) * error which is most likely a too small fdarray. **/ int -assuan_get_active_fds (ASSUAN_CONTEXT ctx, int what, +assuan_get_active_fds (assuan_context_t ctx, int what, int *fdarray, int fdarraysize) { int n = 0; @@ -627,6 +652,23 @@ assuan_get_active_fds (ASSUAN_CONTEXT ct return n; } + +/* Two simple wrappers to make the expected function types match. */ +#ifdef HAVE_FUNOPEN +static int +fun1_cookie_write (void *cookie, const char *buffer, int orig_size) +{ + return _assuan_cookie_write_data (cookie, buffer, orig_size); +} +#endif /*HAVE_FUNOPEN*/ +#ifdef HAVE_FOPENCOOKIE +static ssize_t +fun2_cookie_write (void *cookie, const char *buffer, size_t orig_size) +{ + return _assuan_cookie_write_data (cookie, buffer, orig_size); +} +#endif /*HAVE_FOPENCOOKIE*/ + /* Return a FP to be used for data output. The FILE pointer is valid until the end of a handler. So a close is not needed. Assuan does all the buffering needed to insert the status line as well as the @@ -636,16 +678,20 @@ assuan_get_active_fds (ASSUAN_CONTEXT ct implementaion for systems w/o a glibc, a simple implementation could use a child process */ FILE * -assuan_get_data_fp (ASSUAN_CONTEXT ctx) +assuan_get_data_fp (assuan_context_t ctx) { #if defined (HAVE_FOPENCOOKIE) || defined (HAVE_FUNOPEN) if (ctx->outbound.data.fp) return ctx->outbound.data.fp; - - ctx->outbound.data.fp = funopen (ctx, 0, - _assuan_cookie_write_data, +#ifdef HAVE_FUNOPEN + ctx->outbound.data.fp = funopen (ctx, 0, fun1_cookie_write, 0, _assuan_cookie_write_flush); +#else + ctx->outbound.data.fp = funopen (ctx, 0, fun2_cookie_write, + 0, _assuan_cookie_write_flush); +#endif + ctx->outbound.data.error = 0; return ctx->outbound.data.fp; #else @@ -658,10 +704,10 @@ assuan_get_data_fp (ASSUAN_CONTEXT ctx) /* Set the text used for the next OK reponse. This string is automatically reset to NULL after the next command. */ assuan_error_t -assuan_set_okay_line (ASSUAN_CONTEXT ctx, const char *line) +assuan_set_okay_line (assuan_context_t ctx, const char *line) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!line) { xfree (ctx->okay_line); @@ -673,7 +719,7 @@ assuan_set_okay_line (ASSUAN_CONTEXT ctx we should allocate the entire line in secure memory */ char *buf = xtrymalloc (3+strlen(line)+1); if (!buf) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); strcpy (buf, "OK "); strcpy (buf+3, line); xfree (ctx->okay_line); @@ -685,7 +731,8 @@ assuan_set_okay_line (ASSUAN_CONTEXT ctx assuan_error_t -assuan_write_status (ASSUAN_CONTEXT ctx, const char *keyword, const char *text) +assuan_write_status (assuan_context_t ctx, + const char *keyword, const char *text) { char buffer[256]; char *helpbuf; @@ -693,7 +740,7 @@ assuan_write_status (ASSUAN_CONTEXT ctx, assuan_error_t ae; if ( !ctx || !keyword) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!text) text = ""; diff -urpNP gpgme-1.1.2/assuan/assuan-inquire.c gpgme-1.1.3/assuan/assuan-inquire.c --- gpgme-1.1.2/assuan/assuan-inquire.c 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-inquire.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -146,14 +147,14 @@ assuan_inquire (assuan_context_t ctx, co int nodataexpected; if (!ctx || !keyword || (10 + strlen (keyword) >= sizeof (cmdbuf))) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); nodataexpected = !r_buffer && !r_length && !maxlen; if (!nodataexpected && (!r_buffer || !r_length)) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!ctx->is_server) - return ASSUAN_Not_A_Server; + return _assuan_error (ASSUAN_Not_A_Server); if (ctx->in_inquire) - return ASSUAN_Nested_Commands; + return _assuan_error (ASSUAN_Nested_Commands); ctx->in_inquire = 1; if (nodataexpected) @@ -182,12 +183,12 @@ assuan_inquire (assuan_context_t ctx, co break; /* END command received*/ if (line[0] == 'C' && line[1] == 'A' && line[2] == 'N') { - rc = ASSUAN_Canceled; + rc = _assuan_error (ASSUAN_Canceled); goto leave; } if (line[0] != 'D' || line[1] != ' ' || nodataexpected) { - rc = ASSUAN_Unexpected_Command; + rc = _assuan_error (ASSUAN_Unexpected_Command); goto leave; } if (linelen < 3) @@ -214,7 +215,7 @@ assuan_inquire (assuan_context_t ctx, co } if (mb.too_large) { - rc = ASSUAN_Too_Much_Data; + rc = _assuan_error (ASSUAN_Too_Much_Data); goto leave; } } @@ -223,7 +224,7 @@ assuan_inquire (assuan_context_t ctx, co { *r_buffer = get_membuf (&mb, r_length); if (!*r_buffer) - rc = ASSUAN_Out_Of_Core; + rc = _assuan_error (ASSUAN_Out_Of_Core); } leave: diff -urpNP gpgme-1.1.2/assuan/assuan-io.c gpgme-1.1.3/assuan/assuan-io.c --- gpgme-1.1.2/assuan/assuan-io.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-io.c 2007-01-29 20:16:18.000000000 +0000 @@ -1,5 +1,5 @@ /* assuan-io.c - Wraps the read and write functions. - * Copyright (C) 2002, 2004 Free Software Foundation, Inc. + * Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. * * This file is part of Assuan. * @@ -15,56 +15,73 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifdef HAVE_CONFIG_H #include #endif -#include "assuan-defs.h" +#include #include +#include #include +#include #ifdef HAVE_W32_SYSTEM -#include +# include +#else +# include #endif -#ifndef _ASSUAN_NO_PTH -extern ssize_t pth_read (int fd, void *buffer, size_t size); -extern ssize_t pth_write (int fd, const void *buffer, size_t size); +#include "assuan-defs.h" + #ifndef HAVE_W32_SYSTEM -#pragma weak pth_read -#pragma weak pth_write +pid_t +_assuan_waitpid (pid_t pid, int *status, int options) +{ + return waitpid (pid, status, options); +} #endif -#endif /*!_ASSUAN_NO_PTH*/ + ssize_t _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size) { -#ifdef _ASSUAN_NO_PTH return read (ctx->inbound.fd, buffer, size); -#else -# ifndef HAVE_W32_SYSTEM - return (pth_read ? pth_read : read) (ctx->inbound.fd, buffer, size); -# else - return pth_read ? pth_read (ctx->inbound.fd, buffer, size) - : recv (ctx->inbound.fd, buffer, size, 0); -# endif -# endif } ssize_t _assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size) { -#ifdef _ASSUAN_NO_PTH return write (ctx->outbound.fd, buffer, size); +} + + +ssize_t +_assuan_simple_sendmsg (assuan_context_t ctx, struct msghdr *msg) +{ +#ifdef HAVE_W32_SYSTEM + return _assuan_error (ASSUAN_Not_Implemented); +#else + int ret; + while ( (ret = sendmsg (ctx->outbound.fd, msg, 0)) == -1 && errno == EINTR) + ; + return ret; +#endif +} + + +ssize_t +_assuan_simple_recvmsg (assuan_context_t ctx, struct msghdr *msg) +{ +#ifdef HAVE_W32_SYSTEM + return _assuan_error (ASSUAN_Not_Implemented); #else -# ifndef HAVE_W32_SYSTEM - return (pth_write ? pth_write : write) (ctx->outbound.fd, buffer, size); -# else - return pth_write ? pth_write (ctx->outbound.fd, buffer, size) - : send (ctx->outbound.fd, buffer, size, 0); -# endif + int ret; + while ( (ret = recvmsg (ctx->inbound.fd, msg, 0)) == -1 && errno == EINTR) + ; + return ret; #endif } diff -urpNP gpgme-1.1.2/assuan/assuan-listen.c gpgme-1.1.3/assuan/assuan-listen.c --- gpgme-1.1.2/assuan/assuan-listen.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-listen.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -23,6 +24,7 @@ #include #include #include +#include #include "assuan-defs.h" @@ -30,7 +32,7 @@ assuan_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line) { if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (!line) { xfree (ctx->hello_line); @@ -40,7 +42,7 @@ assuan_set_hello_line (assuan_context_t { char *buf = xtrymalloc (3+strlen(line)+1); if (!buf) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); if (strchr (line, '\n')) strcpy (buf, line); else @@ -73,7 +75,7 @@ assuan_accept (assuan_context_t ctx) const char *p, *pend; if (!ctx) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (ctx->pipe_mode > 1) return -1; /* second invocation for pipemode -> terminate */ @@ -134,7 +136,7 @@ assuan_error_t assuan_close_input_fd (assuan_context_t ctx) { if (!ctx || ctx->input_fd == -1) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); _assuan_close (ctx->input_fd); ctx->input_fd = -1; return 0; @@ -146,7 +148,7 @@ assuan_error_t assuan_close_output_fd (assuan_context_t ctx) { if (!ctx || ctx->output_fd == -1) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); _assuan_close (ctx->output_fd); ctx->output_fd = -1; diff -urpNP gpgme-1.1.2/assuan/assuan-logging.c gpgme-1.1.3/assuan/assuan-logging.c --- gpgme-1.1.2/assuan/assuan-logging.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-logging.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,29 +15,37 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifdef HAVE_CONFIG_H #include #endif #include +#include #include #include #ifdef HAVE_W32_SYSTEM #include #endif /*HAVE_W32_SYSTEM*/ +#include +#include #include "assuan-defs.h" static char prefix_buffer[80]; static FILE *_assuan_log; +static int full_logging; void _assuan_set_default_log_stream (FILE *fp) { if (!_assuan_log) - _assuan_log = fp; + { + _assuan_log = fp; + full_logging = !!getenv ("ASSUAN_FULL_LOGGING"); + } } void @@ -46,6 +54,22 @@ assuan_set_assuan_log_stream (FILE *fp) _assuan_log = fp; } + +/* Set the per context log stream. Also enable the default log stream + if it has not been set. */ +void +assuan_set_log_stream (assuan_context_t ctx, FILE *fp) +{ + if (ctx) + { + if (ctx->log_fp) + fflush (ctx->log_fp); + ctx->log_fp = fp; + _assuan_set_default_log_stream (fp); + } +} + + FILE * assuan_get_assuan_log_stream (void) { @@ -80,18 +104,123 @@ _assuan_log_printf (const char *format, va_list arg_ptr; FILE *fp; const char *prf; - + int save_errno = errno; + fp = assuan_get_assuan_log_stream (); prf = assuan_get_assuan_log_prefix (); if (*prf) - { - fputs (prf, fp); - fputs (": ", fp); - } + fprintf (fp, "%s[%u]: ", prf, (unsigned int)getpid ()); va_start (arg_ptr, format); vfprintf (fp, format, arg_ptr ); va_end (arg_ptr); + errno = save_errno; +} + + +/* Dump a possibly binary string (used for debugging). Distinguish + ascii text from binary and print it accordingly. This function + takes FILE pointer arg becuase logging may be enabled on a per + context basis. */ +void +_assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length) +{ + const unsigned char *s; + int n; + + for (n=length,s=buffer; n; n--, s++) + if ((!isascii (*s) || iscntrl (*s) || !isprint (*s)) && !(*s >= 0x80)) + break; + + s = buffer; + if (!n && *s != '[') + fwrite (buffer, length, 1, fp); + else + { +#ifdef HAVE_FLOCKFILE + flockfile (fp); +#endif + putc_unlocked ('[', fp); + if ( length > 16 && !full_logging) + { + for (n=0; n < 12; n++, s++) + fprintf (fp, " %02x", *s); + fprintf (fp, " ...(%d bytes skipped)", (int)length - 12); + } + else + { + for (n=0; n < length; n++, s++) + fprintf (fp, " %02x", *s); + } + putc_unlocked (' ', fp); + putc_unlocked (']', fp); +#ifdef HAVE_FUNLOCKFILE + funlockfile (fp); +#endif + } +} + +/* Log a user supplied string. Escapes non-printable before + printing. */ +void +_assuan_log_sanitized_string (const char *string) +{ + const unsigned char *s = (const unsigned char *) string; + FILE *fp = assuan_get_assuan_log_stream (); + + if (! *s) + return; + +#ifdef HAVE_FLOCKFILE + flockfile (fp); +#endif + + for (; *s; s++) + { + int c = 0; + + switch (*s) + { + case '\r': + c = 'r'; + break; + + case '\n': + c = 'n'; + break; + + case '\f': + c = 'f'; + break; + + case '\v': + c = 'v'; + break; + + case '\b': + c = 'b'; + break; + + default: + if ((isascii (*s) && isprint (*s)) || (*s >= 0x80)) + putc_unlocked (*s, fp); + else + { + putc_unlocked ('\\', fp); + fprintf (fp, "x%02x", *s); + } + } + + if (c) + { + putc_unlocked ('\\', fp); + putc_unlocked (c, fp); + } + } + +#ifdef HAVE_FUNLOCKFILE + funlockfile (fp); +#endif } diff -urpNP gpgme-1.1.2/assuan/assuan-pipe-connect.c gpgme-1.1.3/assuan/assuan-pipe-connect.c --- gpgme-1.1.2/assuan/assuan-pipe-connect.c 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-pipe-connect.c 2007-01-29 20:16:19.000000000 +0000 @@ -1,5 +1,5 @@ /* assuan-pipe-connect.c - Establish a pipe connection (client) - * Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. * * This file is part of Assuan. * @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifdef HAVE_CONFIG_H @@ -38,6 +39,19 @@ #include "assuan-defs.h" +/* Hacks for Slowaris. */ +#ifndef PF_LOCAL +# ifdef PF_UNIX +# define PF_LOCAL PF_UNIX +# else +# define PF_LOCAL AF_UNIX +# endif +#endif +#ifndef AF_LOCAL +# define AF_LOCAL AF_UNIX +#endif + + #ifdef _POSIX_OPEN_MAX #define MAX_OPEN_FDS _POSIX_OPEN_MAX #else @@ -111,6 +125,8 @@ do_finish (assuan_context_t ctx) if (ctx->inbound.fd != -1) { _assuan_close (ctx->inbound.fd); + if (ctx->inbound.fd == ctx->outbound.fd) + ctx->outbound.fd = -1; ctx->inbound.fd = -1; } if (ctx->outbound.fd != -1) @@ -123,7 +139,7 @@ do_finish (assuan_context_t ctx) #ifndef HAVE_W32_SYSTEM #ifndef _ASSUAN_USE_DOUBLE_FORK if (!ctx->flags.no_waitpid) - waitpid (ctx->pid, NULL, 0); + _assuan_waitpid (ctx->pid, NULL, 0); ctx->pid = -1; #endif #endif /*!HAVE_W32_SYSTEM*/ @@ -138,6 +154,402 @@ do_deinit (assuan_context_t ctx) } +/* Helper for pipe_connect. */ +static assuan_error_t +initial_handshake (assuan_context_t *ctx) +{ + int okay, off; + assuan_error_t err; + + err = _assuan_read_from_server (*ctx, &okay, &off); + if (err) + _assuan_log_printf ("can't connect server: %s\n", + assuan_strerror (err)); + else if (okay != 1) + { + _assuan_log_printf ("can't connect server: `%s'\n", + (*ctx)->inbound.line); + err = _assuan_error (ASSUAN_Connect_Failed); + } + + if (err) + { + assuan_disconnect (*ctx); + *ctx = NULL; + } + return err; +} + + +#ifndef HAVE_W32_SYSTEM +#define pipe_connect pipe_connect_unix +/* Unix version of the pipe connection code. We use an extra macro to + make ChangeLog entries easier. */ +static assuan_error_t +pipe_connect_unix (assuan_context_t *ctx, + const char *name, const char *const argv[], + int *fd_child_list, + void (*atfork) (void *opaque, int reserved), + void *atforkvalue) +{ + assuan_error_t err; + int rp[2]; + int wp[2]; + char mypidstr[50]; + + if (!ctx || !name || !argv || !argv[0]) + return _assuan_error (ASSUAN_Invalid_Value); + + fix_signals (); + + sprintf (mypidstr, "%lu", (unsigned long)getpid ()); + + if (pipe (rp) < 0) + return _assuan_error (ASSUAN_General_Error); + + if (pipe (wp) < 0) + { + close (rp[0]); + close (rp[1]); + return _assuan_error (ASSUAN_General_Error); + } + + err = _assuan_new_context (ctx); + if (err) + { + close (rp[0]); + close (rp[1]); + close (wp[0]); + close (wp[1]); + return err; + } + (*ctx)->pipe_mode = 1; + (*ctx)->inbound.fd = rp[0]; /* Our inbound is read end of read pipe. */ + (*ctx)->outbound.fd = wp[1]; /* Our outbound is write end of write pipe. */ + (*ctx)->deinit_handler = do_deinit; + (*ctx)->finish_handler = do_finish; + + /* FIXME: For GPGME we should better use _gpgme_io_spawn. The PID + stored here is actually soon useless. */ + (*ctx)->pid = fork (); + if ((*ctx)->pid < 0) + { + close (rp[0]); + close (rp[1]); + close (wp[0]); + close (wp[1]); + _assuan_release_context (*ctx); + return _assuan_error (ASSUAN_General_Error); + } + + if ((*ctx)->pid == 0) + { +#ifdef _ASSUAN_USE_DOUBLE_FORK + pid_t pid; + + if ((pid = fork ()) == 0) +#endif + { + int i, n; + char errbuf[512]; + int *fdp; + + if (atfork) + atfork (atforkvalue, 0); + + /* Dup handles to stdin/stdout. */ + if (rp[1] != STDOUT_FILENO) + { + if (dup2 (rp[1], STDOUT_FILENO) == -1) + { + _assuan_log_printf ("dup2 failed in child: %s\n", + strerror (errno)); + _exit (4); + } + } + if (wp[0] != STDIN_FILENO) + { + if (dup2 (wp[0], STDIN_FILENO) == -1) + { + _assuan_log_printf ("dup2 failed in child: %s\n", + strerror (errno)); + _exit (4); + } + } + + /* Dup stderr to /dev/null unless it is in the list of FDs to be + passed to the child. */ + fdp = fd_child_list; + if (fdp) + { + for (; *fdp != -1 && *fdp != STDERR_FILENO; fdp++) + ; + } + if (!fdp || *fdp == -1) + { + int fd = open ("/dev/null", O_WRONLY); + if (fd == -1) + { + _assuan_log_printf ("can't open `/dev/null': %s\n", + strerror (errno)); + _exit (4); + } + if (dup2 (fd, STDERR_FILENO) == -1) + { + _assuan_log_printf ("dup2(dev/null, 2) failed: %s\n", + strerror (errno)); + _exit (4); + } + } + + + /* Close all files which will not be duped and are not in the + fd_child_list. */ + n = sysconf (_SC_OPEN_MAX); + if (n < 0) + n = MAX_OPEN_FDS; + for (i=0; i < n; i++) + { + if ( i == STDIN_FILENO || i == STDOUT_FILENO + || i == STDERR_FILENO) + continue; + fdp = fd_child_list; + if (fdp) + { + while (*fdp != -1 && *fdp != i) + fdp++; + } + + if (!(fdp && *fdp != -1)) + close(i); + } + errno = 0; + + /* We store our parents pid in the environment so that the + execed assuan server is able to read the actual pid of the + client. The server can't use getppid because it might have + been double forked before the assuan server has been + initialized. */ + setenv ("_assuan_pipe_connect_pid", mypidstr, 1); + + /* Make sure that we never pass a connection fd variable + when using a simple pipe. */ + unsetenv ("_assuan_connection_fd"); + + execv (name, (char *const *) argv); + /* oops - use the pipe to tell the parent about it */ + snprintf (errbuf, sizeof(errbuf)-1, + "ERR %d can't exec `%s': %.50s\n", + _assuan_error (ASSUAN_Problem_Starting_Server), + name, strerror (errno)); + errbuf[sizeof(errbuf)-1] = 0; + writen (1, errbuf, strlen (errbuf)); + _exit (4); + } +#ifdef _ASSUAN_USE_DOUBLE_FORK + if (pid == -1) + _exit (1); + else + _exit (0); +#endif + } + +#ifdef _ASSUAN_USE_DOUBLE_FORK + _assuan_waitpid ((*ctx)->pid, NULL, 0); + (*ctx)->pid = -1; +#endif + + close (rp[1]); + close (wp[0]); + + return initial_handshake (ctx); +} +#endif /*!HAVE_W32_SYSTEM*/ + + +#ifndef HAVE_W32_SYSTEM +/* This function is similar to pipe_connect but uses a socketpair and + sets the I/O up to use sendmsg/recvmsg. */ +static assuan_error_t +socketpair_connect (assuan_context_t *ctx, + const char *name, const char *const argv[], + int *fd_child_list, + void (*atfork) (void *opaque, int reserved), + void *atforkvalue) +{ + assuan_error_t err; + int fds[2]; + char mypidstr[50]; + + if (!ctx + || (name && (!argv || !argv[0])) + || (!name && argv)) + return _assuan_error (ASSUAN_Invalid_Value); + + fix_signals (); + + sprintf (mypidstr, "%lu", (unsigned long)getpid ()); + + if ( socketpair (AF_LOCAL, SOCK_STREAM, 0, fds) ) + { + _assuan_log_printf ("socketpair failed: %s\n", strerror (errno)); + return _assuan_error (ASSUAN_General_Error); + } + + err = _assuan_new_context (ctx); + if (err) + { + close (fds[0]); + close (fds[1]); + return err; + } + (*ctx)->pipe_mode = 1; + (*ctx)->inbound.fd = fds[0]; + (*ctx)->outbound.fd = fds[0]; + _assuan_init_uds_io (*ctx); + (*ctx)->deinit_handler = _assuan_uds_deinit; + (*ctx)->finish_handler = do_finish; + + (*ctx)->pid = fork (); + if ((*ctx)->pid < 0) + { + close (fds[0]); + close (fds[1]); + _assuan_release_context (*ctx); + *ctx = NULL; + return _assuan_error (ASSUAN_General_Error); + } + + if ((*ctx)->pid == 0) + { +#ifdef _ASSUAN_USE_DOUBLE_FORK + pid_t pid; + + if ((pid = fork ()) == 0) +#endif + { + int fd, i, n; + char errbuf[512]; + int *fdp; + + if (atfork) + atfork (atforkvalue, 0); + + /* Connect stdin and stdout to /dev/null. */ + fd = open ("/dev/null", O_RDONLY); + if (fd == -1 || dup2 (fd, STDIN_FILENO) == -1) + { + _assuan_log_printf ("dup2(dev/null) failed: %s\n", + strerror (errno)); + _exit (4); + } + fd = open ("/dev/null", O_WRONLY); + if (fd == -1 || dup2 (fd, STDOUT_FILENO) == -1) + { + _assuan_log_printf ("dup2(dev/null) failed: %s\n", + strerror (errno)); + _exit (4); + } + + /* Dup stderr to /dev/null unless it is in the list of FDs to be + passed to the child. */ + fdp = fd_child_list; + if (fdp) + { + for (; *fdp != -1 && *fdp != STDERR_FILENO; fdp++) + ; + } + if (!fdp || *fdp == -1) + { + fd = open ("/dev/null", O_WRONLY); + if (fd == -1 || dup2 (fd, STDERR_FILENO) == -1) + { + _assuan_log_printf ("dup2(dev/null) failed: %s\n", + strerror (errno)); + _exit (4); + } + } + + + /* Close all files which will not be duped, are not in the + fd_child_list and are not the connection fd. */ + n = sysconf (_SC_OPEN_MAX); + if (n < 0) + n = MAX_OPEN_FDS; + for (i=0; i < n; i++) + { + if ( i == STDIN_FILENO || i == STDOUT_FILENO + || i == STDERR_FILENO || i == fds[1]) + continue; + fdp = fd_child_list; + if (fdp) + { + while (*fdp != -1 && *fdp != i) + fdp++; + } + + if (!(fdp && *fdp != -1)) + close(i); + } + errno = 0; + + /* We store our parents pid in the environment so that the + execed assuan server is able to read the actual pid of the + client. The server can't use getppid becuase it might have + been double forked before the assuan server has been + initialized. */ + setenv ("_assuan_pipe_connect_pid", mypidstr, 1); + + /* Now set the environment variable used to convey the + connection's file descriptor. */ + sprintf (mypidstr, "%d", fds[1]); + if (setenv ("_assuan_connection_fd", mypidstr, 1)) + { + _assuan_log_printf ("setenv failed: %s\n", strerror (errno)); + _exit (4); + } + + if (!name && !argv) + { + /* No name and no args given, thus we don't do an exec + but continue the forked process. */ + _assuan_release_context (*ctx); + *ctx = NULL; + return 0; + } + + execv (name, (char *const *) argv); + /* oops - use the pipe to tell the parent about it */ + snprintf (errbuf, sizeof(errbuf)-1, + "ERR %d can't exec `%s': %.50s\n", + _assuan_error (ASSUAN_Problem_Starting_Server), + name, strerror (errno)); + errbuf[sizeof(errbuf)-1] = 0; + writen (fds[1], errbuf, strlen (errbuf)); + _exit (4); + } +#ifdef _ASSUAN_USE_DOUBLE_FORK + if (pid == -1) + _exit (1); + else + _exit (0); +#endif + } + + +#ifdef _ASSUAN_USE_DOUBLE_FORK + _assuan_waitpid ((*ctx)->pid, NULL, 0); + (*ctx)->pid = -1; +#endif + + close (fds[1]); + + return initial_handshake (ctx); +} +#endif /*!HAVE_W32_SYSTEM*/ + + + #ifdef HAVE_W32_SYSTEM /* Build a command line for use with W32's CreateProcess. On success CMDLINE gets the address of a newly allocated string. */ @@ -236,21 +648,16 @@ create_inheritable_pipe (int filedes[2], #endif /*HAVE_W32_SYSTEM*/ -/* Connect to a server over a pipe, creating the assuan context and - returning it in CTX. The server filename is NAME, the argument - vector in ARGV. FD_CHILD_LIST is a -1 terminated list of file - descriptors not to close in the child. ATFORK is called in the - child right after the fork; ATFORKVALUE is passed as the first - argument and 0 is passed as the second argument. The ATFORK - function should only act if the second value is 0. */ -assuan_error_t -assuan_pipe_connect2 (assuan_context_t *ctx, - const char *name, const char *const argv[], - int *fd_child_list, - void (*atfork) (void *opaque, int reserved), - void *atforkvalue) -{ #ifdef HAVE_W32_SYSTEM +#define pipe_connect pipe_connect_w32 +/* W32 version of the pipe connection code. */ +static assuan_error_t +pipe_connect_w32 (assuan_context_t *ctx, + const char *name, const char *const argv[], + int *fd_child_list, + void (*atfork) (void *opaque, int reserved), + void *atforkvalue) +{ assuan_error_t err; int rp[2]; int wp[2]; @@ -269,7 +676,7 @@ assuan_pipe_connect2 (assuan_context_t * HANDLE nullfd = INVALID_HANDLE_VALUE; if (!ctx || !name || !argv || !argv[0]) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); fix_signals (); @@ -277,13 +684,13 @@ assuan_pipe_connect2 (assuan_context_t * /* Build the command line. */ if (build_w32_commandline (argv, &cmdline)) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); /* Create thew two pipes. */ if (create_inheritable_pipe (rp, 0)) { xfree (cmdline); - return ASSUAN_General_Error; + return _assuan_error (ASSUAN_General_Error); } if (create_inheritable_pipe (wp, 1)) @@ -291,7 +698,7 @@ assuan_pipe_connect2 (assuan_context_t * CloseHandle (fd_to_handle (rp[0])); CloseHandle (fd_to_handle (rp[1])); xfree (cmdline); - return ASSUAN_General_Error; + return _assuan_error (ASSUAN_General_Error); } @@ -303,7 +710,7 @@ assuan_pipe_connect2 (assuan_context_t * CloseHandle (fd_to_handle (wp[0])); CloseHandle (fd_to_handle (wp[1])); xfree (cmdline); - return ASSUAN_General_Error; + return _assuan_error (ASSUAN_General_Error); } (*ctx)->pipe_mode = 1; @@ -390,7 +797,7 @@ assuan_pipe_connect2 (assuan_context_t * CloseHandle (nullfd); xfree (cmdline); _assuan_release_context (*ctx); - return ASSUAN_General_Error; + return _assuan_error (ASSUAN_General_Error); } xfree (cmdline); cmdline = NULL; @@ -413,200 +820,11 @@ assuan_pipe_connect2 (assuan_context_t * (*ctx)->pid = 0; /* We don't use the PID. */ CloseHandle (pi.hProcess); /* We don't need to wait for the process. */ -#else /*!HAVE_W32_SYSTEM*/ - assuan_error_t err; - int rp[2]; - int wp[2]; - char mypidstr[50]; - - if (!ctx || !name || !argv || !argv[0]) - return ASSUAN_Invalid_Value; - - fix_signals (); - - sprintf (mypidstr, "%lu", (unsigned long)getpid ()); - - if (pipe (rp) < 0) - return ASSUAN_General_Error; - - if (pipe (wp) < 0) - { - close (rp[0]); - close (rp[1]); - return ASSUAN_General_Error; - } - - err = _assuan_new_context (ctx); - if (err) - { - close (rp[0]); - close (rp[1]); - close (wp[0]); - close (wp[1]); - return err; - } - (*ctx)->pipe_mode = 1; - (*ctx)->inbound.fd = rp[0]; /* Our inbound is read end of read pipe. */ - (*ctx)->outbound.fd = wp[1]; /* Our outbound is write end of write pipe. */ - (*ctx)->deinit_handler = do_deinit; - (*ctx)->finish_handler = do_finish; - - /* FIXME: For GPGME we should better use _gpgme_io_spawn. The PID - stored here is actually soon useless. */ - (*ctx)->pid = fork (); - if ((*ctx)->pid < 0) - { - close (rp[0]); - close (rp[1]); - close (wp[0]); - close (wp[1]); - _assuan_release_context (*ctx); - return ASSUAN_General_Error; - } - - if ((*ctx)->pid == 0) - { -#ifdef _ASSUAN_USE_DOUBLE_FORK - pid_t pid; - - if ((pid = fork ()) == 0) -#endif - { - int i, n; - char errbuf[512]; - int *fdp; - - if (atfork) - atfork (atforkvalue, 0); - - /* Dup handles to stdin/stdout. */ - if (rp[1] != STDOUT_FILENO) - { - if (dup2 (rp[1], STDOUT_FILENO) == -1) - { - _assuan_log_printf ("dup2 failed in child: %s\n", - strerror (errno)); - _exit (4); - } - } - if (wp[0] != STDIN_FILENO) - { - if (dup2 (wp[0], STDIN_FILENO) == -1) - { - _assuan_log_printf ("dup2 failed in child: %s\n", - strerror (errno)); - _exit (4); - } - } - - /* Dup stderr to /dev/null unless it is in the list of FDs to be - passed to the child. */ - fdp = fd_child_list; - if (fdp) - { - for (; *fdp != -1 && *fdp != STDERR_FILENO; fdp++) - ; - } - if (!fdp || *fdp == -1) - { - int fd = open ("/dev/null", O_WRONLY); - if (fd == -1) - { - _assuan_log_printf ("can't open `/dev/null': %s\n", - strerror (errno)); - _exit (4); - } - if (dup2 (fd, STDERR_FILENO) == -1) - { - _assuan_log_printf ("dup2(dev/null, 2) failed: %s\n", - strerror (errno)); - _exit (4); - } - } - - - /* Close all files which will not be duped and are not in the - fd_child_list. */ - n = sysconf (_SC_OPEN_MAX); - if (n < 0) - n = MAX_OPEN_FDS; - for (i=0; i < n; i++) - { - if ( i == STDIN_FILENO || i == STDOUT_FILENO - || i == STDERR_FILENO) - continue; - fdp = fd_child_list; - if (fdp) - { - while (*fdp != -1 && *fdp != i) - fdp++; - } - - if (!(fdp && *fdp != -1)) - close(i); - } - errno = 0; - - /* We store our parents pid in the environment so that the - execed assuan server is able to read the actual pid of the - client. The server can't use getppid becuase it might have - been double forked before the assuan server has been - initialized. */ - setenv ("_assuan_pipe_connect_pid", mypidstr, 1); - - execv (name, (char *const *) argv); - /* oops - use the pipe to tell the parent about it */ - snprintf (errbuf, sizeof(errbuf)-1, - "ERR %d can't exec `%s': %.50s\n", - ASSUAN_Problem_Starting_Server, name, strerror (errno)); - errbuf[sizeof(errbuf)-1] = 0; - writen (1, errbuf, strlen (errbuf)); - _exit (4); - } -#ifdef _ASSUAN_USE_DOUBLE_FORK - if (pid == -1) - _exit (1); - else - _exit (0); -#endif - } - -#ifdef _ASSUAN_USE_DOUBLE_FORK - waitpid ((*ctx)->pid, NULL, 0); - (*ctx)->pid = -1; -#endif - - close (rp[1]); - close (wp[0]); - -#endif /*!HAVE_W32_SYSTEM*/ - - /* initial handshake */ - { - int okay, off; - - err = _assuan_read_from_server (*ctx, &okay, &off); - if (err) - _assuan_log_printf ("can't connect server: %s\n", - assuan_strerror (err)); - else if (okay != 1) - { - _assuan_log_printf ("can't connect server: `%s'\n", - (*ctx)->inbound.line); - err = ASSUAN_Connect_Failed; - } - } - - if (err) - { - assuan_disconnect (*ctx); - *ctx = NULL; - } - - return err; + return initial_handshake (ctx); } +#endif /*HAVE_W32_SYSTEM*/ - + /* Connect to a server over a pipe, creating the assuan context and returning it in CTX. The server filename is NAME, the argument vector in ARGV. FD_CHILD_LIST is a -1 terminated list of file @@ -615,5 +833,57 @@ assuan_error_t assuan_pipe_connect (assuan_context_t *ctx, const char *name, const char *const argv[], int *fd_child_list) { - return assuan_pipe_connect2 (ctx, name, argv, fd_child_list, NULL, NULL); + return pipe_connect (ctx, name, argv, fd_child_list, NULL, NULL); } + + + +assuan_error_t +assuan_pipe_connect2 (assuan_context_t *ctx, + const char *name, const char *const argv[], + int *fd_child_list, + void (*atfork) (void *opaque, int reserved), + void *atforkvalue) +{ + return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue); +} + + +/* Connect to a server over a full-duplex socket (i.e. created by + socketpair), creating the assuan context and returning it in CTX. + The server filename is NAME, the argument vector in ARGV. + FD_CHILD_LIST is a -1 terminated list of file descriptors not to + close in the child. ATFORK is called in the child right after the + fork; ATFORKVALUE is passed as the first argument and 0 is passed + as the second argument. The ATFORK function should only act if the + second value is 0. + + For now FLAGS may either take the value 0 to behave like + assuan_pipe_connect2 or 1 to enable the described full-duplex + socket behaviour. + + If NAME as well as ARGV are NULL, no exec is done but the same + process is continued. However all file descriptors are closed and + some special environment variables are set. To let the caller + detect whether the child or the parent continues, the child returns + a CTX of NULL. */ +assuan_error_t +assuan_pipe_connect_ext (assuan_context_t *ctx, + const char *name, const char *const argv[], + int *fd_child_list, + void (*atfork) (void *opaque, int reserved), + void *atforkvalue, unsigned int flags) +{ + if ((flags & 1)) + { +#ifdef HAVE_W32_SYSTEM + return _assuan_error (ASSUAN_Not_Implemented); +#else + return socketpair_connect (ctx, name, argv, fd_child_list, + atfork, atforkvalue); +#endif + } + else + return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue); +} + diff -urpNP gpgme-1.1.2/assuan/assuan-pipe-server.c gpgme-1.1.3/assuan/assuan-pipe-server.c --- gpgme-1.1.2/assuan/assuan-pipe-server.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-pipe-server.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,12 +15,15 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include #include #include +#include +#include #include #ifdef HAVE_W32_SYSTEM #include @@ -31,20 +34,20 @@ static void -deinit_pipe_server (ASSUAN_CONTEXT ctx) +deinit_pipe_server (assuan_context_t ctx) { /* nothing to do for this simple server */ } static int -accept_connection (ASSUAN_CONTEXT ctx) +accept_connection (assuan_context_t ctx) { /* This is a NOP for a pipe server */ return 0; } static int -finish_connection (ASSUAN_CONTEXT ctx) +finish_connection (assuan_context_t ctx) { /* This is a NOP for a pipe server */ return 0; @@ -53,19 +56,19 @@ finish_connection (ASSUAN_CONTEXT ctx) /* Create a new context. Note that the handlers are set up for a pipe server/client - this way we don't need extra dummy functions */ int -_assuan_new_context (ASSUAN_CONTEXT *r_ctx) +_assuan_new_context (assuan_context_t *r_ctx) { static struct assuan_io io = { _assuan_simple_read, _assuan_simple_write, 0, 0 }; - ASSUAN_CONTEXT ctx; + assuan_context_t ctx; int rc; *r_ctx = NULL; ctx = xtrycalloc (1, sizeof *ctx); if (!ctx) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); ctx->input_fd = -1; ctx->output_fd = -1; @@ -88,15 +91,27 @@ _assuan_new_context (ASSUAN_CONTEXT *r_c } +/* Returns true if atoi(S) denotes a valid socket. */ +static int +is_valid_socket (const char *s) +{ + struct stat buf; + + if ( fstat (atoi (s), &buf ) ) + return 0; + return S_ISSOCK (buf.st_mode); +} + + int -assuan_init_pipe_server (ASSUAN_CONTEXT *r_ctx, int filedes[2]) +assuan_init_pipe_server (assuan_context_t *r_ctx, int filedes[2]) { int rc; rc = _assuan_new_context (r_ctx); if (!rc) { - ASSUAN_CONTEXT ctx = *r_ctx; + assuan_context_t ctx = *r_ctx; const char *s; unsigned long ul; @@ -110,8 +125,28 @@ assuan_init_pipe_server (ASSUAN_CONTEXT ctx->inbound.fd = _get_osfhandle (filedes[0]); ctx->outbound.fd = _get_osfhandle (filedes[1]); #else - ctx->inbound.fd = filedes[0]; - ctx->outbound.fd = filedes[1]; + s = getenv ("_assuan_connection_fd"); + if (s && *s && is_valid_socket (s) ) + { + /* Well, we are called with an bi-directional file + descriptor. Prepare for using sendmsg/recvmsg. In this + case we ignore the passed file descriptors. */ + ctx->inbound.fd = ctx->outbound.fd = atoi (s); + _assuan_init_uds_io (ctx); + ctx->deinit_handler = _assuan_uds_deinit; + } + else if (filedes && filedes[0] != -1 && filedes[1] != -1 ) + { + /* Standard pipe server. */ + ctx->inbound.fd = filedes[0]; + ctx->outbound.fd = filedes[1]; + } + else + { + _assuan_release_context (*r_ctx); + *r_ctx = NULL; + return ASSUAN_Problem_Starting_Server; + } #endif ctx->pipe_mode = 1; @@ -127,18 +162,19 @@ assuan_init_pipe_server (ASSUAN_CONTEXT void -_assuan_release_context (ASSUAN_CONTEXT ctx) +_assuan_release_context (assuan_context_t ctx) { if (ctx) { xfree (ctx->hello_line); xfree (ctx->okay_line); + xfree (ctx->cmdtbl); xfree (ctx); } } void -assuan_deinit_server (ASSUAN_CONTEXT ctx) +assuan_deinit_server (assuan_context_t ctx) { if (ctx) { diff -urpNP gpgme-1.1.2/assuan/assuan-socket-connect.c gpgme-1.1.3/assuan/assuan-socket-connect.c --- gpgme-1.1.2/assuan/assuan-socket-connect.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-socket-connect.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -54,7 +55,7 @@ static int -do_finish (ASSUAN_CONTEXT ctx) +do_finish (assuan_context_t ctx) { if (ctx->inbound.fd != -1) { @@ -66,56 +67,70 @@ do_finish (ASSUAN_CONTEXT ctx) } static void -do_deinit (ASSUAN_CONTEXT ctx) +do_deinit (assuan_context_t ctx) { do_finish (ctx); } + + /* Make a connection to the Unix domain socket NAME and return a new Assuan context in CTX. SERVER_PID is currently not used but may become handy in the future. */ assuan_error_t -assuan_socket_connect (ASSUAN_CONTEXT *r_ctx, +assuan_socket_connect (assuan_context_t *r_ctx, const char *name, pid_t server_pid) { + return assuan_socket_connect_ext (r_ctx, name, server_pid, 0); +} + + +/* Make a connection to the Unix domain socket NAME and return a new + Assuan context in CTX. SERVER_PID is currently not used but may + become handy in the future. With flags set to 1 sendmsg and + recvmesg are used. */ +assuan_error_t +assuan_socket_connect_ext (assuan_context_t *r_ctx, + const char *name, pid_t server_pid, + unsigned int flags) +{ static struct assuan_io io = { _assuan_simple_read, _assuan_simple_write }; assuan_error_t err; - ASSUAN_CONTEXT ctx; + assuan_context_t ctx; int fd; struct sockaddr_un srvr_addr; size_t len; const char *s; if (!r_ctx || !name) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); *r_ctx = NULL; - /* We require that the name starts with a slash, so that we can - alter reuse this function for other socket types. To make things - easier we allow an optional dirver prefix. */ + /* We require that the name starts with a slash, so that we + eventually can reuse this function for other socket types. To + make things easier we allow an optional dirver prefix. */ s = name; if (*s && s[1] == ':') s += 2; if (*s != DIRSEP_C && *s != '/') - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); if (strlen (name)+1 >= sizeof srvr_addr.sun_path) - return ASSUAN_Invalid_Value; + return _assuan_error (ASSUAN_Invalid_Value); err = _assuan_new_context (&ctx); if (err) return err; - ctx->deinit_handler = do_deinit; + ctx->deinit_handler = ((flags&1))? _assuan_uds_deinit : do_deinit; ctx->finish_handler = do_finish; - fd = _assuan_sock_new (PF_LOCAL, SOCK_STREAM, 0); if (fd == -1) { _assuan_log_printf ("can't create socket: %s\n", strerror (errno)); _assuan_release_context (ctx); - return ASSUAN_General_Error; + return _assuan_error (ASSUAN_General_Error); } memset (&srvr_addr, 0, sizeof srvr_addr); @@ -131,13 +146,15 @@ assuan_socket_connect (ASSUAN_CONTEXT *r name, strerror (errno)); _assuan_release_context (ctx); _assuan_close (fd); - return ASSUAN_Connect_Failed; + return _assuan_error (ASSUAN_Connect_Failed); } ctx->inbound.fd = fd; ctx->outbound.fd = fd; ctx->io = &io; - + if ((flags&1)) + _assuan_init_uds_io (ctx); + /* initial handshake */ { int okay, off; @@ -151,7 +168,7 @@ assuan_socket_connect (ASSUAN_CONTEXT *r /*LOG ("can't connect to server: `");*/ _assuan_log_sanitized_string (ctx->inbound.line); fprintf (assuan_get_assuan_log_stream (), "'\n"); - err = ASSUAN_Connect_Failed; + err = _assuan_error (ASSUAN_Connect_Failed); } } @@ -163,3 +180,5 @@ assuan_socket_connect (ASSUAN_CONTEXT *r *r_ctx = ctx; return 0; } + + diff -urpNP gpgme-1.1.2/assuan/assuan-socket-server.c gpgme-1.1.3/assuan/assuan-socket-server.c --- gpgme-1.1.2/assuan/assuan-socket-server.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-socket-server.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -33,21 +34,33 @@ #include "assuan-defs.h" +static struct assuan_io io = { _assuan_simple_read, + _assuan_simple_write }; + + static int accept_connection_bottom (assuan_context_t ctx) { int fd = ctx->connected_fd; + ctx->peercred.valid = 0; #ifdef HAVE_SO_PEERCRED { - /* This overrides any already set PID if the function returns a - valid one. */ struct ucred cr; - int cl = sizeof cr; + socklen_t cl = sizeof cr; - if ( !getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl) - && cr.pid != (pid_t)-1 && cr.pid ) - ctx->pid = cr.pid; + if ( !getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl)) + { + ctx->peercred.pid = cr.pid; + ctx->peercred.uid = cr.uid; + ctx->peercred.gid = cr.gid; + ctx->peercred.valid = 1; + + /* This overrides any already set PID if the function returns + a valid one. */ + if (cr.pid != (pid_t)-1 && cr.pid) + ctx->pid = cr.pid; + } } #endif @@ -72,13 +85,13 @@ accept_connection (assuan_context_t ctx) { int fd; struct sockaddr_un clnt_addr; - size_t len = sizeof clnt_addr; + socklen_t len = sizeof clnt_addr; fd = accept (ctx->listen_fd, (struct sockaddr*)&clnt_addr, &len ); if (fd == -1) { ctx->os_errno = errno; - return ASSUAN_Accept_Failed; + return _assuan_error (ASSUAN_Accept_Failed); } ctx->connected_fd = fd; @@ -104,71 +117,67 @@ deinit_socket_server (assuan_context_t c finish_connection (ctx); } -static struct assuan_io io = { _assuan_simple_read, - _assuan_simple_write }; - /* Initialize a server for the socket LISTEN_FD which has already be put into listen mode */ int assuan_init_socket_server (assuan_context_t *r_ctx, int listen_fd) { - assuan_context_t ctx; - int rc; - - *r_ctx = NULL; - ctx = xtrycalloc (1, sizeof *ctx); - if (!ctx) - return ASSUAN_Out_Of_Core; - ctx->is_server = 1; - ctx->input_fd = -1; - ctx->output_fd = -1; - - ctx->inbound.fd = -1; - ctx->outbound.fd = -1; - - ctx->listen_fd = listen_fd; - ctx->connected_fd = -1; - ctx->deinit_handler = deinit_socket_server; - ctx->accept_handler = accept_connection; - ctx->finish_handler = finish_connection; - - ctx->io = &io; - - rc = _assuan_register_std_commands (ctx); - if (rc) - xfree (ctx); - else - *r_ctx = ctx; - return rc; + return assuan_init_socket_server_ext (r_ctx, listen_fd, 0); } -/* Initialize a server using the already accepted socket FD. */ +/* Initialize a server using the already accepted socket FD. This + fucntion is deprecated. */ int assuan_init_connected_socket_server (assuan_context_t *r_ctx, int fd) { + return assuan_init_socket_server_ext (r_ctx, fd, 2); +} + + +/* + Flag bits: 0 - use sendmsg/recvmsg to allow descriptor passing + 1 - FD has already been accepted. +*/ +int +assuan_init_socket_server_ext (assuan_context_t *r_ctx, int fd, + unsigned int flags) +{ assuan_context_t ctx; int rc; *r_ctx = NULL; ctx = xtrycalloc (1, sizeof *ctx); if (!ctx) - return ASSUAN_Out_Of_Core; + return _assuan_error (ASSUAN_Out_Of_Core); ctx->is_server = 1; - ctx->pipe_mode = 1; /* we want a second accept to indicate EOF */ + if ((flags & 2)) + ctx->pipe_mode = 1; /* We want a second accept to indicate EOF. */ ctx->input_fd = -1; ctx->output_fd = -1; ctx->inbound.fd = -1; ctx->outbound.fd = -1; - ctx->io = &io; - - ctx->listen_fd = -1; - ctx->connected_fd = fd; - ctx->deinit_handler = deinit_socket_server; - ctx->accept_handler = accept_connection_bottom; + if ((flags & 2)) + { + ctx->listen_fd = -1; + ctx->connected_fd = fd; + } + else + { + ctx->listen_fd = fd; + ctx->connected_fd = -1; + } + ctx->deinit_handler = (flags & 1)? _assuan_uds_deinit:deinit_socket_server; + ctx->accept_handler = ((flags & 2) + ? accept_connection_bottom + : accept_connection); ctx->finish_handler = finish_connection; + ctx->io = &io; + if ((flags & 1)) + _assuan_init_uds_io (ctx); + rc = _assuan_register_std_commands (ctx); if (rc) xfree (ctx); @@ -176,5 +185,3 @@ assuan_init_connected_socket_server (ass *r_ctx = ctx; return rc; } - - diff -urpNP gpgme-1.1.2/assuan/assuan-socket.c gpgme-1.1.3/assuan/assuan-socket.c --- gpgme-1.1.2/assuan/assuan-socket.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-socket.c 2007-01-29 20:16:19.000000000 +0000 @@ -1,22 +1,24 @@ /* assuan-socket.c - * Copyright (C) 2004 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of Assuan. * - * GnuPG is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Assuan 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. * - * GnuPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Assuan 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 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 + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ + #include #include #ifdef HAVE_W32_SYSTEM @@ -28,6 +30,18 @@ #endif #include "assuan-defs.h" +/* Hacks for Slowaris. */ +#ifndef PF_LOCAL +# ifdef PF_UNIX +# define PF_LOCAL PF_UNIX +# else +# define PF_LOCAL AF_UNIX +# endif +#endif +#ifndef AF_LOCAL +# define AF_LOCAL AF_UNIX +#endif + int _assuan_close (int fd) { diff -urpNP gpgme-1.1.2/assuan/assuan-uds.c gpgme-1.1.3/assuan/assuan-uds.c --- gpgme-1.1.2/assuan/assuan-uds.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-uds.c 2007-01-29 20:16:19.000000000 +0000 @@ -0,0 +1,311 @@ +/* assuan-uds.c - Assuan unix domain socket utilities + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This file is part of Assuan. + * + * Assuan 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. + * + * Assuan 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#ifndef HAVE_W32_SYSTEM +#include +#include +#else +#include +#endif +#if HAVE_SYS_UIO_H +#include +#endif +#include +#include +#include +#include + +#include "assuan-defs.h" + +#ifdef USE_DESCRIPTOR_PASSING +/* Provide replacement for missing CMSG maccros. We assume that + size_t matches the alignment requirement. */ +#define MY_ALIGN(n) ((((n))+ sizeof(size_t)-1) & (size_t)~(sizeof(size_t)-1)) +#ifndef CMSG_SPACE +#define CMSG_SPACE(n) (MY_ALIGN(sizeof(struct cmsghdr)) + MY_ALIGN((n))) +#endif +#ifndef CMSG_LEN +#define CMSG_LEN(n) (MY_ALIGN(sizeof(struct cmsghdr)) + (n)) +#endif +#ifndef CMSG_FIRSTHDR +#define CMSG_FIRSTHDR(mhdr) \ + ((size_t)(mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ + ? (struct cmsghdr*) (mhdr)->msg_control : (struct cmsghdr*)NULL) +#endif +#ifndef CMSG_DATA +#define CMSG_DATA(cmsg) ((unsigned char*)((struct cmsghdr*)(cmsg)+1)) +#endif +#endif /*USE_DESCRIPTOR_PASSING*/ + + +/* Read from a unix domain socket using sendmsg. + + FIXME: We don't need the buffering. It is a leftover from the time + when we used datagrams. */ +static ssize_t +uds_reader (assuan_context_t ctx, void *buf, size_t buflen) +{ + int len = ctx->uds.buffersize; + +#ifndef HAVE_W32_SYSTEM + if (!ctx->uds.bufferallocated) + { + ctx->uds.buffer = xtrymalloc (2048); + if (!ctx->uds.buffer) + return _assuan_error (ASSUAN_Out_Of_Core); + ctx->uds.bufferallocated = 2048; + } + + while (!len) /* No data is buffered. */ + { + struct msghdr msg; + struct iovec iovec; +#ifdef USE_DESCRIPTOR_PASSING + union { + struct cmsghdr cm; + char control[CMSG_SPACE(sizeof (int))]; + } control_u; + struct cmsghdr *cmptr; +#endif /*USE_DESCRIPTOR_PASSING*/ + + memset (&msg, 0, sizeof (msg)); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = &iovec; + msg.msg_iovlen = 1; + iovec.iov_base = ctx->uds.buffer; + iovec.iov_len = ctx->uds.bufferallocated; +#ifdef USE_DESCRIPTOR_PASSING + msg.msg_control = control_u.control; + msg.msg_controllen = sizeof (control_u.control); +#endif + + len = _assuan_simple_recvmsg (ctx, &msg); + if (len < 0) + return -1; + + ctx->uds.buffersize = len; + ctx->uds.bufferoffset = 0; + +#ifdef USE_DESCRIPTOR_PASSING + cmptr = CMSG_FIRSTHDR (&msg); + if (cmptr && cmptr->cmsg_len == CMSG_LEN (sizeof(int))) + { + if (cmptr->cmsg_level != SOL_SOCKET + || cmptr->cmsg_type != SCM_RIGHTS) + _assuan_log_printf ("unexpected ancillary data received\n"); + else + { + int fd = *((int*)CMSG_DATA (cmptr)); + + if (ctx->uds.pendingfdscount >= DIM (ctx->uds.pendingfds)) + { + _assuan_log_printf ("too many descriptors pending - " + "closing received descriptor %d\n", fd); + _assuan_close (fd); + } + else + ctx->uds.pendingfds[ctx->uds.pendingfdscount++] = fd; + } + } +#endif /*USE_DESCRIPTOR_PASSING*/ + } + +#else /*HAVE_W32_SYSTEM*/ + + len = recvfrom (ctx->inbound.fd, buf, buflen, 0, NULL, NULL); + +#endif /*HAVE_W32_SYSTEM*/ + + /* Return some data to the user. */ + + if (len > buflen) /* We have more than the user requested. */ + len = buflen; + + memcpy (buf, ctx->uds.buffer + ctx->uds.bufferoffset, len); + ctx->uds.buffersize -= len; + assert (ctx->uds.buffersize >= 0); + ctx->uds.bufferoffset += len; + assert (ctx->uds.bufferoffset <= ctx->uds.bufferallocated); + + return len; +} + + +/* Write to the domain server. */ +static ssize_t +uds_writer (assuan_context_t ctx, const void *buf, size_t buflen) +{ +#ifndef HAVE_W32_SYSTEM + struct msghdr msg; + struct iovec iovec; + ssize_t len; + + memset (&msg, 0, sizeof (msg)); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iovlen = 1; + msg.msg_iov = &iovec; + iovec.iov_base = (void*)buf; + iovec.iov_len = buflen; + + len = _assuan_simple_sendmsg (ctx, &msg); +#else /*HAVE_W32_SYSTEM*/ + int len; + + len = sendto (ctx->outbound.fd, buf, buflen, 0, + (struct sockaddr *)&ctx->serveraddr, + sizeof (struct sockaddr_in)); +#endif /*HAVE_W32_SYSTEM*/ + return len; +} + + +static assuan_error_t +uds_sendfd (assuan_context_t ctx, int fd) +{ +#ifdef USE_DESCRIPTOR_PASSING + struct msghdr msg; + struct iovec iovec; + union { + struct cmsghdr cm; + char control[CMSG_SPACE(sizeof (int))]; + } control_u; + struct cmsghdr *cmptr; + int len; + char buffer[80]; + + /* We need to send some real data so that a read won't return 0 + which will be taken as an EOF. It also helps with debugging. */ + snprintf (buffer, sizeof(buffer)-1, "# descriptor %d is in flight\n", fd); + buffer[sizeof(buffer)-1] = 0; + + memset (&msg, 0, sizeof (msg)); + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iovlen = 1; + msg.msg_iov = &iovec; + iovec.iov_base = buffer; + iovec.iov_len = strlen (buffer); + + msg.msg_control = control_u.control; + msg.msg_controllen = sizeof (control_u.control); + cmptr = CMSG_FIRSTHDR (&msg); + cmptr->cmsg_len = CMSG_LEN(sizeof(int)); + cmptr->cmsg_level = SOL_SOCKET; + cmptr->cmsg_type = SCM_RIGHTS; + *((int*)CMSG_DATA (cmptr)) = fd; + + len = _assuan_simple_sendmsg (ctx, &msg); + if (len < 0) + { + _assuan_log_printf ("uds_sendfd: %s\n", strerror (errno)); + return _assuan_error (ASSUAN_Write_Error); + } + else + return 0; +#else + return _assuan_error (ASSUAN_Not_Implemented); +#endif +} + + +static assuan_error_t +uds_receivefd (assuan_context_t ctx, int *fd) +{ +#ifdef USE_DESCRIPTOR_PASSING + int i; + + if (!ctx->uds.pendingfdscount) + { + _assuan_log_printf ("no pending file descriptors!\n"); + return _assuan_error (ASSUAN_General_Error); + } + assert (ctx->uds.pendingfdscount <= DIM(ctx->uds.pendingfds)); + + *fd = ctx->uds.pendingfds[0]; + for (i=1; i < ctx->uds.pendingfdscount; i++) + ctx->uds.pendingfds[i-1] = ctx->uds.pendingfds[i]; + ctx->uds.pendingfdscount--; + + return 0; +#else + return _assuan_error (ASSUAN_Not_Implemented); +#endif +} + + +/* Close all pending fds. */ +void +_assuan_uds_close_fds (assuan_context_t ctx) +{ + int i; + + for (i = 0; i < ctx->uds.pendingfdscount; i++) + _assuan_close (ctx->uds.pendingfds[i]); + ctx->uds.pendingfdscount = 0; +} + +/* Deinitialize the unix domain socket I/O functions. */ +void +_assuan_uds_deinit (assuan_context_t ctx) +{ + /* First call the finish_handler which should close descriptors etc. */ + ctx->finish_handler (ctx); + + if (ctx->uds.buffer) + { + assert (ctx->uds.bufferallocated); + ctx->uds.bufferallocated = 0; + xfree (ctx->uds.buffer); + } + + _assuan_uds_close_fds (ctx); +} + + +/* Helper function to initialize a context for domain I/O. */ +void +_assuan_init_uds_io (assuan_context_t ctx) +{ + static struct assuan_io io = { uds_reader, uds_writer, + uds_sendfd, uds_receivefd }; + + ctx->io = &io; + ctx->uds.buffer = 0; + ctx->uds.bufferoffset = 0; + ctx->uds.buffersize = 0; + ctx->uds.bufferallocated = 0; + ctx->uds.pendingfdscount = 0; +} + diff -urpNP gpgme-1.1.2/assuan/assuan-util.c gpgme-1.1.3/assuan/assuan-util.c --- gpgme-1.1.2/assuan/assuan-util.c 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan-util.c 2007-01-29 20:16:19.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #include @@ -106,38 +107,40 @@ assuan_get_pointer (assuan_context_t ctx void -assuan_set_log_stream (assuan_context_t ctx, FILE *fp) +assuan_begin_confidential (assuan_context_t ctx) { if (ctx) { - if (ctx->log_fp) - fflush (ctx->log_fp); - ctx->log_fp = fp; - _assuan_set_default_log_stream (fp); + ctx->confidential = 1; } } - void -assuan_begin_confidential (assuan_context_t ctx) +assuan_end_confidential (assuan_context_t ctx) { if (ctx) { - ctx->confidential = 1; + ctx->confidential = 0; } } -void -assuan_end_confidential (assuan_context_t ctx) + +void +assuan_set_io_monitor (assuan_context_t ctx, + unsigned int (*monitor)(assuan_context_t ctx, + int direction, + const char *line, + size_t linelen)) { if (ctx) { - ctx->confidential = 0; + ctx->io_monitor = monitor; } } + /* For context CTX, set the flag FLAG to VALUE. Values for flags are usually 1 or 0 but certain flags might allow for other values; see the description of the type assuan_flag_t for details. */ @@ -166,97 +169,3 @@ assuan_get_flag (assuan_context_t ctx, a } -/* Dump a possibly binary string (used for debugging). Distinguish - ascii text from binary and print it accordingly. */ -void -_assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length) -{ - const unsigned char *s; - int n; - - for (n=length,s=buffer; n; n--, s++) - if ((!isascii (*s) || iscntrl (*s) || !isprint (*s)) && !(*s >= 0x80)) - break; - - s = buffer; - if (!n && *s != '[') - fwrite (buffer, length, 1, fp); - else - { -#ifdef HAVE_FLOCKFILE - flockfile (fp); -#endif - putc_unlocked ('[', fp); - for (n=0; n < length; n++, s++) - fprintf (fp, " %02x", *s); - putc_unlocked (' ', fp); - putc_unlocked (']', fp); -#ifdef HAVE_FUNLOCKFILE - funlockfile (fp); -#endif - } -} - -/* Log a user supplied string. Escapes non-printable before - printing. */ -void -_assuan_log_sanitized_string (const char *string) -{ - const unsigned char *s = (const unsigned char *) string; - FILE *fp = assuan_get_assuan_log_stream (); - - if (! *s) - return; - -#ifdef HAVE_FLOCKFILE - flockfile (fp); -#endif - - for (; *s; s++) - { - int c = 0; - - switch (*s) - { - case '\r': - c = 'r'; - break; - - case '\n': - c = 'n'; - break; - - case '\f': - c = 'f'; - break; - - case '\v': - c = 'v'; - break; - - case '\b': - c = 'b'; - break; - - default: - if ((isascii (*s) && isprint (*s)) || (*s >= 0x80)) - putc_unlocked (*s, fp); - else - { - putc_unlocked ('\\', fp); - fprintf (fp, "x%02x", *s); - } - } - - if (c) - { - putc_unlocked ('\\', fp); - putc_unlocked (c, fp); - } - } - -#ifdef HAVE_FUNLOCKFILE - funlockfile (fp); -#endif -} - diff -urpNP gpgme-1.1.2/assuan/assuan.h gpgme-1.1.3/assuan/assuan.h --- gpgme-1.1.2/assuan/assuan.h 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/assuan/assuan.h 2007-01-29 20:16:18.000000000 +0000 @@ -15,7 +15,8 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifndef ASSUAN_H @@ -26,24 +27,32 @@ #include -/* To use this file with libraries the following macros are often - useful: +/* To use this file with libraries the following macros are useful: - #define _ASSUAN_EXT_SYM_PREFIX _foo_ + #define _ASSUAN_EXT_SYM_PREFIX _foo_ This prefixes all external symbols with "_foo_". - #define _ASSUAN_NO_PTH + #define _ASSUAN_ONLY_GPG_ERRORS - This avoids inclusion of special GNU Pth hacks. + If this is defined all old-style Assuan error codes are made + inactive as well as other dereacted stuff. - #define _ASSUAN_NO_FIXED_SIGNALS + The follwing macros are used internally in the implementation of + libassuan: - This disables changing of certain signal handler; i.e. SIGPIPE. + #define _ASSUAN_NO_PTH - #define _ASSUAN_USE_DOUBLE_FORK + This avoids inclusion of special GNU Pth hacks. - Use a double fork approach when connecting to a server through a pipe. + #define _ASSUAN_NO_FIXED_SIGNALS + + This disables changing of certain signal handler; i.e. SIGPIPE. + + #define _ASSUAN_USE_DOUBLE_FORK + + Use a double fork approach when connecting to a server through + a pipe. */ /**** Begin GPGME specific modifications. ******/ #define _ASSUAN_EXT_SYM_PREFIX _gpgme_ @@ -66,6 +75,8 @@ int _gpgme_ath_accept (int s, struct soc int _gpgme_ath_connect (int s, struct sockaddr *addr, socklen_t length); int _gpgme_ath_sendmsg (int s, const struct msghdr *msg, int flags); int _gpgme_ath_recvmsg (int s, struct msghdr *msg, int flags); +int _gpgme_io_sendmsg (int sock, const struct msghdr *msg, int flags); +int _gpgme_io_recvmsg (int sock, struct msghdr *msg, int flags); #endif /*!HAVE_W32_SYSTEM*/ #define read _gpgme_io_read @@ -74,8 +85,8 @@ int _gpgme_ath_recvmsg (int s, struct ms #define select _gpgme_ath_select #define accept _gpgme_ath_accept #define connect _gpgme_ath_connect -#define sendmsg _gpgme_ath_sendmsg -#define recvmsg _gpgme_ath_recvmsg +#define sendmsg _gpgme_io_sendmsg +#define recvmsg _gpgme_io_recvmsg #endif /*_ASSUAN_IN_GPGME_BUILD_ASSUAN*/ /**** End GPGME specific modifications. ******/ @@ -86,6 +97,8 @@ int _gpgme_ath_recvmsg (int s, struct ms #define _ASSUAN_PREFIX(x) _ASSUAN_PREFIX2(_ASSUAN_EXT_SYM_PREFIX,x) #define assuan_ _ASSUAN_PREFIX(assuan_) #define assuan_register_command _ASSUAN_PREFIX(assuan_register_command) +#define assuan_register_post_cmd_notify \ + _ASSUAN_PREFIX(assuan_register_post_cmd_notify) #define assuan_register_bye_notify _ASSUAN_PREFIX(assuan_register_bye_notify) #define assuan_register_reset_notify \ _ASSUAN_PREFIX(assuan_register_reset_notify) @@ -115,12 +128,15 @@ int _gpgme_ath_recvmsg (int s, struct ms #define assuan_init_socket_server _ASSUAN_PREFIX(assuan_init_socket_server) #define assuan_init_connected_socket_server \ _ASSUAN_PREFIX(assuan_init_connected_socket_server) +#define assuan_init_socket_server_ext \ + _ASSUAN_PREFIX(assuan_init_socket_server_ext) #define assuan_pipe_connect _ASSUAN_PREFIX(assuan_pipe_connect) +#define assuan_pipe_connect_ext _ASSUAN_PREFIX(assuan_pipe_connect_ext) #define assuan_socket_connect _ASSUAN_PREFIX(assuan_socket_connect) -#define assuan_domain_connect _ASSUAN_PREFIX(assuan_domain_connect) -#define assuan_init_domain_server _ASSUAN_PREFIX(assuan_init_domain_server) +#define assuan_socket_connect_ext _ASSUAN_PREFIX(assuan_socket_connect_ext) #define assuan_disconnect _ASSUAN_PREFIX(assuan_disconnect) #define assuan_get_pid _ASSUAN_PREFIX(assuan_get_pid) +#define assuan_get_peercred _ASSUAN_PREFIX(assuan_get_peercred) #define assuan_transact _ASSUAN_PREFIX(assuan_transact) #define assuan_inquire _ASSUAN_PREFIX(assuan_inquire) #define assuan_read_line _ASSUAN_PREFIX(assuan_read_line) @@ -134,9 +150,12 @@ int _gpgme_ath_recvmsg (int s, struct ms #define assuan_set_error _ASSUAN_PREFIX(assuan_set_error) #define assuan_set_pointer _ASSUAN_PREFIX(assuan_set_pointer) #define assuan_get_pointer _ASSUAN_PREFIX(assuan_get_pointer) +#define assuan_set_io_monitor _ASSUAN_PREFIX(assuan_set_io_monitor) #define assuan_begin_confidential _ASSUAN_PREFIX(assuan_begin_confidential) #define assuan_end_confidential _ASSUAN_PREFIX(assuan_end_confidential) #define assuan_strerror _ASSUAN_PREFIX(assuan_strerror) +#define assuan_set_assuan_err_source \ + _ASSUAN_PREFIX(assuan_set_assuan_err_source) #define assuan_set_assuan_log_stream \ _ASSUAN_PREFIX(assuan_set_assuan_log_stream) #define assuan_get_assuan_log_stream \ @@ -189,89 +208,123 @@ extern "C" #endif -typedef enum -{ - ASSUAN_No_Error = 0, - ASSUAN_General_Error = 1, - ASSUAN_Out_Of_Core = 2, - ASSUAN_Invalid_Value = 3, - ASSUAN_Timeout = 4, - ASSUAN_Read_Error = 5, - ASSUAN_Write_Error = 6, - ASSUAN_Problem_Starting_Server = 7, - ASSUAN_Not_A_Server = 8, - ASSUAN_Not_A_Client = 9, - ASSUAN_Nested_Commands = 10, - ASSUAN_Invalid_Response = 11, - ASSUAN_No_Data_Callback = 12, - ASSUAN_No_Inquire_Callback = 13, - ASSUAN_Connect_Failed = 14, - ASSUAN_Accept_Failed = 15, +/* Check for compiler features. */ +#if __GNUC__ +#define _ASSUAN_GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + +#if _ASSUAN_GCC_VERSION > 30100 +#define _ASSUAN_DEPRECATED __attribute__ ((__deprecated__)) +#endif +#endif +#ifndef _ASSUAN_DEPRECATED +#define _ASSUAN_DEPRECATED +#endif + + +/* Assuan error codes. These are only used by old applications or + those applications which won't make use of libgpg-error. */ +#ifndef _ASSUAN_ONLY_GPG_ERRORS +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_No_Error 0 +#endif +#define ASSUAN_General_Error 1 +#define ASSUAN_Out_Of_Core 2 +#define ASSUAN_Invalid_Value 3 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Timeout 4 +#endif +#define ASSUAN_Read_Error 5 +#define ASSUAN_Write_Error 6 +#define ASSUAN_Problem_Starting_Server 7 +#define ASSUAN_Not_A_Server 8 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Not_A_Client 9 +#endif +#define ASSUAN_Nested_Commands 10 +#define ASSUAN_Invalid_Response 11 +#define ASSUAN_No_Data_Callback 12 +#define ASSUAN_No_Inquire_Callback 13 +#define ASSUAN_Connect_Failed 14 +#define ASSUAN_Accept_Failed 15 /* Error codes above 99 are meant as status codes */ - ASSUAN_Not_Implemented = 100, - ASSUAN_Server_Fault = 101, - ASSUAN_Invalid_Command = 102, - ASSUAN_Unknown_Command = 103, - ASSUAN_Syntax_Error = 104, - ASSUAN_Parameter_Error = 105, - ASSUAN_Parameter_Conflict = 106, - ASSUAN_Line_Too_Long = 107, - ASSUAN_Line_Not_Terminated = 108, - ASSUAN_No_Input = 109, - ASSUAN_No_Output = 110, - ASSUAN_Canceled = 111, - ASSUAN_Unsupported_Algorithm = 112, - ASSUAN_Server_Resource_Problem = 113, - ASSUAN_Server_IO_Error = 114, - ASSUAN_Server_Bug = 115, - ASSUAN_No_Data_Available = 116, - ASSUAN_Invalid_Data = 117, - ASSUAN_Unexpected_Command = 118, - ASSUAN_Too_Much_Data = 119, - ASSUAN_Inquire_Unknown = 120, - ASSUAN_Inquire_Error = 121, - ASSUAN_Invalid_Option = 122, - ASSUAN_Invalid_Index = 123, - ASSUAN_Unexpected_Status = 124, - ASSUAN_Unexpected_Data = 125, - ASSUAN_Invalid_Status = 126, - ASSUAN_Locale_Problem = 127, - ASSUAN_Not_Confirmed = 128, - - /* Warning: Don't use the rror codes, below they are deprecated. */ - ASSUAN_Bad_Certificate = 201, - ASSUAN_Bad_Certificate_Chain = 202, - ASSUAN_Missing_Certificate = 203, - ASSUAN_Bad_Signature = 204, - ASSUAN_No_Agent = 205, - ASSUAN_Agent_Error = 206, - ASSUAN_No_Public_Key = 207, - ASSUAN_No_Secret_Key = 208, - ASSUAN_Invalid_Name = 209, - - ASSUAN_Cert_Revoked = 301, - ASSUAN_No_CRL_For_Cert = 302, - ASSUAN_CRL_Too_Old = 303, - ASSUAN_Not_Trusted = 304, - - ASSUAN_Card_Error = 401, - ASSUAN_Invalid_Card = 402, - ASSUAN_No_PKCS15_App = 403, - ASSUAN_Card_Not_Present = 404, - ASSUAN_Invalid_Id = 405, +#define ASSUAN_Not_Implemented 100 +#define ASSUAN_Server_Fault 101 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Invalid_Command 102 +#endif +#define ASSUAN_Unknown_Command 103 +#define ASSUAN_Syntax_Error 104 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Parameter_Error 105 +#endif +#define ASSUAN_Parameter_Conflict 106 +#define ASSUAN_Line_Too_Long 107 +#define ASSUAN_Line_Not_Terminated 108 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_No_Input 109 +#define ASSUAN_No_Output 110 +#endif +#define ASSUAN_Canceled 111 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Unsupported_Algorithm 112 +#define ASSUAN_Server_Resource_Problem 113 +#define ASSUAN_Server_IO_Error 114 +#define ASSUAN_Server_Bug 115 +#define ASSUAN_No_Data_Available 116 +#define ASSUAN_Invalid_Data 117 +#endif +#define ASSUAN_Unexpected_Command 118 +#define ASSUAN_Too_Much_Data 119 +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Inquire_Unknown 120 +#define ASSUAN_Inquire_Error 121 +#define ASSUAN_Invalid_Option 122 +#define ASSUAN_Invalid_Index 123 +#define ASSUAN_Unexpected_Status 124 +#define ASSUAN_Unexpected_Data 125 +#define ASSUAN_Invalid_Status 126 +#define ASSUAN_Locale_Problem 127 +#endif +#define ASSUAN_Not_Confirmed 128 + + /* Warning: Don't use the Error codes, below they are deprecated. */ +#ifndef _ASSUAN_IN_LIBASSUAN +#define ASSUAN_Bad_Certificate 201 +#define ASSUAN_Bad_Certificate_Chain 202 +#define ASSUAN_Missing_Certificate 203 +#define ASSUAN_Bad_Signature 204 +#define ASSUAN_No_Agent 205 +#define ASSUAN_Agent_Error 206 +#define ASSUAN_No_Public_Key 207 +#define ASSUAN_No_Secret_Key 208 +#define ASSUAN_Invalid_Name 209 + +#define ASSUAN_Cert_Revoked 301 +#define ASSUAN_No_CRL_For_Cert 302 +#define ASSUAN_CRL_Too_Old 303 +#define ASSUAN_Not_Trusted 304 + +#define ASSUAN_Card_Error 401 +#define ASSUAN_Invalid_Card 402 +#define ASSUAN_No_PKCS15_App 403 +#define ASSUAN_Card_Not_Present 404 +#define ASSUAN_Invalid_Id 405 /* Error codes in the range 1000 to 9999 may be used by applications at their own discretion. */ - ASSUAN_USER_ERROR_FIRST = 1000, - ASSUAN_USER_ERROR_LAST = 9999 +#define ASSUAN_USER_ERROR_FIRST 1000 +#define ASSUAN_USER_ERROR_LAST 9999 +#endif -} assuan_error_t; +typedef int assuan_error_t; -typedef assuan_error_t AssuanError; /* Deprecated. */ +typedef assuan_error_t AssuanError _ASSUAN_DEPRECATED; /* This is a list of pre-registered ASSUAN commands */ -/* NOTE, these command IDs are now deprectated and solely exists for +/* Note, these command IDs are now deprectated and solely exists for compatibility reasons. */ typedef enum { @@ -290,6 +343,13 @@ typedef enum } AssuanCommand; +#else /*!_ASSUAN_ONLY_GPG_ERRORS*/ + +typedef int assuan_error_t; + +#endif /*!_ASSUAN_ONLY_GPG_ERRORS*/ + + /* Definitions of flags for assuan_set_flag(). */ typedef enum { @@ -306,12 +366,16 @@ assuan_flag_t; struct assuan_context_s; typedef struct assuan_context_s *assuan_context_t; -typedef struct assuan_context_s *ASSUAN_CONTEXT; +#ifndef _ASSUAN_ONLY_GPG_ERRORS +typedef struct assuan_context_s *ASSUAN_CONTEXT _ASSUAN_DEPRECATED; +#endif /*_ASSUAN_ONLY_GPG_ERRORS*/ /*-- assuan-handler.c --*/ int assuan_register_command (assuan_context_t ctx, const char *cmd_string, int (*handler)(assuan_context_t, char *)); +int assuan_register_post_cmd_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, int)); int assuan_register_bye_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t)); int assuan_register_reset_notify (assuan_context_t ctx, @@ -343,7 +407,7 @@ assuan_error_t assuan_write_status (assu file descriptor via CTX and stores it in *RDF (the CTX must be capable of passing file descriptors). */ assuan_error_t assuan_command_parse_fd (assuan_context_t ctx, char *line, - int *rfd); + int *rfd); /*-- assuan-listen.c --*/ assuan_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line); @@ -360,55 +424,54 @@ void assuan_deinit_server (assuan_contex /*-- assuan-socket-server.c --*/ int assuan_init_socket_server (assuan_context_t *r_ctx, int listen_fd); -int assuan_init_connected_socket_server (assuan_context_t *r_ctx, int fd); - +int assuan_init_connected_socket_server (assuan_context_t *r_ctx, + int fd) _ASSUAN_DEPRECATED; +int assuan_init_socket_server_ext (assuan_context_t *r_ctx, int fd, + unsigned int flags); /*-- assuan-pipe-connect.c --*/ -assuan_error_t assuan_pipe_connect (assuan_context_t *ctx, const char *name, +assuan_error_t assuan_pipe_connect (assuan_context_t *ctx, + const char *name, const char *const argv[], int *fd_child_list); -assuan_error_t assuan_pipe_connect2 (assuan_context_t *ctx, const char *name, +assuan_error_t assuan_pipe_connect2 (assuan_context_t *ctx, + const char *name, const char *const argv[], int *fd_child_list, void (*atfork) (void*, int), - void *atforkvalue); + void *atforkvalue) _ASSUAN_DEPRECATED; +assuan_error_t assuan_pipe_connect_ext (assuan_context_t *ctx, + const char *name, + const char *const argv[], + int *fd_child_list, + void (*atfork) (void *, int), + void *atforkvalue, + unsigned int flags); + /*-- assuan-socket-connect.c --*/ -assuan_error_t assuan_socket_connect (assuan_context_t *ctx, const char *name, +assuan_error_t assuan_socket_connect (assuan_context_t *ctx, + const char *name, pid_t server_pid); - -/*-- assuan-domain-connect.c --*/ - -/* Connect to a Unix domain socket server. RENDEZVOUSFD is - bidirectional file descriptor (normally returned via socketpair) - which the client can use to rendezvous with the server. SERVER s - the server's pid. */ -assuan_error_t assuan_domain_connect (assuan_context_t *r_ctx, - int rendezvousfd, - pid_t server); - -/*-- assuan-domain-server.c --*/ - -/* RENDEZVOUSFD is a bidirectional file descriptor (normally returned - via socketpair) that the domain server can use to rendezvous with - the client. CLIENT is the client's pid. */ -assuan_error_t assuan_init_domain_server (assuan_context_t *r_ctx, - int rendezvousfd, - pid_t client); - +assuan_error_t assuan_socket_connect_ext (assuan_context_t *ctx, + const char *name, + pid_t server_pid, + unsigned int flags); /*-- assuan-connect.c --*/ void assuan_disconnect (assuan_context_t ctx); pid_t assuan_get_pid (assuan_context_t ctx); +assuan_error_t assuan_get_peercred (assuan_context_t ctx, + pid_t *pid, uid_t *uid, gid_t *gid); /*-- assuan-client.c --*/ assuan_error_t assuan_transact (assuan_context_t ctx, const char *command, - assuan_error_t (*data_cb)(void *, const void *, size_t), + int (*data_cb)(void *, const void *, size_t), void *data_cb_arg, - assuan_error_t (*inquire_cb)(void*, const char *), + int (*inquire_cb)(void*, const char *), void *inquire_cb_arg, - assuan_error_t (*status_cb)(void*, const char *), + int (*status_cb)(void*, const char *), void *status_cb_arg); @@ -426,9 +489,8 @@ assuan_error_t assuan_send_data (assuan_ const void *buffer, size_t length); /* The file descriptor must be pending before assuan_receivefd is - call. This means that assuan_sendfd should be called *before* the - trigger is sent (normally via assuan_send_data ("I sent you a - descriptor")). */ + called. This means that assuan_sendfd should be called *before* the + trigger is sent (normally via assuan_write_line ("INPUT FD")). */ assuan_error_t assuan_sendfd (assuan_context_t ctx, int fd); assuan_error_t assuan_receivefd (assuan_context_t ctx, int *fd); @@ -444,6 +506,12 @@ void *assuan_get_pointer (assuan_context void assuan_begin_confidential (assuan_context_t ctx); void assuan_end_confidential (assuan_context_t ctx); +void assuan_set_io_monitor (assuan_context_t ctx, + unsigned int (*monitor)(assuan_context_t ctx, + int direction, + const char *line, + size_t linelen)); + /* For context CTX, set the flag FLAG to VALUE. Values for flags are usually 1 or 0 but certain flags might allow for other values; see the description of the type assuan_flag_t for details. */ @@ -453,8 +521,20 @@ void assuan_set_flag (assuan_context_t c int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag); -/*-- assuan-errors.c (built) --*/ +/*-- assuan-errors.c --*/ + +#ifndef _ASSUAN_ONLY_GPG_ERRORS +/* Return a string describing the assuan error. The use of this + function is deprecated; it is better to call + assuan_set_assuan_err_source once and then make use libgpg-error. */ const char *assuan_strerror (assuan_error_t err); +#endif /*_ASSUAN_ONLY_GPG_ERRORS*/ + +/* Enable gpg-error style error codes. ERRSOURCE is one of gpg-error + sources. Note, that this function is not thread-safe and should be + used right at startup. Switching back to the old style mode is not + supported. */ +void assuan_set_assuan_err_source (int errsource); /*-- assuan-logging.c --*/ diff -urpNP gpgme-1.1.2/assuan/funopen.c gpgme-1.1.3/assuan/funopen.c --- gpgme-1.1.2/assuan/funopen.c 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/funopen.c 2007-01-29 20:16:19.000000000 +0000 @@ -1,21 +1,22 @@ /* funopen.c - Replacement for funopen. - * Copyright (C) 2003 Free Software Foundation, Inc. + * Copyright (C) 2003, 2005 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of Assuan. * - * GnuPG is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Assuan 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. * - * GnuPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Assuan 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 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 + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifdef HAVE_CONFIG_H @@ -54,7 +55,7 @@ _assuan_funopen(void *cookie, io.seek = seekfn; io.close = closefn; - return fopencookie (cookie, + return fopencookie (cookie, readfn ? ( writefn ? "rw" : "r" ) : ( writefn ? "w" : ""), io); } diff -urpNP gpgme-1.1.2/assuan/mkerrors gpgme-1.1.3/assuan/mkerrors --- gpgme-1.1.2/assuan/mkerrors 2005-09-08 14:42:30.000000000 +0000 +++ gpgme-1.1.3/assuan/mkerrors 2007-01-29 20:16:19.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # mkerrors - Extract error strings from assuan.h # and create C source for assuan_strerror -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of Assuan. # @@ -17,19 +17,119 @@ # # 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 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA cat < #endif #include +#include +#include + +#undef _ASSUAN_IN_LIBASSUAN /* undef to get all error codes. */ #include "assuan.h" +/* If true the modern gpg-error style error codes are used in the + API. */ +static unsigned int err_source; + +/* Enable gpg-error style error codes. ERRSOURCE is one of gpg-error + sources. Note, that this function is not thread-safe and should be + used right at startup. Switching back to the old style mode is not + supported. */ +void +assuan_set_assuan_err_source (int errsource) +{ + errsource &= 0xff; + err_source = errsource? errsource : 31 /*GPG_ERR_SOURCE_ANY*/; +} + + +/* Helper to map old style Assuan error codes to gpg-error codes. + This is used internally to keep an compatible ABI. */ +assuan_error_t +_assuan_error (int oldcode) +{ + unsigned int n; + + if (!err_source) + return (oldcode & 0x00ffffff); /* Make sure that the gpg-error + source part is cleared. */ + + switch (oldcode) + { + case ASSUAN_General_Error: n = 257; break; + case ASSUAN_Accept_Failed: n = 258; break; + case ASSUAN_Connect_Failed: n = 259; break; + case ASSUAN_Invalid_Response: n = 260; break; + case ASSUAN_Invalid_Value: n = 261; break; + case ASSUAN_Line_Not_Terminated: n = 262; break; + case ASSUAN_Line_Too_Long: n = 263; break; + case ASSUAN_Nested_Commands: n = 264; break; + case ASSUAN_No_Data_Callback: n = 265; break; + case ASSUAN_No_Inquire_Callback: n = 266; break; + case ASSUAN_Not_A_Server: n = 267; break; + case ASSUAN_Not_Implemented: n = 69; break; + case ASSUAN_Parameter_Conflict: n = 280; break; + case ASSUAN_Problem_Starting_Server: n = 269; break; + case ASSUAN_Server_Fault: n = 80; break; + case ASSUAN_Syntax_Error: n = 276; break; + case ASSUAN_Too_Much_Data: n = 273; break; + case ASSUAN_Unexpected_Command: n = 274; break; + case ASSUAN_Unknown_Command: n = 275; break; + case ASSUAN_Canceled: n = 277; break; + case ASSUAN_No_Secret_Key: n = 17; break; + case ASSUAN_Not_Confirmed: n = 114; break; + + case ASSUAN_Read_Error: + switch (errno) + { + case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break; + default: n = 270; /*GPG_ERR_ASS_READ_ERROR*/ break; + } + break; + + case ASSUAN_Write_Error: + switch (errno) + { + case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break; + default: n = 271; /*GPG_ERR_ASS_WRITE_ERROR*/ break; + } + break; + + case ASSUAN_Out_Of_Core: + switch (errno) + { + case 0: /* Should not happen but a user might have provided + an incomplete implemented malloc function. Give + him a chance to correct this fault but make sure + an error is indeed returned. */ + n = 16381; /*GPG_ERR_MISSING_ERRNO*/ + break; + case ENOMEM: n = (1 << 15) | 86; break; + default: + n = 16382; /*GPG_ERR_UNKNOWN_ERRNO*/ + break; + } + break; + + case -1: n = 16383 /*GPG_ERR_EOF*/; break; + + default: + n = 257; + break; + } + + return ((err_source << 24) | (n & 0x00ffffff)); + +} + + /** * assuan_strerror: * @err: Error code @@ -41,7 +141,7 @@ cat <> 24) & 0xff); code = (err & 0x00ffffff); - if (source) /* Assume this is an libgpg-error. */ - sprintf (buf, "ec=%u.%u", source, code ); + if (source) + { + /* Assume this is an libgpg-error and try to map the codes + back. */ + switch (code) + { + case 257: n = ASSUAN_General_Error ; break; + case 258: n = ASSUAN_Accept_Failed ; break; + case 259: n = ASSUAN_Connect_Failed ; break; + case 260: n = ASSUAN_Invalid_Response ; break; + case 261: n = ASSUAN_Invalid_Value ; break; + case 262: n = ASSUAN_Line_Not_Terminated ; break; + case 263: n = ASSUAN_Line_Too_Long ; break; + case 264: n = ASSUAN_Nested_Commands ; break; + case 265: n = ASSUAN_No_Data_Callback ; break; + case 266: n = ASSUAN_No_Inquire_Callback ; break; + case 267: n = ASSUAN_Not_A_Server ; break; + case 69: n = ASSUAN_Not_Implemented ; break; + case 280: n = ASSUAN_Parameter_Conflict ; break; + case 269: n = ASSUAN_Problem_Starting_Server; break; + case 270: n = ASSUAN_Read_Error ; break; + case 271: n = ASSUAN_Write_Error ; break; + case 80: n = ASSUAN_Server_Fault ; break; + case 276: n = ASSUAN_Syntax_Error ; break; + case 273: n = ASSUAN_Too_Much_Data ; break; + case 274: n = ASSUAN_Unexpected_Command ; break; + case 275: n = ASSUAN_Unknown_Command ; break; + case 277: n = ASSUAN_Canceled ; break; + case 114: n = ASSUAN_Not_Confirmed ; break; + case ((1<<15)|86): n = ASSUAN_Out_Of_Core ; break; + default: n = 0; break; + } + if (n) + s = assuan_strerror (n); + else + { + sprintf (buf, "ec=%u.%u", source, code ); + s=buf; + } + } else - sprintf (buf, "ec=%d", err ); - s=buf; break; + { + sprintf (buf, "ec=%d", err ); + s=buf; + } } + break; } return s; } -EOF \ No newline at end of file +EOF diff -urpNP gpgme-1.1.2/complus/Makefile.am gpgme-1.1.3/complus/Makefile.am --- gpgme-1.1.2/complus/Makefile.am 2005-09-08 14:42:29.000000000 +0000 +++ gpgme-1.1.3/complus/Makefile.am 2007-01-29 20:16:18.000000000 +0000 @@ -19,11 +19,11 @@ ## Process this file with automake to produce Makefile.in -# Because there is no free IDL compiler for OLE, we have to distribute -# a binary typelibrary. To generate a new one, copy the idl file to a -# system with an install MIDL and run the command -# midl /nocpp gpgcom.idl -# Sorry, there is no other way yet. +# Because WIDL does not yet fully support generation of typelibs, we +# have to distribute a binary type library. To generate a new one, +# copy the idl file to a system with an install MIDL and run the +# command "midl /nocpp gpgcom.idl". Sorry, there is no other way yet. + EXTRA_DIST = gpgcom.idl gpgcom.tlb gpgcom.rc vbtest.html vbtest.vbs README # No need to install this because we are cross-compiling anyway. diff -urpNP gpgme-1.1.2/complus/Makefile.in gpgme-1.1.3/complus/Makefile.in --- gpgme-1.1.2/complus/Makefile.in 2006-03-02 10:23:06.000000000 +0000 +++ gpgme-1.1.3/complus/Makefile.in 2007-01-29 20:16:59.000000000 +0000 @@ -33,6 +33,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# Because WIDL does not yet fully support generation of typelibs, we +# have to distribute a binary type library. To generate a new one, +# copy the idl file to a system with an install MIDL and run the +# command "midl /nocpp gpgcom.idl". Sorry, there is no other way yet. + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -179,6 +184,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -202,6 +208,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ @@ -250,12 +258,6 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - -# Because there is no free IDL compiler for OLE, we have to distribute -# a binary typelibrary. To generate a new one, copy the idl file to a -# system with an install MIDL and run the command -# midl /nocpp gpgcom.idl -# Sorry, there is no other way yet. EXTRA_DIST = gpgcom.idl gpgcom.tlb gpgcom.rc vbtest.html vbtest.vbs README INCLUDES = -I$(top_srcdir)/jnlib LDADD = ../gpgme/libgpgme.la -L ../jnlib -ljnlib -lole32 -loleaut32 diff -urpNP gpgme-1.1.2/config.h.in gpgme-1.1.3/config.h.in --- gpgme-1.1.2/config.h.in 2006-03-02 10:23:03.000000000 +0000 +++ gpgme-1.1.3/config.h.in 2007-01-29 20:16:49.000000000 +0000 @@ -12,6 +12,9 @@ /* Path to the GnuPG binary. */ #undef GPG_PATH +/* Defined if we are building with assuan support. */ +#undef HAVE_ASSUAN_H + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -52,6 +55,9 @@ /* Define to 1 if you have the `putc_unlocked' function. */ #undef HAVE_PUTC_UNLOCKED +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -151,6 +157,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Defined if descriptor passing is enabled and supported */ +#undef USE_DESCRIPTOR_PASSING + /* Version of this package */ #undef VERSION diff -urpNP gpgme-1.1.2/configure gpgme-1.1.3/configure --- gpgme-1.1.2/configure 2006-03-02 10:23:09.000000000 +0000 +++ gpgme-1.1.3/configure 2007-01-29 20:17:05.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for gpgme 1.1.2. +# Generated by GNU Autoconf 2.59 for gpgme 1.1.3. # # Report bugs to . # @@ -425,8 +425,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='gpgme' PACKAGE_TARNAME='gpgme' -PACKAGE_VERSION='1.1.2' -PACKAGE_STRING='gpgme 1.1.2' +PACKAGE_VERSION='1.1.3' +PACKAGE_STRING='gpgme 1.1.3' PACKAGE_BUGREPORT='bug-gpgme@gnupg.org' ac_unique_file="gpgme/gpgme.h" @@ -467,7 +467,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LIBGPGME_LT_CURRENT LIBGPGME_LT_AGE LIBGPGME_LT_REVISION RC ac_ct_RC EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL HAVE_LD_VERSION_SCRIPT_TRUE HAVE_LD_VERSION_SCRIPT_FALSE PTH_CPPFLAGS PTH_CFLAGS PTH_LDFLAGS PTH_LIBS HAVE_DOSISH_SYSTEM_TRUE HAVE_DOSISH_SYSTEM_FALSE HAVE_W32_SYSTEM_TRUE HAVE_W32_SYSTEM_FALSE PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS BUILD_W32_GLIB_TRUE BUILD_W32_GLIB_FALSE HAVE_PTH_TRUE HAVE_PTH_FALSE HAVE_PTHREAD_TRUE HAVE_PTHREAD_FALSE LIBOBJS GLIBC21 GPG_ERROR_CONFIG GPG_ERROR_CFLAGS GPG_ERROR_LIBS GPG RUN_GPG_TESTS_TRUE RUN_GPG_TESTS_FALSE GPG_PATH GPGSM HAVE_GPGSM_TRUE HAVE_GPGSM_FALSE RUN_GPGSM_TESTS_TRUE RUN_GPGSM_TESTS_FALSE BUILD_ASSUAN_TRUE BUILD_ASSUAN_FALSE BUILD_COMPLUS_TRUE BUILD_COMPLUS_FALSE BUILD_REVISION BUILD_TIMESTAMP BUILD_FILEVERSION GPGME_CONFIG_API_VERSION GPGME_CONFIG_LIBS GPGME_CONFIG_CFLAGS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LIBGPGME_LT_CURRENT LIBGPGME_LT_AGE LIBGPGME_LT_REVISION RC ac_ct_RC EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL HAVE_LD_VERSION_SCRIPT_TRUE HAVE_LD_VERSION_SCRIPT_FALSE PTH_CPPFLAGS PTH_CFLAGS PTH_LDFLAGS PTH_LIBS HAVE_DOSISH_SYSTEM_TRUE HAVE_DOSISH_SYSTEM_FALSE HAVE_W32_SYSTEM_TRUE HAVE_W32_SYSTEM_FALSE PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS BUILD_W32_GLIB_TRUE BUILD_W32_GLIB_FALSE HAVE_PTH_TRUE HAVE_PTH_FALSE HAVE_PTHREAD_TRUE HAVE_PTHREAD_FALSE NETLIBS LIBOBJS GLIBC21 GPG_ERROR_CONFIG GPG_ERROR_CFLAGS GPG_ERROR_LIBS GPG RUN_GPG_TESTS_TRUE RUN_GPG_TESTS_FALSE GPG_PATH GPGSM HAVE_GPGSM_TRUE HAVE_GPGSM_FALSE RUN_GPGSM_TESTS_TRUE RUN_GPGSM_TESTS_FALSE BUILD_ASSUAN_TRUE BUILD_ASSUAN_FALSE USE_DESCRIPTOR_PASSING_TRUE USE_DESCRIPTOR_PASSING_FALSE BUILD_COMPLUS_TRUE BUILD_COMPLUS_FALSE BUILD_REVISION BUILD_TIMESTAMP BUILD_FILEVERSION GPGME_CONFIG_API_VERSION GPGME_CONFIG_LIBS GPGME_CONFIG_CFLAGS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -956,7 +956,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gpgme 1.1.2 to adapt to many kinds of systems. +\`configure' configures gpgme 1.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gpgme 1.1.2:";; + short | recursive ) echo "Configuration of gpgme 1.1.3:";; esac cat <<\_ACEOF @@ -1043,6 +1043,9 @@ Optional Features: --disable-glibtest do not try to compile and run a test GLIB program --enable-w32-glib build GPGME Glib for W32 --disable-largefile omit support for large files + --disable-gpg-test disable GPG run test + --disable-gpgsm-test disable GPGSM run test + --enable-fd-passing use FD passing if supported Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1056,6 +1059,9 @@ Optional Packages: --with-pth-test Perform GNU Pth Sanity Test (default=yes) --with-gpg-error-prefix=PFX prefix where GPG Error is installed (optional) + --with-gpg-version=VER require GnuPG version VER + --with-gpgsm-version=VER + require GPGSM version VER --with-gpg=PATH use GnuPG binary at PATH --with-gpgsm=PATH use GpgSM binary at PATH @@ -1172,7 +1178,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -gpgme configure 1.1.2 +gpgme configure 1.1.3 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1186,7 +1192,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gpgme $as_me 1.1.2, which was +It was created by gpgme $as_me 1.1.3, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1533,13 +1539,10 @@ 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=1 +LIBGPGME_LT_REVISION=2 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 - -NEED_GPG_VERSION=1.2.2 -NEED_GPGSM_VERSION=1.9.6 ############################################## @@ -3179,16 +3182,6 @@ fi -cat >>confdefs.h <<_ACEOF -#define NEED_GPG_VERSION "$NEED_GPG_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define NEED_GPGSM_VERSION "$NEED_GPGSM_VERSION" -_ACEOF - - @@ -3836,7 +3829,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3839 "configure"' > conftest.$ac_ext + echo '#line 3832 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5642,7 +5635,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5645:" \ +echo "$as_me:5638:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6678,11 +6671,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6681: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6674: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6685: \$? = $ac_status" >&5 + echo "$as_me:6678: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6911,11 +6904,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6914: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6907: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6918: \$? = $ac_status" >&5 + echo "$as_me:6911: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6971,11 +6964,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6974: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6967: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6978: \$? = $ac_status" >&5 + echo "$as_me:6971: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9147,7 +9140,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11422: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11433: \$? = $ac_status" >&5 + echo "$as_me:11426: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11486,11 +11479,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11489: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11482: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11493: \$? = $ac_status" >&5 + echo "$as_me:11486: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12843,7 +12836,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13764: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13775: \$? = $ac_status" >&5 + echo "$as_me:13768: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13828,11 +13821,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13831: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13824: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13835: \$? = $ac_status" >&5 + echo "$as_me:13828: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15865,11 +15858,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15861: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15872: \$? = $ac_status" >&5 + echo "$as_me:15865: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16098,11 +16091,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16101: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16094: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16105: \$? = $ac_status" >&5 + echo "$as_me:16098: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16158,11 +16151,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16161: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16154: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16165: \$? = $ac_status" >&5 + echo "$as_me:16158: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18334,7 +18327,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 -echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6 -if test "${ac_cv_sys_largefile_source+set}" = set; then +# Network library fun. +echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - while :; do - ac_cv_sys_largefile_source=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () +/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" { -return !fseeko; - ; - return 0; +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus } -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +#endif -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define _LARGEFILE_SOURCE 1 -#include int main () { -return !fseeko; +return f != gethostbyname; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -21677,52 +21659,52 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_sys_largefile_source=1; break + ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - break -done -fi -echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5 -echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6 -if test "$ac_cv_sys_largefile_source" != no; then - -cat >>confdefs.h <<_ACEOF -#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source -_ACEOF - +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -rm -f conftest* - -# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug -# in glibc 2.1.3, but that breaks too many other things. -# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. -echo "$as_me:$LINENO: checking for fseeko" >&5 -echo $ECHO_N "checking for fseeko... $ECHO_C" >&6 -if test "${ac_cv_func_fseeko+set}" = set; then +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); int main () { -return fseeko && fseeko (stdin, 0, 0); +gethostbyname (); ; return 0; } @@ -21748,34 +21730,28 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_fseeko=yes + ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_fseeko=no +ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_func_fseeko" >&5 -echo "${ECHO_T}$ac_cv_func_fseeko" >&6 -if test $ac_cv_func_fseeko = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_FSEEKO 1 -_ACEOF - +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + NETLIBS="-lnsl $NETLIBS" fi +fi - -for ac_func in stpcpy -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -21784,12 +21760,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. +/* Define setsockopt to an innocuous variant, in case declares setsockopt. For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#define setsockopt innocuous_setsockopt /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. + which can conflict with char setsockopt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -21799,7 +21775,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include #endif -#undef $ac_func +#undef setsockopt /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -21808,14 +21784,14 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); +char setsockopt (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined (__stub_setsockopt) || defined (__stub___setsockopt) choke me #else -char (*f) () = $ac_func; +char (*f) () = setsockopt; #endif #ifdef __cplusplus } @@ -21824,7 +21800,7 @@ char (*f) () = $ac_func; int main () { -return f != $ac_func; +return f != setsockopt; ; return 0; } @@ -21850,83 +21826,46 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_func_setsockopt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_func_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - -for ac_func in vasprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then + : +else + echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - +char setsockopt (); int main () { -return f != $ac_func; +setsockopt (); ; return 0; } @@ -21952,53 +21891,329 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_lib_socket_setsockopt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_lib_socket_setsockopt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + NETLIBS="-lsocket $NETLIBS" fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; -esac fi -done -if test "$ac_cv_func_vasprintf" != yes; then - echo "$as_me:$LINENO: checking whether va_lists must be copied by value" >&5 -echo $ECHO_N "checking whether va_lists must be copied by value... $ECHO_C" >&6 - if test "${gnupg_cv_must_copy_va_byval+set}" = set; then + +# Checks for library functions. +echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - if test "$cross_compiling" = yes; then - gnupg_cv_must_copy_va_byval=no - else - gnupg_cv_must_copy_va_byval=no - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + while :; do + ac_cv_sys_largefile_source=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return !fseeko; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGEFILE_SOURCE 1 +#include +int +main () +{ +return !fseeko; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_source=1; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6 +if test "$ac_cv_sys_largefile_source" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +_ACEOF + +fi +rm -f conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +echo "$as_me:$LINENO: checking for fseeko" >&5 +echo $ECHO_N "checking for fseeko... $ECHO_C" >&6 +if test "${ac_cv_func_fseeko+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return fseeko && fseeko (stdin, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fseeko=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_fseeko=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_fseeko" >&5 +echo "${ECHO_T}$ac_cv_func_fseeko" >&6 +if test $ac_cv_func_fseeko = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FSEEKO 1 +_ACEOF + +fi + + + +for ac_func in vasprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac + +fi +done + + +if test "$ac_cv_func_vasprintf" != yes; then + echo "$as_me:$LINENO: checking whether va_lists must be copied by value" >&5 +echo $ECHO_N "checking whether va_lists must be copied by value... $ECHO_C" >&6 + if test "${gnupg_cv_must_copy_va_byval+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + gnupg_cv_must_copy_va_byval=no + else + gnupg_cv_must_copy_va_byval=no + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22524,7 +22739,7 @@ else echo "${ECHO_T}no" >&6 fi - min_gpg_error_version=0.5 + min_gpg_error_version=1.4 echo "$as_me:$LINENO: checking for GPG Error - version >= $min_gpg_error_version" >&5 echo $ECHO_N "checking for GPG Error - version >= $min_gpg_error_version... $ECHO_C" >&6 ok=no @@ -22575,6 +22790,47 @@ _ACEOF # Checks for system services +NEED_GPG_VERSION_DEFAULT=1.3.0 +NEED_GPGSM_VERSION_DEFAULT=1.9.6 +NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT" +NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT" + +# Check whether --with-gpg-version or --without-gpg-version was given. +if test "${with_gpg_version+set}" = set; then + withval="$with_gpg_version" + NEED_GPG_VERSION=$withval +fi; +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 + +# Check whether --with-gpgsm-version or --without-gpgsm-version was given. +if test "${with_gpgsm_version+set}" = set; then + withval="$with_gpgsm_version" + NEED_GPGSM_VERSION=$withval +fi; +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 + + +cat >>confdefs.h <<_ACEOF +#define NEED_GPG_VERSION "$NEED_GPG_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define NEED_GPGSM_VERSION "$NEED_GPGSM_VERSION" +_ACEOF + + + NO_OVERRIDE=no # Check whether --with-gpg or --without-gpg was given. @@ -22681,22 +22937,21 @@ echo "$as_me: WARNING: GnuPG not executa fi fi if test "$ok" = "maybe"; then - echo "$as_me:$LINENO: checking for GnuPG >= $NEED_GPG_VERSION" >&5 -echo $ECHO_N "checking for GnuPG >= $NEED_GPG_VERSION... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for GPG >= $NEED_GPG_VERSION" >&5 +echo $ECHO_N "checking for GPG >= $NEED_GPG_VERSION... $ECHO_C" >&6 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 | grep ^gpg` - major=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` - minor=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` - micro=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` - GPG_VERSION=`echo $gpg_version | sed 's/^gpg (GnuPG) //'` + 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 @@ -22719,13 +22974,19 @@ echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - { echo "$as_me:$LINENO: WARNING: GnuPG must be at least version $NEED_GPG_VERSION" >&5 -echo "$as_me: WARNING: GnuPG must be at least version $NEED_GPG_VERSION" >&2;} + { echo "$as_me:$LINENO: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&5 +echo "$as_me: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&2;} fi fi +run_gpg_test="$ok" +# Check whether --enable-gpg-test or --disable-gpg-test was given. +if test "${enable_gpg_test+set}" = set; then + enableval="$enable_gpg_test" + run_gpg_test=$enableval +fi; -if test "$ok" = "yes"; then +if test "$run_gpg_test" = "yes"; then RUN_GPG_TESTS_TRUE= RUN_GPG_TESTS_FALSE='#' else @@ -22865,14 +23126,13 @@ echo $ECHO_N "checking for GPGSM >= $NEE 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 | grep ^gpgsm` - major=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` - minor=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` - micro=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` - GPGSM_VERSION=`echo $gpgsm_version | sed 's/^gpgsm (GnuPG) //'` + 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 @@ -22899,35 +23159,274 @@ echo "${ECHO_T}no" >&6 echo "$as_me: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&2;} fi fi +run_gpgsm_test="$ok" +# Check whether --enable-gpgsm-test or --disable-gpgsm-test was given. +if test "${enable_gpgsm_test+set}" = set; then + enableval="$enable_gpgsm_test" + run_gpgsm_test=$enableval +fi; + + +if test "$run_gpgsm_test" = "yes"; then + RUN_GPGSM_TESTS_TRUE= + RUN_GPGSM_TESTS_FALSE='#' +else + RUN_GPGSM_TESTS_TRUE='#' + RUN_GPGSM_TESTS_FALSE= +fi + + + +# FIXME: Only build if supported. + + +if test "$GPGSM" != "no"; then + BUILD_ASSUAN_TRUE= + BUILD_ASSUAN_FALSE='#' +else + BUILD_ASSUAN_TRUE='#' + BUILD_ASSUAN_FALSE= +fi + +if test "$GPGSM" != "no"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ASSUAN_H +_ACEOF + +fi + +# The assuan code uses funopen but it will also build without it. So +# test for it. Frankly, this is not required in gpgme, but thats the +# way we handle it in libassuan. + +for ac_func in funopen +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done -if test "$ok" = "yes"; then - RUN_GPGSM_TESTS_TRUE= - RUN_GPGSM_TESTS_FALSE='#' +if test $ac_cv_func_funopen != yes; then + # No funopen but we can implement that in terms of fopencookie. + +for ac_func in fopencookie +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - RUN_GPGSM_TESTS_TRUE='#' - RUN_GPGSM_TESTS_FALSE= -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -# FIXME: Only build if supported. +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $ac_func -if test "$GPGSM" != "no"; then - BUILD_ASSUAN_TRUE= - BUILD_ASSUAN_FALSE='#' +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - BUILD_ASSUAN_TRUE='#' - BUILD_ASSUAN_FALSE= + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done + if test $ac_cv_func_fopencookie = yes; then + case $LIBOBJS in + "funopen.$ac_objext" | \ + *" funopen.$ac_objext" | \ + "funopen.$ac_objext "* | \ + *" funopen.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS funopen.$ac_objext" ;; +esac -# The assuan code uses funopen but it will also build without it. So -# test for it. Frankly, this is not required in gpgme, but thats the -# way we handle it in libassuan. + else + { echo "$as_me:$LINENO: WARNING: +*** +*** No implementation of fopencookie or funopen available +***" >&5 +echo "$as_me: WARNING: +*** +*** No implementation of fopencookie or funopen available +***" >&2;} + fi +fi -for ac_func in funopen +# More assuan replacement functions. + +for ac_func in isascii do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23024,13 +23523,21 @@ if test `eval echo '${'$as_ac_var'}'` = #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac + fi done -if test $ac_cv_func_funopen != yes; then - # No funopen but we can implement that in terms of fopencookie. -for ac_func in fopencookie + +for ac_func in putc_unlocked do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23127,33 +23634,21 @@ if test `eval echo '${'$as_ac_var'}'` = #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -fi -done - - if test $ac_cv_func_fopencookie = yes; then - case $LIBOBJS in - "funopen.$ac_objext" | \ - *" funopen.$ac_objext" | \ - "funopen.$ac_objext "* | \ - *" funopen.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS funopen.$ac_objext" ;; +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; esac - else - { echo "$as_me:$LINENO: WARNING: -*** -*** No implementation of fopencookie or funopen available -***" >&5 -echo "$as_me: WARNING: -*** -*** No implementation of fopencookie or funopen available -***" >&2;} - fi fi +done -# More assuan replacement functions. -for ac_func in isascii + +for ac_func in memrchr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23264,7 +23759,7 @@ done -for ac_func in putc_unlocked +for ac_func in stpcpy do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23323,9 +23818,86 @@ return f != $ac_func; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac + +fi +done + + +# Check for unistd.h for setenv replacement function. + +for ac_header in unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -23338,44 +23910,117 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +ac_header_compiler=no fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ---------------------------------- ## +## Report this to bug-gpgme@gnupg.org ## +## ---------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi -done +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi + +done -for ac_func in memrchr +for ac_func in setenv do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23637,6 +24282,179 @@ fi done +# Assuan check for descriptor passing. +echo "$as_me:$LINENO: checking for struct cmsghdr.cmsg_len" >&5 +echo $ECHO_N "checking for struct cmsghdr.cmsg_len... $ECHO_C" >&6 +if test "${ac_cv_member_struct_cmsghdr_cmsg_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +#include +#include +#include +#if HAVE_SYS_UIO_H +#include +#endif +#include + + +int +main () +{ +static struct cmsghdr ac_aggr; +if (ac_aggr.cmsg_len) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_cmsghdr_cmsg_len=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +#include +#include +#include +#if HAVE_SYS_UIO_H +#include +#endif +#include + + +int +main () +{ +static struct cmsghdr ac_aggr; +if (sizeof ac_aggr.cmsg_len) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_cmsghdr_cmsg_len=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_member_struct_cmsghdr_cmsg_len=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_cmsghdr_cmsg_len" >&5 +echo "${ECHO_T}$ac_cv_member_struct_cmsghdr_cmsg_len" >&6 +if test $ac_cv_member_struct_cmsghdr_cmsg_len = yes; then + supports_descriptor_passing=yes +else + supports_descriptor_passing=no + { echo "$as_me:$LINENO: WARNING: +*** +*** Data structure for sending ancillary data missing. +*** Descriptor passing won't work. +***" >&5 +echo "$as_me: WARNING: +*** +*** Data structure for sending ancillary data missing. +*** Descriptor passing won't work. +***" >&2;} +fi + + +# Check whether --enable-fd-passing or --disable-fd-passing was given. +if test "${enable_fd_passing+set}" = set; then + enableval="$enable_fd_passing" + use_descriptor_passing=$enableval +fi; + +if test "$supports_descriptor_passing" != "yes"; then + use_descriptor_passing=no +fi + +if test "$use_descriptor_passing" = "yes"; then + fd_passing=1 +else + fd_passing=0 +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_DESCRIPTOR_PASSING $fd_passing +_ACEOF + + + +if test "$use_descriptor_passing" = "yes"; then + USE_DESCRIPTOR_PASSING_TRUE= + USE_DESCRIPTOR_PASSING_FALSE='#' +else + USE_DESCRIPTOR_PASSING_TRUE='#' + USE_DESCRIPTOR_PASSING_FALSE= +fi + + # End of assuan checks. @@ -23678,7 +24496,7 @@ echo "$as_me: WARNING: fixed the GPGME_V # Generate values for the DLL version info -BUILD_REVISION="`echo '$Revision: 1163 $' | sed 's/[^0-9]//g'`" +BUILD_REVISION="`echo '$Revision: 1208 $' | sed 's/[^0-9]//g'`" test -z "$BUILD_REVISION" && BUILD_REVISION="0" if test "$have_w32_system" = yes; then BUILD_TIMESTAMP=`date --iso-8601=minutes` @@ -23716,6 +24534,8 @@ LTLIBOBJS=`echo "$LIBOBJS" | ac_config_files="$ac_config_files gpgme/gpgme-config" + ac_config_files="$ac_config_files lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -23905,6 +24725,13 @@ echo "$as_me: error: conditional \"BUILD Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${USE_DESCRIPTOR_PASSING_TRUE}" && test -z "${USE_DESCRIPTOR_PASSING_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USE_DESCRIPTOR_PASSING\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USE_DESCRIPTOR_PASSING\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${BUILD_COMPLUS_TRUE}" && test -z "${BUILD_COMPLUS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BUILD_COMPLUS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -24183,7 +25010,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by gpgme $as_me 1.1.2, which was +This file was extended by gpgme $as_me 1.1.3, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24246,7 +25073,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -gpgme config.status 1.1.2 +gpgme config.status 1.1.3 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -24366,6 +25193,9 @@ do "complus/Makefile" ) CONFIG_FILES="$CONFIG_FILES complus/Makefile" ;; "gpgme/versioninfo.rc" ) CONFIG_FILES="$CONFIG_FILES gpgme/versioninfo.rc" ;; "gpgme/gpgme-config" ) CONFIG_FILES="$CONFIG_FILES gpgme/gpgme-config" ;; + "lang/Makefile" ) CONFIG_FILES="$CONFIG_FILES lang/Makefile" ;; + "lang/cl/Makefile" ) CONFIG_FILES="$CONFIG_FILES lang/cl/Makefile" ;; + "lang/cl/gpgme.asd" ) CONFIG_FILES="$CONFIG_FILES lang/cl/gpgme.asd" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 @@ -24554,6 +25384,7 @@ s,@HAVE_PTH_TRUE@,$HAVE_PTH_TRUE,;t t s,@HAVE_PTH_FALSE@,$HAVE_PTH_FALSE,;t t s,@HAVE_PTHREAD_TRUE@,$HAVE_PTHREAD_TRUE,;t t s,@HAVE_PTHREAD_FALSE@,$HAVE_PTHREAD_FALSE,;t t +s,@NETLIBS@,$NETLIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@GLIBC21@,$GLIBC21,;t t s,@GPG_ERROR_CONFIG@,$GPG_ERROR_CONFIG,;t t @@ -24570,6 +25401,8 @@ s,@RUN_GPGSM_TESTS_TRUE@,$RUN_GPGSM_TEST s,@RUN_GPGSM_TESTS_FALSE@,$RUN_GPGSM_TESTS_FALSE,;t t s,@BUILD_ASSUAN_TRUE@,$BUILD_ASSUAN_TRUE,;t t s,@BUILD_ASSUAN_FALSE@,$BUILD_ASSUAN_FALSE,;t t +s,@USE_DESCRIPTOR_PASSING_TRUE@,$USE_DESCRIPTOR_PASSING_TRUE,;t t +s,@USE_DESCRIPTOR_PASSING_FALSE@,$USE_DESCRIPTOR_PASSING_FALSE,;t t s,@BUILD_COMPLUS_TRUE@,$BUILD_COMPLUS_TRUE,;t t s,@BUILD_COMPLUS_FALSE@,$BUILD_COMPLUS_FALSE,;t t s,@BUILD_REVISION@,$BUILD_REVISION,;t t diff -urpNP gpgme-1.1.2/configure.ac gpgme-1.1.3/configure.ac --- gpgme-1.1.2/configure.ac 2006-03-02 10:15:55.000000000 +0000 +++ gpgme-1.1.3/configure.ac 2007-01-29 20:16:20.000000000 +0000 @@ -1,6 +1,6 @@ # configure.ac for GPGME # Copyright (C) 2000 Werner Koch (dd9jn) -# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 g10 Code GmbH +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH # # This file is part of GPGME. # @@ -36,10 +36,10 @@ min_automake_version="1.9.3" # for snapshot releases please do an "svn up" right before recreating # the configure script, so that a proper revision number for all files # is available when running a "make distcheck". -m4_define(my_version, [1.1.2]) +m4_define(my_version, [1.1.3]) #m4_define(my_iscvs, yes) AC_INIT([gpgme], my_version[]m4_ifdef([my_iscvs], [-cvs[]m4_translit( - [$Revision: 1163 $],[Ra-z $:])]), + [$Revision: 1208 $],[Ra-z $:])]), [bug-gpgme@gnupg.org]) # LT Version numbers, remember to change them just *before* a release. @@ -52,13 +52,10 @@ 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=1 +LIBGPGME_LT_REVISION=2 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 - -NEED_GPG_VERSION=1.2.2 -NEED_GPGSM_VERSION=1.9.6 ############################################## @@ -90,10 +87,6 @@ AC_PROG_CC AC_SUBST(LIBGPGME_LT_CURRENT) AC_SUBST(LIBGPGME_LT_AGE) AC_SUBST(LIBGPGME_LT_REVISION) -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_SUBST(PACKAGE) AC_SUBST(VERSION) @@ -192,12 +185,16 @@ if test "$GCC" = yes; then 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_CHECK_FUNCS(stpcpy) - AC_REPLACE_FUNCS(vasprintf) if test "$ac_cv_func_vasprintf" != yes; then GNUPG_CHECK_VA_COPY @@ -242,13 +239,42 @@ if test "$ac_cv_func_timegm" != yes; the fi # Checking for libgpg-error. -AM_PATH_GPG_ERROR(0.5,, AC_MSG_ERROR([libgpg-error was not found])) +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_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT" +NEED_GPGSM_VERSION="$NEED_GPGSM_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_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.]) + + NO_OVERRIDE=no AC_ARG_WITH(gpg, AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]), @@ -298,21 +324,20 @@ else fi fi if test "$ok" = "maybe"; then - AC_MSG_CHECKING(for GnuPG >= $NEED_GPG_VERSION) + 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 | grep ^gpg` - major=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - GPG_VERSION=`echo $gpg_version | sed 's/^gpg (GnuPG) //'` + 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 @@ -333,10 +358,14 @@ if test "$ok" = "maybe"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) - AC_MSG_WARN([GnuPG must be at least version $NEED_GPG_VERSION]) + AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION]) fi fi -AM_CONDITIONAL(RUN_GPG_TESTS, test "$ok" = "yes") +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 @@ -398,14 +427,13 @@ if test "$ok" = "maybe"; then 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 | grep ^gpgsm` - major=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - GPGSM_VERSION=`echo $gpgsm_version | sed 's/^gpgsm (GnuPG) //'` + 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 @@ -429,11 +457,18 @@ if test "$ok" = "maybe"; then AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION]) fi fi -AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$ok" = "yes") +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") + # FIXME: Only build if supported. AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no") - +if test "$GPGSM" != "no"; then + AC_DEFINE(HAVE_ASSUAN_H, ,[Defined if we are building with assuan support.]) +fi # The assuan code uses funopen but it will also build without it. So # test for it. Frankly, this is not required in gpgme, but thats the @@ -456,10 +491,53 @@ fi 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 +#include +#include +#include +#include +#include +#if HAVE_SYS_UIO_H +#include +#endif +#include + ]) + +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 + fd_passing=1 +else + fd_passing=0 +fi + +AC_DEFINE_UNQUOTED(USE_DESCRIPTOR_PASSING, $fd_passing, + [Defined if descriptor passing is enabled and supported]) +AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes") + # End of assuan checks. AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+") @@ -470,7 +548,7 @@ GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPG # Generate values for the DLL version info changequote(,)dnl -BUILD_REVISION="`echo '$Revision: 1163 $' | sed 's/[^0-9]//g'`" +BUILD_REVISION="`echo '$Revision: 1208 $' | sed 's/[^0-9]//g'`" changequote([,])dnl test -z "$BUILD_REVISION" && BUILD_REVISION="0" if test "$have_w32_system" = yes; then @@ -537,6 +615,7 @@ AC_CONFIG_FILES(Makefile assuan/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 " diff -urpNP gpgme-1.1.2/doc/ChangeLog gpgme-1.1.3/doc/ChangeLog --- gpgme-1.1.2/doc/ChangeLog 2006-02-09 19:56:31.000000000 +0000 +++ gpgme-1.1.3/doc/ChangeLog 2007-01-29 20:16:20.000000000 +0000 @@ -1,3 +1,23 @@ +2006-11-01 Moritz Schulte + + * gpgme.texi (Data Buffer I/O Operations): Fixed entry for + gpgme_data_seek: OFFSET is not a pointer; some s/whence/offset/. + +2006-09-25 Marcus Brinkmann + + * gpgme.texi (Destroying Data Buffers): Clarify that + gpgme_data_release_and_get_mem destroys DH unconditionally. + +2005-03-24 Marcus Brinkmann + + * gpgme.texi (Library Version Check): Make example code compatible + to W32 systems. + +2006-06-21 Marcus Brinkmann + + * gpgme.texi (Passphrase Callback): Fix inverted condition in + description. + 2005-12-20 Werner Koch * gpgme.texi (Verify): Document pka_trust. diff -urpNP gpgme-1.1.2/doc/Makefile.in gpgme-1.1.3/doc/Makefile.in --- gpgme-1.1.2/doc/Makefile.in 2006-03-02 10:23:06.000000000 +0000 +++ gpgme-1.1.3/doc/Makefile.in 2007-01-29 20:16:59.000000000 +0000 @@ -168,6 +168,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -191,6 +192,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ diff -urpNP gpgme-1.1.2/doc/gpgme.texi gpgme-1.1.3/doc/gpgme.texi --- gpgme-1.1.2/doc/gpgme.texi 2006-02-09 19:56:31.000000000 +0000 +++ gpgme-1.1.3/doc/gpgme.texi 2007-01-29 20:16:20.000000000 +0000 @@ -609,13 +609,16 @@ init_program (void) setlocale (LC_ALL, ""); gpgme_check_version (NULL); gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); +#ifdef LC_MESSAGES gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif @} @end example Note that you are highly recommended to initialize the locale settings like this. @acronym{GPGME} can not do this for you because it would -not be thread safe. +not be thread safe. The conditional on LC_MESSAGES is only necessary +for portability to W32 systems. @node Signal Handling @@ -1716,7 +1719,8 @@ the user provided the data buffer in non made for this purpose. In case an error returns, or there is no suitable data buffer that can -be returned to the user, the function will return @code{NULL}. +be returned to the user, the function will return @code{NULL}. In any +case, the data object @var{dh} is destroyed. @end deftypefun @@ -1769,7 +1773,7 @@ The function returns the number of bytes error occurs. If an error occurs, @var{errno} is set. @end deftypefun -@deftypefun off_t gpgme_data_seek (@w{gpgme_data_t @var{dh}}, @w{off_t *@var{offset}}, @w{int @var{whence}}) +@deftypefun off_t gpgme_data_seek (@w{gpgme_data_t @var{dh}}, @w{off_t @var{offset}}, @w{int @var{whence}}) The function @code{gpgme_data_seek} changes the current read/write position. @@ -1778,15 +1782,15 @@ interpreted. It must be one of the foll @table @code @item SEEK_SET -Specifies that @var{whence} is a count of characters from the +Specifies that @var{offset} is a count of characters from the beginning of the data object. @item SEEK_CUR -Specifies that @var{whence} is a count of characters from the current +Specifies that @var{offset} is a count of characters from the current file position. This count may be positive or negative. @item SEEK_END -Specifies that @var{whence} is a count of characters from the end of +Specifies that @var{offset} is a count of characters from the end of the data object. A negative count specifies a position within the current extent of the data object; a positive count specifies a position past the current end. If you set the position past the @@ -2210,9 +2214,9 @@ previous attempts failed, then @var{prev will be 0. The user must write the passphrase, followed by a newline character, -to the file descriptor @var{fd}. If the user does not return 0 -indicating success, the user must at least write a newline character -before returning from the callback. +to the file descriptor @var{fd}. If the user returns 0 indicating +success, the user must at least write a newline character before +returning from the callback. If an error occurs, return the corresponding @code{gpgme_error_t} value. You can use the error code @code{GPG_ERR_CANCELED} to abort diff -urpNP gpgme-1.1.2/doc/stamp-vti gpgme-1.1.3/doc/stamp-vti --- gpgme-1.1.2/doc/stamp-vti 2006-03-02 10:24:40.000000000 +0000 +++ gpgme-1.1.3/doc/stamp-vti 2007-01-29 20:17:55.000000000 +0000 @@ -1,4 +1,4 @@ -@set UPDATED 9 February 2006 -@set UPDATED-MONTH February 2006 -@set EDITION 1.1.2 -@set VERSION 1.1.2 +@set UPDATED 29 January 2007 +@set UPDATED-MONTH January 2007 +@set EDITION 1.1.3 +@set VERSION 1.1.3 diff -urpNP gpgme-1.1.2/doc/version.texi gpgme-1.1.3/doc/version.texi --- gpgme-1.1.2/doc/version.texi 2006-03-02 10:24:40.000000000 +0000 +++ gpgme-1.1.3/doc/version.texi 2007-01-29 20:17:55.000000000 +0000 @@ -1,4 +1,4 @@ -@set UPDATED 9 February 2006 -@set UPDATED-MONTH February 2006 -@set EDITION 1.1.2 -@set VERSION 1.1.2 +@set UPDATED 29 January 2007 +@set UPDATED-MONTH January 2007 +@set EDITION 1.1.3 +@set VERSION 1.1.3 diff -urpNP gpgme-1.1.2/gpgme/ChangeLog gpgme-1.1.3/gpgme/ChangeLog --- gpgme-1.1.2/gpgme/ChangeLog 2006-02-28 16:30:38.000000000 +0000 +++ gpgme-1.1.3/gpgme/ChangeLog 2007-01-29 20:16:19.000000000 +0000 @@ -1,3 +1,194 @@ +2007-01-26 Werner Koch + + * 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 + + * 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 + + * w32-io.c (build_commandline): Quote all command line arguments. + * w32-glib-io.c (build_commandline): Likewise. + +2007-01-10 Werner Koch + + * ttyname_r.c (ttyname_r) [W32]: Return a dummy name. + +2007-01-08 Werner Koch + + * 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 + + * 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 + + * 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 + + * version.c: Include "assuan.h". + (do_subsystem_inits): Call assuan_set_assuan_err_source. + +2006-12-01 Marcus Brinkmann + + * 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 + + * engine-gpgsm.c: Replace AssuanError with gpg_error_t and + ASSUAN_CONTEXT with assuan_context_t. + +2006-11-29 Marcus Brinkmann + + * engine-gpgsm.c (gpgsm_new): Check return value of + assuan_pipe_connect. + + * rungpg.c: Include . + (gpg_new): Support --display, --ttyname, --ttytype, --lc-ctype and + --lc-messages. Fixes issue 734. + +2006-10-24 Marcus Brinkmann + + * trustlist.c (gpgme_op_trustlist_next): Return error if OPD is + NULL. + +2006-10-23 Marcus Brinkmann + + * 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 + + * data-mem.c (gpgme_data_release_and_get_mem): Release the data + object properly. + +2006-09-22 Marcus Brinkmann + + * keylist.c (keylist_colon_handler): Move debug output after + initialising KEY. + +2006-07-29 Marcus Brinkmann + + * 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 + + * gpgme.c (gpgme_set_locale): Remove conditional on + HAVE_W32_SYSTEM, and just check for LC_MESSAGES. + +2006-07-16 Marcus Brinkmann + + * 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 + + * keylist.c (gpgme_get_key): Also clone the engine info. + +2006-03-06 Marcus Brinkmann + + * gpgme-config.in (cflags_pth): Revert accidential removal of + pthread support with last change. + 2006-02-28 Marcus Brinkmann * w32-glib-io.c (O_BINARY) [!O_BINARY]: New macro. diff -urpNP gpgme-1.1.2/gpgme/Makefile.am gpgme-1.1.3/gpgme/Makefile.am --- gpgme-1.1.2/gpgme/Makefile.am 2005-11-18 23:03:28.000000000 +0000 +++ gpgme-1.1.3/gpgme/Makefile.am 2007-01-29 20:16:20.000000000 +0000 @@ -45,7 +45,6 @@ else ltlib_gpgme_extra = endif -noinst_LTLIBRARIES = libgpgme-real.la lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_extra) \ $(ltlib_gpgme_pthread) $(ltlib_gpgme_pth) @@ -77,7 +76,12 @@ else gpgsm_components = endif -libgpgme_real_la_SOURCES = \ +# 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 \ @@ -92,17 +96,21 @@ libgpgme_real_la_SOURCES = \ $(gpgsm_components) sema.h priv-io.h $(system_components) \ debug.c debug.h gpgme.c version.c error.c -libgpgme_la_SOURCES = ath.h ath.c $(system_components_not_extra) -libgpgme_pthread_la_SOURCES = \ +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 = ath.h ath-pth.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 = ath.h ath.c w32-glib-io.c +libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c endif -AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@ - +# 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@ +AM_CFLAGS = @PTH_CFLAGS@ @GLIB_CFLAGS@ if HAVE_W32_SYSTEM @@ -141,37 +149,34 @@ 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 = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps) -libgpgme_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - @GPG_ERROR_LIBS@ +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 = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_pthread_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pthread_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - -lpthread @GPG_ERROR_LIBS@ +libgpgme_pthread_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \ + -lpthread @GPG_ERROR_LIBS@ @NETLIBS@ -libgpgme_pth_la_CFLAGS = $(AM_CFLAGS) @PTH_CFLAGS@ -libgpgme_pth_la_CPPFLAGS = $(AM_CPPFLAGS) @PTH_CPPFLAGS@ 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 = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_pth_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pth_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - @PTH_LIBS@ @GPG_ERROR_LIBS@ +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_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ -libgpgme_glib_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_glib_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps) -libgpgme_glib_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - @GPG_ERROR_LIBS@ @GLIB_LIBS@ +libgpgme_glib_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \ + @GPG_ERROR_LIBS@ @GLIB_LIBS@ @NETLIBS@ endif status-table.h : gpgme.h diff -urpNP gpgme-1.1.2/gpgme/Makefile.in gpgme-1.1.3/gpgme/Makefile.in --- gpgme-1.1.2/gpgme/Makefile.in 2006-03-02 10:23:06.000000000 +0000 +++ gpgme-1.1.3/gpgme/Makefile.in 2007-01-29 20:17:00.000000000 +0000 @@ -43,7 +43,8 @@ subdir = gpgme DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/gpgme-config.in \ $(srcdir)/versioninfo.rc.in ChangeLog funopen.c isascii.c \ - memrchr.c putc_unlocked.c ttyname_r.c vasprintf.c + memrchr.c putc_unlocked.c setenv.c stpcpy.c ttyname_r.c \ + vasprintf.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gpg-error.m4 \ @@ -63,27 +64,53 @@ am__strip_dir = `echo $$p | sed -e 's|^. am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(includedir)" libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +LTLIBRARIES = $(lib_LTLIBRARIES) @BUILD_ASSUAN_TRUE@am__DEPENDENCIES_1 = ../assuan/libassuan.la -am__libgpgme_glib_la_SOURCES_DIST = ath.h ath.c w32-glib-io.c -@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = \ -@BUILD_W32_GLIB_TRUE@ libgpgme_glib_la-ath.lo \ -@BUILD_W32_GLIB_TRUE@ libgpgme_glib_la-w32-glib-io.lo +am__libgpgme_glib_la_SOURCES_DIST = 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 engine.h engine-backend.h engine.c rungpg.c \ + status-table.h engine-gpgsm.c sema.h priv-io.h ath.h \ + posix-util.c posix-sema.c posix-io.c w32-util.c w32-sema.c \ + debug.c debug.h gpgme.c version.c error.c ath.c w32-glib-io.c +@HAVE_GPGSM_TRUE@am__objects_1 = engine-gpgsm.lo +@HAVE_DOSISH_SYSTEM_FALSE@am__objects_2 = posix-util.lo posix-sema.lo \ +@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo +@HAVE_DOSISH_SYSTEM_TRUE@am__objects_2 = w32-util.lo w32-sema.lo +am__objects_3 = conversion.lo get-env.lo data.lo data-fd.lo \ + data-stream.lo data-mem.lo data-user.lo data-compat.lo \ + signers.lo sig-notation.lo wait.lo wait-global.lo \ + wait-private.lo wait-user.lo op-support.lo encrypt.lo \ + encrypt-sign.lo decrypt.lo decrypt-verify.lo verify.lo sign.lo \ + passphrase.lo progress.lo key.lo keylist.lo trust-item.lo \ + trustlist.lo import.lo export.lo genkey.lo delete.lo edit.lo \ + engine.lo rungpg.lo $(am__objects_1) $(am__objects_2) debug.lo \ + gpgme.lo version.lo error.lo +@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = $(am__objects_3) \ +@BUILD_W32_GLIB_TRUE@ ath.lo w32-glib-io.lo libgpgme_glib_la_OBJECTS = $(am_libgpgme_glib_la_OBJECTS) @BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_rpath = -rpath $(libdir) -am__libgpgme_pth_la_SOURCES_DIST = ath.h ath-pth.c w32-io.c -@HAVE_DOSISH_SYSTEM_TRUE@am__objects_1 = libgpgme_pth_la-w32-io.lo -am_libgpgme_pth_la_OBJECTS = libgpgme_pth_la-ath-pth.lo \ - $(am__objects_1) +am__libgpgme_pth_la_SOURCES_DIST = 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 engine.h engine-backend.h engine.c rungpg.c \ + status-table.h engine-gpgsm.c sema.h priv-io.h ath.h \ + posix-util.c posix-sema.c posix-io.c w32-util.c w32-sema.c \ + debug.c debug.h gpgme.c version.c error.c ath-pth.c w32-io.c +@HAVE_DOSISH_SYSTEM_TRUE@am__objects_4 = w32-io.lo +am_libgpgme_pth_la_OBJECTS = $(am__objects_3) ath-pth.lo \ + $(am__objects_4) libgpgme_pth_la_OBJECTS = $(am_libgpgme_pth_la_OBJECTS) @HAVE_PTH_TRUE@am_libgpgme_pth_la_rpath = -rpath $(libdir) -am__libgpgme_pthread_la_SOURCES_DIST = ath.h ath-pthread.c w32-io.c -@HAVE_DOSISH_SYSTEM_TRUE@am__objects_2 = w32-io.lo -am_libgpgme_pthread_la_OBJECTS = ath-pthread.lo $(am__objects_2) -libgpgme_pthread_la_OBJECTS = $(am_libgpgme_pthread_la_OBJECTS) -@HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir) -libgpgme_real_la_LIBADD = -am__libgpgme_real_la_SOURCES_DIST = gpgme.h util.h conversion.c \ +am__libgpgme_pthread_la_SOURCES_DIST = 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 \ @@ -93,23 +120,24 @@ am__libgpgme_real_la_SOURCES_DIST = gpgm delete.c edit.c engine.h engine-backend.h engine.c rungpg.c \ status-table.h engine-gpgsm.c sema.h priv-io.h ath.h \ posix-util.c posix-sema.c posix-io.c w32-util.c w32-sema.c \ - debug.c debug.h gpgme.c version.c error.c -@HAVE_GPGSM_TRUE@am__objects_3 = engine-gpgsm.lo -@HAVE_DOSISH_SYSTEM_FALSE@am__objects_4 = posix-util.lo posix-sema.lo \ -@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo -@HAVE_DOSISH_SYSTEM_TRUE@am__objects_4 = w32-util.lo w32-sema.lo -am_libgpgme_real_la_OBJECTS = conversion.lo get-env.lo data.lo \ - data-fd.lo data-stream.lo data-mem.lo data-user.lo \ - data-compat.lo signers.lo sig-notation.lo wait.lo \ - wait-global.lo wait-private.lo wait-user.lo op-support.lo \ - encrypt.lo encrypt-sign.lo decrypt.lo decrypt-verify.lo \ - verify.lo sign.lo passphrase.lo progress.lo key.lo keylist.lo \ - trust-item.lo trustlist.lo import.lo export.lo genkey.lo \ - delete.lo edit.lo engine.lo rungpg.lo $(am__objects_3) \ - $(am__objects_4) debug.lo gpgme.lo version.lo error.lo -libgpgme_real_la_OBJECTS = $(am_libgpgme_real_la_OBJECTS) -am__libgpgme_la_SOURCES_DIST = ath.h ath.c w32-io.c -am_libgpgme_la_OBJECTS = ath.lo $(am__objects_2) + debug.c debug.h gpgme.c version.c error.c ath-pthread.c \ + w32-io.c +am_libgpgme_pthread_la_OBJECTS = $(am__objects_3) ath-pthread.lo \ + $(am__objects_4) +libgpgme_pthread_la_OBJECTS = $(am_libgpgme_pthread_la_OBJECTS) +@HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir) +am__libgpgme_la_SOURCES_DIST = 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 engine.h engine-backend.h engine.c rungpg.c \ + status-table.h engine-gpgsm.c sema.h priv-io.h ath.h \ + posix-util.c posix-sema.c posix-io.c w32-util.c w32-sema.c \ + debug.c debug.h gpgme.c version.c error.c ath.c w32-io.c +am_libgpgme_la_OBJECTS = $(am__objects_3) ath.lo $(am__objects_4) libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS) binSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(bin_SCRIPTS) @@ -125,12 +153,10 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libgpgme_glib_la_SOURCES) $(libgpgme_pth_la_SOURCES) \ - $(libgpgme_pthread_la_SOURCES) $(libgpgme_real_la_SOURCES) \ - $(libgpgme_la_SOURCES) + $(libgpgme_pthread_la_SOURCES) $(libgpgme_la_SOURCES) DIST_SOURCES = $(am__libgpgme_glib_la_SOURCES_DIST) \ $(am__libgpgme_pth_la_SOURCES_DIST) \ $(am__libgpgme_pthread_la_SOURCES_DIST) \ - $(am__libgpgme_real_la_SOURCES_DIST) \ $(am__libgpgme_la_SOURCES_DIST) m4dataDATA_INSTALL = $(INSTALL_DATA) DATA = $(m4data_DATA) @@ -223,6 +249,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -246,6 +273,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ @@ -326,7 +355,6 @@ include_HEADERS = gpgme.h @HAVE_PTH_TRUE@ltlib_gpgme_pth = libgpgme-pth.la @BUILD_W32_GLIB_FALSE@ltlib_gpgme_extra = @BUILD_W32_GLIB_TRUE@ltlib_gpgme_extra = libgpgme-glib.la -noinst_LTLIBRARIES = libgpgme-real.la lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_extra) \ $(ltlib_gpgme_pthread) $(ltlib_gpgme_pth) @@ -342,7 +370,13 @@ lib_LTLIBRARIES = libgpgme.la $(ltlib_gp @HAVE_DOSISH_SYSTEM_TRUE@system_components_not_extra = w32-io.c @HAVE_GPGSM_FALSE@gpgsm_components = @HAVE_GPGSM_TRUE@gpgsm_components = engine-gpgsm.c -libgpgme_real_la_SOURCES = \ + +# 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 \ @@ -357,13 +391,21 @@ libgpgme_real_la_SOURCES = \ $(gpgsm_components) sema.h priv-io.h $(system_components) \ debug.c debug.h gpgme.c version.c error.c -libgpgme_la_SOURCES = ath.h ath.c $(system_components_not_extra) -libgpgme_pthread_la_SOURCES = \ +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 = ath.h ath-pth.c $(system_components_not_extra) -@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_SOURCES = ath.h ath.c w32-glib-io.c -AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@ +libgpgme_pth_la_SOURCES = $(main_sources) \ + ath.h ath-pth.c $(system_components_not_extra) + +@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c + +# 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@ +AM_CFLAGS = @PTH_CFLAGS@ @GLIB_CFLAGS@ @HAVE_W32_SYSTEM_TRUE@LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \ @HAVE_W32_SYSTEM_TRUE@ `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \ @HAVE_W32_SYSTEM_TRUE@ sed -e 's/-I/--include-dir /g;s/-D/--define /g'` @@ -382,43 +424,40 @@ libgpgme_la_LDFLAGS = $(gpgme_res_ldflag $(libgpgme_version_script_cmd) -version-info \ @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ -libgpgme_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps) -libgpgme_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - @GPG_ERROR_LIBS@ +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 = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_pthread_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pthread_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - -lpthread @GPG_ERROR_LIBS@ +libgpgme_pthread_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \ + -lpthread @GPG_ERROR_LIBS@ @NETLIBS@ -libgpgme_pth_la_CFLAGS = $(AM_CFLAGS) @PTH_CFLAGS@ -libgpgme_pth_la_CPPFLAGS = $(AM_CPPFLAGS) @PTH_CPPFLAGS@ 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 = libgpgme-real.la $(assuan_libobjs) \ +libgpgme_pth_la_DEPENDENCIES = $(assuan_libobjs) \ @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pth_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ - @PTH_LIBS@ @GPG_ERROR_LIBS@ +libgpgme_pth_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \ + @PTH_LIBS@ @GPG_ERROR_LIBS@ @NETLIBS@ @BUILD_W32_GLIB_TRUE@libgpgme_glib_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) \ @BUILD_W32_GLIB_TRUE@ $(export_symbols) $(libgpgme_version_script_cmd) -version-info \ @BUILD_W32_GLIB_TRUE@ @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ -@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ -@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_DEPENDENCIES = libgpgme-real.la $(assuan_libobjs) \ +@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_DEPENDENCIES = $(assuan_libobjs) \ @BUILD_W32_GLIB_TRUE@ @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps) -@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ -@BUILD_W32_GLIB_TRUE@ @GPG_ERROR_LIBS@ @GLIB_LIBS@ +@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \ +@BUILD_W32_GLIB_TRUE@ @GPG_ERROR_LIBS@ @GLIB_LIBS@ @NETLIBS@ all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -485,23 +524,12 @@ clean-libLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done libgpgme-glib.la: $(libgpgme_glib_la_OBJECTS) $(libgpgme_glib_la_DEPENDENCIES) $(LINK) $(am_libgpgme_glib_la_rpath) $(libgpgme_glib_la_LDFLAGS) $(libgpgme_glib_la_OBJECTS) $(libgpgme_glib_la_LIBADD) $(LIBS) libgpgme-pth.la: $(libgpgme_pth_la_OBJECTS) $(libgpgme_pth_la_DEPENDENCIES) $(LINK) $(am_libgpgme_pth_la_rpath) $(libgpgme_pth_la_LDFLAGS) $(libgpgme_pth_la_OBJECTS) $(libgpgme_pth_la_LIBADD) $(LIBS) libgpgme-pthread.la: $(libgpgme_pthread_la_OBJECTS) $(libgpgme_pthread_la_DEPENDENCIES) $(LINK) $(am_libgpgme_pthread_la_rpath) $(libgpgme_pthread_la_LDFLAGS) $(libgpgme_pthread_la_OBJECTS) $(libgpgme_pthread_la_LIBADD) $(LIBS) -libgpgme-real.la: $(libgpgme_real_la_OBJECTS) $(libgpgme_real_la_DEPENDENCIES) - $(LINK) $(libgpgme_real_la_LDFLAGS) $(libgpgme_real_la_OBJECTS) $(libgpgme_real_la_LIBADD) $(LIBS) libgpgme.la: $(libgpgme_la_OBJECTS) $(libgpgme_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgpgme_la_LDFLAGS) $(libgpgme_la_OBJECTS) $(libgpgme_la_LIBADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @@ -534,8 +562,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/isascii.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memrchr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/putc_unlocked.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/setenv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stpcpy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ttyname_r.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath-pth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath-pthread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversion.Plo@am__quote@ @@ -562,10 +593,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/import.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgpgme_glib_la-ath.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgpgme_glib_la-w32-glib-io.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgpgme_pth_la-ath-pth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgpgme_pth_la-w32-io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-support.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passphrase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-io.Plo@am__quote@ @@ -580,6 +607,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trustlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-glib-io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-sema.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-util.Plo@am__quote@ @@ -609,34 +637,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libgpgme_glib_la-ath.lo: ath.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgpgme_glib_la_CFLAGS) $(CFLAGS) -MT libgpgme_glib_la-ath.lo -MD -MP -MF "$(DEPDIR)/libgpgme_glib_la-ath.Tpo" -c -o libgpgme_glib_la-ath.lo `test -f 'ath.c' || echo '$(srcdir)/'`ath.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgpgme_glib_la-ath.Tpo" "$(DEPDIR)/libgpgme_glib_la-ath.Plo"; else rm -f "$(DEPDIR)/libgpgme_glib_la-ath.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ath.c' object='libgpgme_glib_la-ath.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgpgme_glib_la_CFLAGS) $(CFLAGS) -c -o libgpgme_glib_la-ath.lo `test -f 'ath.c' || echo '$(srcdir)/'`ath.c - -libgpgme_glib_la-w32-glib-io.lo: w32-glib-io.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgpgme_glib_la_CFLAGS) $(CFLAGS) -MT libgpgme_glib_la-w32-glib-io.lo -MD -MP -MF "$(DEPDIR)/libgpgme_glib_la-w32-glib-io.Tpo" -c -o libgpgme_glib_la-w32-glib-io.lo `test -f 'w32-glib-io.c' || echo '$(srcdir)/'`w32-glib-io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgpgme_glib_la-w32-glib-io.Tpo" "$(DEPDIR)/libgpgme_glib_la-w32-glib-io.Plo"; else rm -f "$(DEPDIR)/libgpgme_glib_la-w32-glib-io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w32-glib-io.c' object='libgpgme_glib_la-w32-glib-io.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgpgme_glib_la_CFLAGS) $(CFLAGS) -c -o libgpgme_glib_la-w32-glib-io.lo `test -f 'w32-glib-io.c' || echo '$(srcdir)/'`w32-glib-io.c - -libgpgme_pth_la-ath-pth.lo: ath-pth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgpgme_pth_la_CPPFLAGS) $(CPPFLAGS) $(libgpgme_pth_la_CFLAGS) $(CFLAGS) -MT libgpgme_pth_la-ath-pth.lo -MD -MP -MF "$(DEPDIR)/libgpgme_pth_la-ath-pth.Tpo" -c -o libgpgme_pth_la-ath-pth.lo `test -f 'ath-pth.c' || echo '$(srcdir)/'`ath-pth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgpgme_pth_la-ath-pth.Tpo" "$(DEPDIR)/libgpgme_pth_la-ath-pth.Plo"; else rm -f "$(DEPDIR)/libgpgme_pth_la-ath-pth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ath-pth.c' object='libgpgme_pth_la-ath-pth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgpgme_pth_la_CPPFLAGS) $(CPPFLAGS) $(libgpgme_pth_la_CFLAGS) $(CFLAGS) -c -o libgpgme_pth_la-ath-pth.lo `test -f 'ath-pth.c' || echo '$(srcdir)/'`ath-pth.c - -libgpgme_pth_la-w32-io.lo: w32-io.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgpgme_pth_la_CPPFLAGS) $(CPPFLAGS) $(libgpgme_pth_la_CFLAGS) $(CFLAGS) -MT libgpgme_pth_la-w32-io.lo -MD -MP -MF "$(DEPDIR)/libgpgme_pth_la-w32-io.Tpo" -c -o libgpgme_pth_la-w32-io.lo `test -f 'w32-io.c' || echo '$(srcdir)/'`w32-io.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgpgme_pth_la-w32-io.Tpo" "$(DEPDIR)/libgpgme_pth_la-w32-io.Plo"; else rm -f "$(DEPDIR)/libgpgme_pth_la-w32-io.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='w32-io.c' object='libgpgme_pth_la-w32-io.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgpgme_pth_la_CPPFLAGS) $(CPPFLAGS) $(libgpgme_pth_la_CFLAGS) $(CFLAGS) -c -o libgpgme_pth_la-w32-io.lo `test -f 'w32-io.c' || echo '$(srcdir)/'`w32-io.c - mostlyclean-libtool: -rm -f *.lo @@ -794,7 +794,7 @@ maintainer-clean-generic: clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-noinstLTLIBRARIES mostlyclean-am + mostlyclean-am distclean: distclean-am -rm -rf $(DEPDIR) ./$(DEPDIR) @@ -846,11 +846,11 @@ uninstall-am: uninstall-binSCRIPTS unins uninstall-m4dataDATA .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binSCRIPTS \ - install-data install-data-am install-data-local install-exec \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-data-local install-exec \ install-exec-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-m4dataDATA \ install-man install-strip installcheck installcheck-am \ diff -urpNP gpgme-1.1.2/gpgme/data-fd.c gpgme-1.1.3/gpgme/data-fd.c --- gpgme-1.1.2/gpgme/data-fd.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/data-fd.c 2007-01-29 20:16:19.000000000 +0000 @@ -49,12 +49,20 @@ fd_seek (gpgme_data_t dh, off_t offset, } +static int +fd_get_fd (gpgme_data_t dh) +{ + return (dh->data.fd); +} + + static struct _gpgme_data_cbs fd_cbs = { fd_read, fd_write, fd_seek, - NULL + NULL, + fd_get_fd }; diff -urpNP gpgme-1.1.2/gpgme/data-mem.c gpgme-1.1.3/gpgme/data-mem.c --- gpgme-1.1.2/gpgme/data-mem.c 2005-10-06 10:06:15.000000000 +0000 +++ gpgme-1.1.3/gpgme/data-mem.c 2007-01-29 20:16:20.000000000 +0000 @@ -157,7 +157,8 @@ static struct _gpgme_data_cbs mem_cbs = mem_read, mem_write, mem_seek, - mem_release + mem_release, + NULL }; @@ -210,20 +211,32 @@ gpgme_data_release_and_get_mem (gpgme_da char *str = NULL; if (!dh || dh->cbs != &mem_cbs) - return NULL; + { + gpgme_data_release (dh); + return NULL; + } str = dh->data.mem.buffer; if (!str && dh->data.mem.orig_buffer) { str = malloc (dh->data.mem.length); if (!str) - return NULL; + { + gpgme_data_release (dh); + return NULL; + } memcpy (str, dh->data.mem.orig_buffer, dh->data.mem.length); } + else + /* Prevent mem_release from releasing the buffer memory. We must + not fail from this point. */ + dh->data.mem.buffer = NULL; if (r_len) *r_len = dh->data.mem.length; + gpgme_data_release (dh); + return str; } diff -urpNP gpgme-1.1.2/gpgme/data-stream.c gpgme-1.1.3/gpgme/data-stream.c --- gpgme-1.1.2/gpgme/data-stream.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/data-stream.c 2007-01-29 20:16:19.000000000 +0000 @@ -71,12 +71,21 @@ stream_seek (gpgme_data_t dh, off_t offs } +static int +stream_get_fd (gpgme_data_t dh) +{ + fflush (dh->data.stream); + return fileno (dh->data.stream); +} + + static struct _gpgme_data_cbs stream_cbs = { stream_read, stream_write, stream_seek, - NULL + NULL, + stream_get_fd }; diff -urpNP gpgme-1.1.2/gpgme/data-user.c gpgme-1.1.3/gpgme/data-user.c --- gpgme-1.1.2/gpgme/data-user.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/data-user.c 2007-01-29 20:16:19.000000000 +0000 @@ -71,7 +71,8 @@ static struct _gpgme_data_cbs user_cbs = user_read, user_write, user_seek, - user_release + user_release, + NULL }; diff -urpNP gpgme-1.1.2/gpgme/data.c gpgme-1.1.3/gpgme/data.c --- gpgme-1.1.2/gpgme/data.c 2005-09-30 13:50:05.000000000 +0000 +++ gpgme-1.1.3/gpgme/data.c 2007-01-29 20:16:19.000000000 +0000 @@ -183,9 +183,14 @@ gpgme_data_set_file_name (gpgme_data_t d if (dh->file_name) free (dh->file_name); - dh->file_name = strdup (file_name); - if (!dh->file_name) - return gpg_error_from_errno (errno); + if (file_name) + { + dh->file_name = strdup (file_name); + if (!dh->file_name) + return gpg_error_from_errno (errno); + } + else + dh->file_name = 0; return 0; } @@ -275,3 +280,14 @@ _gpgme_data_outbound_handler (void *opaq dh->pending_len -= nwritten; return 0; } + + +/* Get the file descriptor associated with DH, if possible. Otherwise + return -1. */ +int +_gpgme_data_get_fd (gpgme_data_t dh) +{ + if (!dh || !dh->cbs->get_fd) + return -1; + return (*dh->cbs->get_fd) (dh); +} diff -urpNP gpgme-1.1.2/gpgme/data.h gpgme-1.1.3/gpgme/data.h --- gpgme-1.1.2/gpgme/data.h 2005-10-01 02:06:07.000000000 +0000 +++ gpgme-1.1.3/gpgme/data.h 2007-01-29 20:16:19.000000000 +0000 @@ -52,12 +52,16 @@ typedef off_t (*gpgme_data_seek_cb) (gpg /* Release the data object with the handle DH. */ typedef void (*gpgme_data_release_cb) (gpgme_data_t dh); +/* Get the FD associated with the handle DH, or -1. */ +typedef int (*gpgme_data_get_fd_cb) (gpgme_data_t dh); + struct _gpgme_data_cbs { gpgme_data_read_cb read; gpgme_data_write_cb write; gpgme_data_seek_cb seek; gpgme_data_release_cb release; + gpgme_data_get_fd_cb get_fd; }; struct gpgme_data @@ -121,4 +125,8 @@ gpgme_error_t _gpgme_data_new (gpgme_dat void _gpgme_data_release (gpgme_data_t dh); +/* Get the file descriptor associated with DH, if possible. Otherwise + return -1. */ +int _gpgme_data_get_fd (gpgme_data_t dh); + #endif /* DATA_H */ diff -urpNP gpgme-1.1.2/gpgme/engine-backend.h gpgme-1.1.3/gpgme/engine-backend.h --- gpgme-1.1.2/gpgme/engine-backend.h 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/gpgme/engine-backend.h 2007-01-29 20:16:20.000000000 +0000 @@ -45,11 +45,11 @@ struct engine_ops const char *(*get_req_version) (void); gpgme_error_t (*new) (void **r_engine, - const char *file_name, const char *home_dir, - const char *lc_ctype, const char *lc_messages); + 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, @@ -58,6 +58,7 @@ struct engine_ops 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); diff -urpNP gpgme-1.1.2/gpgme/engine-gpgsm.c gpgme-1.1.3/gpgme/engine-gpgsm.c --- gpgme-1.1.2/gpgme/engine-gpgsm.c 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/gpgme/engine-gpgsm.c 2007-01-29 20:16:20.000000000 +0000 @@ -51,6 +51,7 @@ 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. */ @@ -59,19 +60,19 @@ typedef struct struct engine_gpgsm { - ASSUAN_CONTEXT assuan_ctx; + 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; - int input_fd_server; iocb_data_t output_cb; - int output_fd_server; iocb_data_t message_cb; - int message_fd_server; struct { @@ -124,30 +125,34 @@ close_notify_handler (int fd, void *opaq 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 (AssuanError err) +map_assuan_error (gpg_error_t err) { if (!err) return 0; @@ -315,38 +320,42 @@ gpgsm_release (void *engine) static gpgme_error_t -gpgsm_new (void **engine, const char *file_name, const char *home_dir, - const char *lc_ctype, const char *lc_messages) +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; - int fdlist[5]; - int nfds; 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_fd_server = -1; + gpgsm->input_cb.server_fd = -1; gpgsm->output_cb.fd = -1; + gpgsm->output_cb.dir = 1; gpgsm->output_cb.tag = 0; - gpgsm->output_fd_server = -1; + gpgsm->output_cb.server_fd = -1; gpgsm->message_cb.fd = -1; + gpgsm->message_cb.dir = 0; gpgsm->message_cb.tag = 0; - gpgsm->message_fd_server = -1; + gpgsm->message_cb.server_fd = -1; gpgsm->status.fnc = 0; gpgsm->colon.fnc = 0; @@ -361,14 +370,14 @@ gpgsm_new (void **engine, const char *fi 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.dir = 0; - gpgsm->input_fd_server = fds[0]; + gpgsm->input_cb.server_fd = fds[0]; if (_gpgme_io_pipe (fds, 1) < 0) { @@ -376,8 +385,7 @@ gpgsm_new (void **engine, const char *fi goto leave; } gpgsm->output_cb.fd = fds[0]; - gpgsm->output_cb.dir = 1; - gpgsm->output_fd_server = fds[1]; + gpgsm->output_cb.server_fd = fds[1]; if (_gpgme_io_pipe (fds, 0) < 0) { @@ -385,13 +393,13 @@ gpgsm_new (void **engine, const char *fi goto leave; } gpgsm->message_cb.fd = fds[1]; - gpgsm->message_cb.dir = 0; - gpgsm->message_fd_server = fds[0]; + gpgsm->message_cb.server_fd = fds[0]; - child_fds[0] = gpgsm->input_fd_server; - child_fds[1] = gpgsm->output_fd_server; - child_fds[2] = gpgsm->message_fd_server; + 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"; @@ -403,34 +411,17 @@ gpgsm_new (void **engine, const char *fi argv[argc++] = "--server"; argv[argc++] = NULL; - err = assuan_pipe_connect (&gpgsm->assuan_ctx, - file_name ? file_name : _gpgme_get_gpgsm_path (), - argv, child_fds); - /* FIXME: Check error. */ - - /* 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) - { - err = gpg_error (GPG_ERR_GENERAL); /* FIXME */ - goto leave; - } - /* We duplicate the file descriptor, so we can close it without - disturbing assuan. 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. */ - gpgsm->status_cb.fd = dup (fdlist[0]); - if (gpgsm->status_cb.fd < 0) - { - err = gpg_error (GPG_ERR_GENERAL); /* FIXME */ - goto leave; - } - gpgsm->status_cb.dir = 1; - gpgsm->status_cb.data = gpgsm; +#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) @@ -503,43 +494,10 @@ gpgsm_new (void **engine, const char *fi } } - if (lc_ctype) - { - if (asprintf (&optstr, "OPTION lc-ctype=%s", lc_ctype) < 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); - } - } - if (err) - goto leave; - - if (lc_messages) - { - if (asprintf (&optstr, "OPTION lc-messages=%s", lc_messages) < 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); - } - } - if (err) - goto leave; - +#if !USE_DESCRIPTOR_PASSING if (!err - && (_gpgme_io_set_close_notify (gpgsm->status_cb.fd, + && (_gpgme_io_set_close_notify (gpgsm->input_cb.fd, close_notify_handler, gpgsm) - || _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, @@ -548,16 +506,19 @@ gpgsm_new (void **engine, const char *fi err = gpg_error (GPG_ERR_GENERAL); goto leave; } - +#endif + leave: /* Close the server ends of the pipes. Our ends are closed in gpgsm_release(). */ - if (gpgsm->input_fd_server != -1) - _gpgme_io_close (gpgsm->input_fd_server); - if (gpgsm->output_fd_server != -1) - _gpgme_io_close (gpgsm->output_fd_server); - if (gpgsm->message_fd_server != -1) - _gpgme_io_close (gpgsm->message_fd_server); +#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); @@ -568,15 +529,61 @@ gpgsm_new (void **engine, const char *fi } +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 ctx, char *cmd, +gpgsm_assuan_simple_command (assuan_context_t ctx, char *cmd, engine_status_handler_t status_fnc, void *status_fnc_value) { - AssuanError err; + gpg_error_t err; char *line; size_t linelen; @@ -629,18 +636,118 @@ gpgsm_assuan_simple_command (ASSUAN_CONT } +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 (ASSUAN_CONTEXT ctx, const char *which, int fd, const char *opt) +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; + int fd; + + 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; + } + } +#endif + + fd = iocb_data->server_fd; + +#if USE_DESCRIPTOR_PASSING + err = assuan_sendfd (gpgsm->assuan_ctx, fd); + if (err) + goto leave_set_fd; + + _gpgme_io_close (fd); + + 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=%i %s", which, fd, opt); else snprintf (line, COMMANDLINELEN, "%s FD=%i", which, fd); +#endif + + err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, line, NULL, NULL); - return gpgsm_assuan_simple_command (ctx, line, NULL, NULL); +#if USE_DESCRIPTOR_PASSING + leave_set_fd: + if (err) + { + _gpgme_io_close (iocb_data->fd); + _gpgme_io_close (iocb_data->server_fd); + iocb_data->fd = -1; + iocb_data->server_fd = -1; + } +#endif + + return err; } @@ -688,7 +795,7 @@ parse_status (const char *name) static gpgme_error_t status_handler (void *opaque, int fd) { - AssuanError assuan_err; + gpg_error_t assuan_err; gpgme_error_t err = 0; engine_gpgsm_t gpgsm = opaque; char *line; @@ -864,6 +971,33 @@ 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 without + disturbing assuan. 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. */ + gpgsm->status_cb.fd = 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)) + { + 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) @@ -883,6 +1017,19 @@ start (engine_gpgsm_t gpgsm, const char } +#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) { @@ -893,15 +1040,14 @@ gpgsm_decrypt (void *engine, gpgme_data_ return gpg_error (GPG_ERR_INV_VALUE); gpgsm->input_cb.data = ciph; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, - map_input_enc (gpgsm->input_cb.data)); + 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->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, 0); + err = gpgsm_set_fd (gpgsm, OUTPUT_FD, 0); if (err) return gpg_error (GPG_ERR_GENERAL); /* FIXME */ - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (engine, "DECRYPT"); return err; @@ -964,9 +1110,9 @@ gpgsm_delete (void *engine, gpgme_key_t } *linep = '\0'; - _gpgme_io_close (gpgsm->output_cb.fd); - _gpgme_io_close (gpgsm->input_cb.fd); - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, OUTPUT_FD); + gpgsm_clear_fd (gpgsm, INPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, line); free (line); @@ -979,7 +1125,7 @@ static gpgme_error_t set_recipients (engine_gpgsm_t gpgsm, gpgme_key_t recp[]) { gpgme_error_t err = 0; - ASSUAN_CONTEXT ctx = gpgsm->assuan_ctx; + assuan_context_t ctx = gpgsm->assuan_ctx; char *line; int linelen; int invalid_recipients = 0; @@ -1048,16 +1194,14 @@ gpgsm_encrypt (void *engine, gpgme_key_t return gpg_error (GPG_ERR_NOT_IMPLEMENTED); gpgsm->input_cb.data = plain; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, - map_input_enc (gpgsm->input_cb.data)); + 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->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, - use_armor ? "--armor" : 0); + err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0); if (err) return err; - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = set_recipients (gpgsm, recp); @@ -1089,12 +1233,11 @@ gpgsm_export (void *engine, const char * strcpy (&cmd[7], pattern); gpgsm->output_cb.data = keydata; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, - use_armor ? "--armor" : 0); + err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0); if (err) return err; - _gpgme_io_close (gpgsm->input_cb.fd); - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, INPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, cmd); free (cmd); @@ -1181,12 +1324,11 @@ gpgsm_export_ext (void *engine, const ch *linep = '\0'; gpgsm->output_cb.data = keydata; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, - use_armor ? "--armor" : 0); + err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0); if (err) return err; - _gpgme_io_close (gpgsm->input_cb.fd); - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, INPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, line); free (line); @@ -1205,16 +1347,14 @@ gpgsm_genkey (void *engine, gpgme_data_t return gpg_error (GPG_ERR_INV_VALUE); gpgsm->input_cb.data = help_data; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, - map_input_enc (gpgsm->input_cb.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->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, - use_armor ? "--armor" : 0); + err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0); if (err) return err; - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, "GENKEY"); return err; @@ -1231,12 +1371,11 @@ gpgsm_import (void *engine, gpgme_data_t return gpg_error (GPG_ERR_INV_VALUE); gpgsm->input_cb.data = keydata; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, - map_input_enc (gpgsm->input_cb.data)); + err = gpgsm_set_fd (gpgsm, INPUT_FD, map_input_enc (gpgsm->input_cb.data)); if (err) return err; - _gpgme_io_close (gpgsm->output_cb.fd); - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, OUTPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, "IMPORT"); return err; @@ -1260,6 +1399,7 @@ gpgsm_keylist (void *engine, const char 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); @@ -1268,6 +1408,8 @@ gpgsm_keylist (void *engine, const char 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, @@ -1292,9 +1434,9 @@ gpgsm_keylist (void *engine, const char strcpy (&line[9], pattern); } - _gpgme_io_close (gpgsm->input_cb.fd); - _gpgme_io_close (gpgsm->output_cb.fd); - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, INPUT_FD); + gpgsm_clear_fd (gpgsm, OUTPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, line); free (line); @@ -1323,6 +1465,7 @@ gpgsm_keylist_ext (void *engine, const c 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); @@ -1330,6 +1473,7 @@ gpgsm_keylist_ext (void *engine, const c 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, @@ -1412,9 +1556,9 @@ gpgsm_keylist_ext (void *engine, const c linep--; *linep = '\0'; - _gpgme_io_close (gpgsm->input_cb.fd); - _gpgme_io_close (gpgsm->output_cb.fd); - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, INPUT_FD); + gpgsm_clear_fd (gpgsm, OUTPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, line); free (line); @@ -1436,12 +1580,8 @@ gpgsm_sign (void *engine, gpgme_data_t i if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); - /* We must send a reset because we need to reset the list of - signers. Note that RESET does not reset OPTION commands. */ - err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "RESET", NULL, NULL); - if (err) - return err; - + /* 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 @@ -1476,16 +1616,14 @@ gpgsm_sign (void *engine, gpgme_data_t i } gpgsm->input_cb.data = in; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, - map_input_enc (gpgsm->input_cb.data)); + 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->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, - use_armor ? "--armor" : 0); + err = gpgsm_set_fd (gpgsm, OUTPUT_FD, use_armor ? "--armor" : 0); if (err) return err; - _gpgme_io_close (gpgsm->message_cb.fd); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); err = start (gpgsm, mode == GPGME_SIG_MODE_DETACH ? "SIGN --detached" : "SIGN"); @@ -1504,25 +1642,22 @@ gpgsm_verify (void *engine, gpgme_data_t return gpg_error (GPG_ERR_INV_VALUE); gpgsm->input_cb.data = sig; - err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, - map_input_enc (gpgsm->input_cb.data)); + 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->assuan_ctx, "OUTPUT", gpgsm->output_fd_server, - 0); - _gpgme_io_close (gpgsm->message_cb.fd); + 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->assuan_ctx, "MESSAGE", - gpgsm->message_fd_server, 0); - _gpgme_io_close (gpgsm->output_cb.fd); + err = gpgsm_set_fd (gpgsm, MESSAGE_FD, 0); + gpgsm_clear_fd (gpgsm, OUTPUT_FD); } if (!err) @@ -1584,9 +1719,15 @@ struct engine_ops _gpgme_engine_ops_gpgs /* 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 */ diff -urpNP gpgme-1.1.2/gpgme/engine.c gpgme-1.1.3/gpgme/engine.c --- gpgme-1.1.2/gpgme/engine.c 2006-02-22 11:37:32.000000000 +0000 +++ gpgme-1.1.3/gpgme/engine.c 2007-01-29 20:16:19.000000000 +0000 @@ -389,8 +389,7 @@ gpgme_set_engine_info (gpgme_protocol_t gpgme_error_t -_gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine, - const char *lc_ctype, const char *lc_messages) +_gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine) { engine_t engine; @@ -404,9 +403,9 @@ _gpgme_engine_new (gpgme_engine_info_t i engine->ops = engine_ops[info->protocol]; if (engine->ops->new) { - gpgme_error_t err = (*engine->ops->new) (&engine->engine, - info->file_name, info->home_dir, - lc_ctype, lc_messages); + gpgme_error_t err; + err = (*engine->ops->new) (&engine->engine, + info->file_name, info->home_dir); if (err) { free (engine); @@ -421,6 +420,19 @@ _gpgme_engine_new (gpgme_engine_info_t i } +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) { @@ -477,6 +489,19 @@ _gpgme_engine_set_colon_line_handler (en } 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) { diff -urpNP gpgme-1.1.2/gpgme/engine.h gpgme-1.1.3/gpgme/engine.h --- gpgme-1.1.2/gpgme/engine.h 2005-10-01 20:14:48.000000000 +0000 +++ gpgme-1.1.3/gpgme/engine.h 2007-01-29 20:16:19.000000000 +0000 @@ -51,9 +51,12 @@ gpgme_error_t _gpgme_set_engine_info (gp gpgme_error_t _gpgme_engine_new (gpgme_engine_info_t info, - engine_t *r_engine, - const char *lc_ctype, - const char *lc_messages); + 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, diff -urpNP gpgme-1.1.2/gpgme/genkey.c gpgme-1.1.3/gpgme/genkey.c --- gpgme-1.1.2/gpgme/genkey.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/genkey.c 2007-01-29 20:16:19.000000000 +0000 @@ -142,7 +142,8 @@ get_key_parameter (const char *parms, gp endtag = strstr (content, ""); /* FIXME: Check that there are no control statements inside. */ - while (*content == '\n') + while (content[0] == '\n' + || (content[0] == '\r' && content[1] == '\n')) content++; return gpgme_data_new_from_mem (key_parameter, content, diff -urpNP gpgme-1.1.2/gpgme/gpgme-config.in gpgme-1.1.3/gpgme/gpgme-config.in --- gpgme-1.1.2/gpgme/gpgme-config.in 2005-11-18 23:03:28.000000000 +0000 +++ gpgme-1.1.3/gpgme/gpgme-config.in 2007-01-29 20:16:20.000000000 +0000 @@ -14,6 +14,9 @@ exec_prefix=@exec_prefix@ includedir=@includedir@ libdir=@libdir@ +# Network libraries. +netlibs="@NETLIBS@" + # Configure libgpg-error. gpg_error_cflags="@GPG_ERROR_CFLAGS@" gpg_error_libs="@GPG_ERROR_LIBS@" @@ -25,6 +28,10 @@ thread_modules="" libs_pth="@PTH_LDFLAGS@ @PTH_LIBS@" cflags_pth="@PTH_CFLAGS@" +@HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread" +libs_pthread="-lpthread" +cflags_pthread="" + # Configure glib. libs_glib="@GLIB_LIBS@" cflags_glib="@GLIB_CFLAGS@" @@ -44,6 +51,8 @@ Options: [--api-version] [--libs] [--cflags] + [--get-gpg] + [--get-gpgsm] EOF exit $1 } @@ -122,7 +131,7 @@ while test $# -gt 0; do fi ;; esac - output="$output $gpg_error_libs" + output="$output $gpg_error_libs $netlibs" if test "x$with_glib" = "xyes"; then output="$output $glib_cflags" fi @@ -137,6 +146,12 @@ while test $# -gt 0; do usage 1 1>&2 fi ;; + --get-gpg) + output="$output @GPG@" + ;; + --get-gpgsm) + output="$output @GPGSM@" + ;; *) usage 1 1>&2 ;; diff -urpNP gpgme-1.1.2/gpgme/gpgme.c gpgme-1.1.3/gpgme/gpgme.c --- gpgme-1.1.2/gpgme/gpgme.c 2005-10-02 14:24:22.000000000 +0000 +++ gpgme-1.1.3/gpgme/gpgme.c 2007-01-29 20:16:19.000000000 +0000 @@ -1,6 +1,6 @@ /* gpgme.c - GnuPG Made Easy. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -159,7 +159,17 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpg if (protocol != GPGME_PROTOCOL_OpenPGP && protocol != GPGME_PROTOCOL_CMS) return gpg_error (GPG_ERR_INV_VALUE); - ctx->protocol = protocol; + if (ctx->protocol != protocol) + { + /* Shut down the engine when switching protocols. */ + if (ctx->engine) + { + _gpgme_engine_release (ctx->engine); + ctx->engine = NULL; + } + + ctx->protocol = protocol; + } return 0; } @@ -341,10 +351,9 @@ gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value) { -#ifndef HAVE_W32_SYSTEM int failed = 0; - char *new_lc_ctype; - char *new_lc_messages; + char *new_lc_ctype = NULL; + char *new_lc_messages = NULL; #define PREPARE_ONE_LOCALE(lcat, ucat) \ if (!failed && value \ @@ -353,12 +362,12 @@ gpgme_set_locale (gpgme_ctx_t ctx, int c new_lc_ ## lcat = strdup (value); \ if (!new_lc_ ## lcat) \ failed = 1; \ - } \ - else \ - new_lc_ ## lcat = NULL; + } PREPARE_ONE_LOCALE (ctype, CTYPE); +#ifdef LC_MESSAGES PREPARE_ONE_LOCALE (messages, MESSAGES); +#endif if (failed) { @@ -392,12 +401,12 @@ gpgme_set_locale (gpgme_ctx_t ctx, int c if (!ctx) LOCK (def_lc_lock); SET_ONE_LOCALE (ctype, CTYPE); +#ifdef LC_MESSAGES SET_ONE_LOCALE (messages, MESSAGES); +#endif if (!ctx) UNLOCK (def_lc_lock); -#endif /*!HAVE_W32_SYSTEM*/ - return 0; } @@ -418,8 +427,12 @@ gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto, const char *file_name, const char *home_dir) { - /* FIXME: Make sure to reset the context if we are running in daemon - mode. */ + /* Shut down the engine when changing engine info. */ + if (ctx->engine) + { + _gpgme_engine_release (ctx->engine); + ctx->engine = NULL; + } return _gpgme_set_engine_info (ctx->engine_info, proto, file_name, home_dir); } diff -urpNP gpgme-1.1.2/gpgme/gpgme.h gpgme-1.1.3/gpgme/gpgme.h --- gpgme-1.1.2/gpgme/gpgme.h 2006-03-02 10:23:48.000000000 +0000 +++ gpgme-1.1.3/gpgme/gpgme.h 2007-01-29 20:17:37.000000000 +0000 @@ -72,7 +72,7 @@ extern "C" { 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.2" +#define GPGME_VERSION "1.1.3" diff -urpNP gpgme-1.1.2/gpgme/keylist.c gpgme-1.1.3/gpgme/keylist.c --- gpgme-1.1.2/gpgme/keylist.c 2006-02-22 11:37:43.000000000 +0000 +++ gpgme-1.1.3/gpgme/keylist.c 2007-01-29 20:16:19.000000000 +0000 @@ -386,9 +386,6 @@ keylist_colon_handler (void *priv, char gpgme_subkey_t subkey = NULL; gpgme_key_sig_t keysig = NULL; - DEBUG3 ("keylist_colon_handler ctx = %p, key = %p, line = %s\n", - ctx, key, line ? line : "(null)"); - err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); opd = hook; if (err) @@ -396,6 +393,9 @@ keylist_colon_handler (void *priv, char key = opd->tmp_key; + DEBUG3 ("keylist_colon_handler ctx = %p, key = %p, line = %s\n", + ctx, key, line ? line : "(null)"); + if (!line) { /* End Of File. */ @@ -883,6 +883,8 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, opd = hook; if (err) return err; + if (opd == NULL) + return gpg_error (GPG_ERR_INV_VALUE); if (!opd->key_queue) { @@ -939,8 +941,22 @@ gpgme_get_key (gpgme_ctx_t ctx, const ch err = gpgme_new (&listctx); if (err) return err; - gpgme_set_protocol (listctx, gpgme_get_protocol (ctx)); - gpgme_set_keylist_mode (listctx, ctx->keylist_mode); + { + gpgme_protocol_t proto; + gpgme_engine_info_t info; + + /* Clone the relevant state. */ + proto = gpgme_get_protocol (ctx); + gpgme_set_protocol (listctx, proto); + gpgme_set_keylist_mode (listctx, gpgme_get_keylist_mode (ctx)); + info = gpgme_ctx_get_engine_info (ctx); + while (info && info->protocol != proto) + info = info->next; + if (info) + gpgme_ctx_set_engine_info (listctx, proto, + info->file_name, info->home_dir); + } + err = gpgme_op_keylist_start (listctx, fpr, secret); if (!err) err = gpgme_op_keylist_next (listctx, r_key); diff -urpNP gpgme-1.1.2/gpgme/op-support.c gpgme-1.1.3/gpgme/op-support.c --- gpgme-1.1.2/gpgme/op-support.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/op-support.c 2007-01-29 20:16:20.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include "gpgme.h" #include "context.h" @@ -67,29 +68,51 @@ gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int type) { gpgme_error_t err = 0; - gpgme_engine_info_t info; struct gpgme_io_cbs io_cbs; - info = ctx->engine_info; - while (info && info->protocol != ctx->protocol) - info = info->next; - - if (!info) - return gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL); - _gpgme_release_result (ctx); if (ctx->engine) { - _gpgme_engine_release (ctx->engine); - ctx->engine = NULL; + /* 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; + } } - /* Create an engine object. */ - err = _gpgme_engine_new (info, &ctx->engine, - ctx->lc_ctype, ctx->lc_messages); + 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; + } + + err = _gpgme_engine_set_locale (ctx->engine, LC_CTYPE, ctx->lc_ctype); +#ifdef LC_MESSAGES + if (!err) + err = _gpgme_engine_set_locale (ctx->engine, + LC_MESSAGES, ctx->lc_messages); +#endif + if (err) - return err; + { + _gpgme_engine_release (ctx->engine); + ctx->engine = NULL; + return err; + } if (type == 1 || (type == 2 && !ctx->io_cbs.add)) { diff -urpNP gpgme-1.1.2/gpgme/posix-io.c gpgme-1.1.3/gpgme/posix-io.c --- gpgme-1.1.2/gpgme/posix-io.c 2005-11-18 23:03:27.000000000 +0000 +++ gpgme-1.1.3/gpgme/posix-io.c 2007-01-29 20:16:19.000000000 +0000 @@ -412,3 +412,86 @@ _gpgme_io_select (struct io_select_fd_s } return count; } + + +int +_gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) +{ + int nread; + int saved_errno; + struct iovec *iov; + + nread = 0; + iov = msg->msg_iov; + while (iov < msg->msg_iov + msg->msg_iovlen) + { + nread += iov->iov_len; + iov++; + } + + DEBUG2 ("fd %d: about to receive %d bytes\n", + fd, (int) nread); + do + { + nread = _gpgme_ath_recvmsg (fd, msg, flags); + } + while (nread == -1 && errno == EINTR); + saved_errno = errno; + DEBUG2 ("fd %d: got %d bytes\n", fd, nread); + if (nread > 0) + { + int nr = nread; + + iov = msg->msg_iov; + while (nr > 0) + { + int len = nr > iov->iov_len ? iov->iov_len : nr; + _gpgme_debug (2, "fd %d: got `%.*s'\n", fd, len, + msg->msg_iov->iov_base); + iov++; + nr -= len; + } + } + errno = saved_errno; + return nread; +} + + +int +_gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags) +{ + int saved_errno; + int nwritten; + struct iovec *iov; + + nwritten = 0; + iov = msg->msg_iov; + while (iov < msg->msg_iov + msg->msg_iovlen) + { + nwritten += iov->iov_len; + iov++; + } + + DEBUG2 ("fd %d: about to write %d bytes\n", fd, (int) nwritten); + iov = msg->msg_iov; + while (nwritten > 0) + { + int len = nwritten > iov->iov_len ? iov->iov_len : nwritten; + _gpgme_debug (2, "fd %d: write `%.*s'\n", fd, len, + msg->msg_iov->iov_base); + iov++; + nwritten -= len; + } + + do + { + nwritten = _gpgme_ath_sendmsg (fd, msg, flags); + } + while (nwritten == -1 && errno == EINTR); + saved_errno = errno; + DEBUG2 ("fd %d: wrote %d bytes\n", fd, (int) nwritten); + errno = saved_errno; + return nwritten; +} + + diff -urpNP gpgme-1.1.2/gpgme/rungpg.c gpgme-1.1.3/gpgme/rungpg.c --- gpgme-1.1.2/gpgme/rungpg.c 2006-02-22 11:37:25.000000000 +0000 +++ gpgme-1.1.3/gpgme/rungpg.c 2007-01-29 20:16:20.000000000 +0000 @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "gpgme.h" #include "util.h" @@ -71,6 +73,9 @@ struct engine_gpg { char *file_name; + char *lc_messages; + char *lc_ctype; + struct arg_and_data_s *arglist; struct arg_and_data_s **argtail; @@ -180,8 +185,10 @@ close_notify_handler (int fd, void *opaq } } +/* 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 (engine_gpg_t gpg, const char *arg) +add_arg_ext (engine_gpg_t gpg, const char *arg, int front) { struct arg_and_data_s *a; @@ -191,16 +198,38 @@ add_arg (engine_gpg_t gpg, const char *a a = malloc (sizeof *a + strlen (arg)); if (!a) return gpg_error_from_errno (errno); - a->next = NULL; + a->data = NULL; a->dup_to = -1; strcpy (a->arg, arg); - *gpg->argtail = a; - gpg->argtail = &a->next; + 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; @@ -316,6 +345,11 @@ gpg_release (void *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; @@ -339,11 +373,13 @@ gpg_release (void *engine) static gpgme_error_t -gpg_new (void **engine, const char *file_name, const char *home_dir, - const char *lc_ctype, const char *lc_messages) +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) @@ -423,6 +459,46 @@ gpg_new (void **engine, const char *file 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 (dft_display) + { + rc = add_arg (gpg, "--display"); + if (!rc) + rc = add_arg (gpg, dft_display); + + free (dft_display); + } + if (rc) + goto leave; + + if (isatty (1)) + { + if (ttyname_r (1, dft_ttyname, sizeof (dft_ttyname))) + rc = gpg_error_from_errno (errno); + else + { + rc = add_arg (gpg, "--ttyname"); + if (!rc) + rc = add_arg (gpg, dft_ttyname); + if (!rc) + { + rc = _gpgme_getenv ("TERM", &dft_ttytype); + if (!rc) + goto leave; + + rc = add_arg (gpg, "--ttytype"); + if (!rc) + rc = add_arg (gpg, dft_ttytype); + + free (dft_ttytype); + } + } + if (rc) + goto leave; + } leave: if (rc) @@ -433,6 +509,48 @@ gpg_new (void **engine, const char *file } +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 @@ -845,6 +963,8 @@ read_status (engine_gpg_t gpg) 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') @@ -1099,6 +1219,24 @@ start (engine_gpg_t gpg) 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; @@ -1948,9 +2086,11 @@ struct engine_ops _gpgme_engine_ops_gpg /* 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, diff -urpNP gpgme-1.1.2/gpgme/setenv.c gpgme-1.1.3/gpgme/setenv.c --- gpgme-1.1.2/gpgme/setenv.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/gpgme/setenv.c 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,356 @@ +/* Copyright (C) 1992,1995-2001,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library 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. + + The GNU C Library 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 the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02110-1301 USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_ASSUAN_H +/* Fixme: Why do we need to include the assuan header and why the + internal ones? */ +#include "assuan-defs.h" +#endif /*HAVE_ASSUAN_H*/ + +#define __builtin_expect(cond,val) (cond) + +#include +#if !_LIBC +# if !defined errno && !defined HAVE_ERRNO_DECL +extern int errno; +# endif +# define __set_errno(ev) ((errno) = (ev)) +#endif + +#if _LIBC || HAVE_STDLIB_H +# include +#endif +#if _LIBC || HAVE_STRING_H +# include +#endif +#if _LIBC || HAVE_UNISTD_H +# include +#endif + +#if !_LIBC +# define __environ environ +# ifndef HAVE_ENVIRON_DECL +extern char **environ; +# endif +#endif + +#if _LIBC +/* This lock protects against simultaneous modifications of `environ'. */ +# include +__libc_lock_define_initialized (static, envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) +#else +# define LOCK +# define UNLOCK +#endif + +/* In the GNU C library we must keep the namespace clean. */ +#ifdef _LIBC +# define setenv __setenv +# define unsetenv __unsetenv +# define clearenv __clearenv +# define tfind __tfind +# define tsearch __tsearch +#endif + +/* In the GNU C library implementation we try to be more clever and + allow arbitrarily many changes of the environment given that the used + values are from a small set. Outside glibc this will eat up all + memory after a while. */ +#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \ + && defined __GNUC__) +# define USE_TSEARCH 1 +# include + +/* This is a pointer to the root of the search tree with the known + values. */ +static void *known_values; + +# define KNOWN_VALUE(Str) \ + ({ \ + void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp); \ + value != NULL ? *(char **) value : NULL; \ + }) +# define STORE_VALUE(Str) \ + tsearch (Str, &known_values, (__compar_fn_t) strcmp) + +#else +# undef USE_TSEARCH + +# define KNOWN_VALUE(Str) NULL +# define STORE_VALUE(Str) do { } while (0) + +#endif + + +/* If this variable is not a null pointer we allocated the current + environment. */ +static char **last_environ; + + +/* This function is used by `setenv' and `putenv'. The difference between + the two functions is that for the former must create a new string which + is then placed in the environment, while the argument of `putenv' + must be used directly. This is all complicated by the fact that we try + to reuse values once generated for a `setenv' call since we can never + free the strings. */ +static int +__add_to_environ (const char *name, const char *value, const char *combined, + int replace) +{ + register char **ep; + register size_t size; + const size_t namelen = strlen (name); + const size_t vallen = value != NULL ? strlen (value) + 1 : 0; + + LOCK; + + /* We have to get the pointer now that we have the lock and not earlier + since another thread might have created a new environment. */ + ep = __environ; + + size = 0; + if (ep != NULL) + { + for (; *ep != NULL; ++ep) + if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + break; + else + ++size; + } + + if (ep == NULL || __builtin_expect (*ep == NULL, 1)) + { + char **new_environ; + + /* We allocated this space; we can extend it. */ + new_environ = (char **) realloc (last_environ, + (size + 2) * sizeof (char *)); + if (new_environ == NULL) + { + UNLOCK; + return -1; + } + + /* If the whole entry is given add it. */ + if (combined != NULL) + /* We must not add the string to the search tree since it belongs + to the user. */ + new_environ[size] = (char *) combined; + else + { + /* See whether the value is already known. */ +#ifdef USE_TSEARCH +# ifdef __GNUC__ + char new_value[namelen + 1 + vallen]; +# else + char *new_value = (char *) alloca (namelen + 1 + vallen); +# endif +# ifdef _LIBC + __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), + value, vallen); +# else + memcpy (new_value, name, namelen); + new_value[namelen] = '='; + memcpy (&new_value[namelen + 1], value, vallen); +# endif + + new_environ[size] = KNOWN_VALUE (new_value); + if (__builtin_expect (new_environ[size] == NULL, 1)) +#endif + { + new_environ[size] = (char *) malloc (namelen + 1 + vallen); + if (__builtin_expect (new_environ[size] == NULL, 0)) + { + __set_errno (ENOMEM); + UNLOCK; + return -1; + } + +#ifdef USE_TSEARCH + memcpy (new_environ[size], new_value, namelen + 1 + vallen); +#else + memcpy (new_environ[size], name, namelen); + new_environ[size][namelen] = '='; + memcpy (&new_environ[size][namelen + 1], value, vallen); +#endif + /* And save the value now. We cannot do this when we remove + the string since then we cannot decide whether it is a + user string or not. */ + STORE_VALUE (new_environ[size]); + } + } + + if (__environ != last_environ) + memcpy ((char *) new_environ, (char *) __environ, + size * sizeof (char *)); + + new_environ[size + 1] = NULL; + + last_environ = __environ = new_environ; + } + else if (replace) + { + char *np; + + /* Use the user string if given. */ + if (combined != NULL) + np = (char *) combined; + else + { +#ifdef USE_TSEARCH +# ifdef __GNUC__ + char new_value[namelen + 1 + vallen]; +# else + char *new_value = (char *) alloca (namelen + 1 + vallen); +# endif +# ifdef _LIBC + __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), + value, vallen); +# else + memcpy (new_value, name, namelen); + new_value[namelen] = '='; + memcpy (&new_value[namelen + 1], value, vallen); +# endif + + np = KNOWN_VALUE (new_value); + if (__builtin_expect (np == NULL, 1)) +#endif + { + np = malloc (namelen + 1 + vallen); + if (__builtin_expect (np == NULL, 0)) + { + UNLOCK; + return -1; + } + +#ifdef USE_TSEARCH + memcpy (np, new_value, namelen + 1 + vallen); +#else + memcpy (np, name, namelen); + np[namelen] = '='; + memcpy (&np[namelen + 1], value, vallen); +#endif + /* And remember the value. */ + STORE_VALUE (np); + } + } + + *ep = np; + } + + UNLOCK; + + return 0; +} + +int +setenv (const char *name, const char *value, int replace) +{ + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + + return __add_to_environ (name, value, NULL, replace); +} + +int +unsetenv (const char *name) +{ + size_t len; + char **ep; + + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + + len = strlen (name); + + LOCK; + + ep = __environ; + while (*ep != NULL) + if (!strncmp (*ep, name, len) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + UNLOCK; + + return 0; +} + +/* The `clearenv' was planned to be added to POSIX.1 but probably + never made it. Nevertheless the POSIX.9 standard (POSIX bindings + for Fortran 77) requires this function. */ +int +clearenv (void) +{ + LOCK; + + if (__environ == last_environ && __environ != NULL) + { + /* We allocated this environment so we can free it. */ + free (__environ); + last_environ = NULL; + } + + /* Clear the environment pointer removes the whole environment. */ + __environ = NULL; + + UNLOCK; + + return 0; +} +#ifdef _LIBC +libc_freeres_fn (free_mem) +{ + /* Remove all traces. */ + clearenv (); + + /* Now remove the search tree. */ + __tdestroy (known_values, free); + known_values = NULL; +} + +# undef setenv +# undef unsetenv +# undef clearenv +weak_alias (__setenv, setenv) +weak_alias (__unsetenv, unsetenv) +weak_alias (__clearenv, clearenv) +#endif + + diff -urpNP gpgme-1.1.2/gpgme/stpcpy.c gpgme-1.1.3/gpgme/stpcpy.c --- gpgme-1.1.2/gpgme/stpcpy.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/gpgme/stpcpy.c 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,55 @@ +/* Copyright (C) 1992, 1995, 1997, 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library 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. + + The GNU C Library 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 the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#undef __stpcpy +#undef stpcpy + +#ifndef weak_alias +# define __stpcpy stpcpy +#endif + +/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ +char * +__stpcpy (dest, src) + char *dest; + const char *src; +{ + register char *d = dest; + register const char *s = src; + + do + *d++ = *s; + while (*s++ != '\0'); + + return d - 1; +} +#ifdef libc_hidden_def +libc_hidden_def (__stpcpy) +#endif +#ifdef weak_alias +weak_alias (__stpcpy, stpcpy) +#endif +#ifdef libc_hidden_builtin_def +libc_hidden_builtin_def (stpcpy) +#endif diff -urpNP gpgme-1.1.2/gpgme/trustlist.c gpgme-1.1.3/gpgme/trustlist.c --- gpgme-1.1.2/gpgme/trustlist.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/trustlist.c 2007-01-29 20:16:20.000000000 +0000 @@ -215,6 +215,8 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx opd = hook; if (err) return err; + if (opd == NULL) + return gpg_error (GPG_ERR_INV_VALUE); if (!opd->trust_queue) { diff -urpNP gpgme-1.1.2/gpgme/ttyname_r.c gpgme-1.1.3/gpgme/ttyname_r.c --- gpgme-1.1.2/gpgme/ttyname_r.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/ttyname_r.c 2007-01-29 20:16:20.000000000 +0000 @@ -32,17 +32,22 @@ int ttyname_r (int fd, char *buf, size_t buflen) { -#if HAVE_W32_SYSTEM - errno = ENOTTY; /* The best error code I have under mingw. */ -#else char *tty; +#if HAVE_W32_SYSTEM + /* We use this default one for now. AFAICS we only need it to be + passed to gpg and in turn to pinentry. Providing a replacement + is needed because elsewhere we bail out on error. If we + eventually implement a pinentry for Windows it is uinlikely that + we need a real tty at all. */ + tty = "/dev/tty"; +#else tty = ttyname (fd); if (!tty) return errno; +#endif strncpy (buf, tty, buflen); buf[buflen - 1] = '\0'; return (strlen (tty) >= buflen) ? ERANGE : 0; -#endif } diff -urpNP gpgme-1.1.2/gpgme/version.c gpgme-1.1.3/gpgme/version.c --- gpgme-1.1.2/gpgme/version.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/version.c 2007-01-29 20:16:19.000000000 +0000 @@ -32,6 +32,10 @@ /* For _gpgme_sema_subsystem_init (). */ #include "sema.h" +#ifdef HAVE_ASSUAN_H +#include "assuan.h" +#endif + /* Bootstrap the subsystems needed for concurrent operation. This must be done once at startup. We can not guarantee this using a @@ -48,6 +52,9 @@ do_subsystem_inits (void) _gpgme_sema_subsystem_init (); _gpgme_io_subsystem_init (); +#ifdef HAVE_ASSUAN_H + assuan_set_assuan_err_source (GPG_ERR_SOURCE_GPGME); +#endif done = 1; } @@ -200,6 +207,8 @@ _gpgme_get_program_version (const char * mark = strchr (&line[linelen], '\n'); if (mark) { + if (mark > &line[0] && *mark == '\r') + mark--; *mark = '\0'; break; } diff -urpNP gpgme-1.1.2/gpgme/w32-glib-io.c gpgme-1.1.3/gpgme/w32-glib-io.c --- gpgme-1.1.2/gpgme/w32-glib-io.c 2006-02-28 16:30:38.000000000 +0000 +++ gpgme-1.1.3/gpgme/w32-glib-io.c 2007-01-29 20:16:20.000000000 +0000 @@ -347,37 +347,57 @@ _gpgme_io_set_nonblocking (int fd) static char * -build_commandline ( char **argv ) +build_commandline (char **argv) { - int i, n = 0; - char *buf, *p; + int i; + int j; + int n = 0; + char *buf; + char *p; - /* FIXME: we have to quote some things because under Windows the - * program parses the commandline and does some unquoting. For now - * we only do very basic quoting to the first argument because this - * one often contains a space (e.g. C:\\Program Files\GNU\GnuPG\gpg.exe) - * and we would produce an invalid line in that case. */ - for (i=0; argv[i]; i++) - n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */ + /* We have to quote some things because under Windows the program + parses the commandline and does some unquoting. We enclose the + whole argument in double-quotes, and escape literal double-quotes + as well as backslashes with a backslash. We end up with a + trailing space at the end of the line, but that is harmless. */ + for (i = 0; argv[i]; i++) + { + p = argv[i]; + /* The leading double-quote. */ + n++; + while (*p) + { + /* An extra one for each literal that must be escaped. */ + if (*p == '\\' || *p == '"') + n++; + n++; + p++; + } + /* The trailing double-quote and the delimiter. */ + n += 2; + } + /* And a trailing zero. */ + n++; + buf = p = malloc (n); - if ( !buf ) + if (!buf) return NULL; - *buf = 0; - if ( argv[0] ) + for (i = 0; argv[i]; i++) { - if (strpbrk (argv[0], " \t")) - p = stpcpy (stpcpy (stpcpy (p, "\""), argv[0]), "\""); - else - p = stpcpy (p, argv[0]); - for (i = 1; argv[i]; i++) - { - if (!*argv[i]) - p = stpcpy (p, " \"\""); - else - p = stpcpy (stpcpy (p, " "), argv[i]); - } + char *argvp = argv[i]; + + *(p++) = '"'; + while (*argvp) + { + if (*argvp == '\\' || *argvp == '"') + *(p++) = '\\'; + *(p++) = *(argvp++); + } + *(p++) = '"'; + *(p++) = ' '; } - + *(p++) = 0; + return buf; } diff -urpNP gpgme-1.1.2/gpgme/w32-io.c gpgme-1.1.3/gpgme/w32-io.c --- gpgme-1.1.2/gpgme/w32-io.c 2006-02-15 12:48:26.000000000 +0000 +++ gpgme-1.1.3/gpgme/w32-io.c 2007-01-29 20:16:20.000000000 +0000 @@ -799,37 +799,57 @@ _gpgme_io_set_nonblocking ( int fd ) static char * -build_commandline ( char **argv ) +build_commandline (char **argv) { - int i, n = 0; - char *buf, *p; + int i; + int j; + int n = 0; + char *buf; + char *p; - /* FIXME: we have to quote some things because under Windows the - * program parses the commandline and does some unquoting. For now - * we only do very basic quoting to the first argument because this - * one often contains a space (e.g. C:\\Program Files\GNU\GnuPG\gpg.exe) - * and we would produce an invalid line in that case. */ - for (i=0; argv[i]; i++) - n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */ + /* We have to quote some things because under Windows the program + parses the commandline and does some unquoting. We enclose the + whole argument in double-quotes, and escape literal double-quotes + as well as backslashes with a backslash. We end up with a + trailing space at the end of the line, but that is harmless. */ + for (i = 0; argv[i]; i++) + { + p = argv[i]; + /* The leading double-quote. */ + n++; + while (*p) + { + /* An extra one for each literal that must be escaped. */ + if (*p == '\\' || *p == '"') + n++; + n++; + p++; + } + /* The trailing double-quote and the delimiter. */ + n += 2; + } + /* And a trailing zero. */ + n++; + buf = p = malloc (n); - if ( !buf ) + if (!buf) return NULL; - *buf = 0; - if ( argv[0] ) + for (i = 0; argv[i]; i++) { - if (strpbrk (argv[0], " \t")) - p = stpcpy (stpcpy (stpcpy (p, "\""), argv[0]), "\""); - else - p = stpcpy (p, argv[0]); - for (i = 1; argv[i]; i++) - { - if (!*argv[i]) - p = stpcpy (p, " \"\""); - else - p = stpcpy (stpcpy (p, " "), argv[i]); - } + char *argvp = argv[i]; + + *(p++) = '"'; + while (*argvp) + { + if (*argvp == '\\' || *argvp == '"') + *(p++) = '\\'; + *(p++) = *(argvp++); + } + *(p++) = '"'; + *(p++) = ' '; } - + *(p++) = 0; + return buf; } diff -urpNP gpgme-1.1.2/gpgme/wait-global.c gpgme-1.1.3/gpgme/wait-global.c --- gpgme-1.1.2/gpgme/wait-global.c 2005-09-08 14:42:31.000000000 +0000 +++ gpgme-1.1.3/gpgme/wait-global.c 2007-01-29 20:16:19.000000000 +0000 @@ -334,6 +334,7 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error /* Now some contexts might have finished successfully. */ LOCK (ctx_list_lock); + retry: for (li = ctx_active_list; li; li = li->next) { gpgme_ctx_t actx = li->ctx; @@ -344,7 +345,19 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error if (i == actx->fdt.size) { gpgme_error_t err = 0; + + /* FIXME: This does not perform too well. We have to + release the lock because the I/O event handler + acquires it to remove the context from the active + list. Two alternative strategies are worth + considering: Either implement the DONE event handler + here in a lock-free manner, or save a list of all + contexts to be released and call the DONE events + afterwards. */ + UNLOCK (ctx_list_lock); _gpgme_engine_io_event (actx->engine, GPGME_EVENT_DONE, &err); + LOCK (ctx_list_lock); + goto retry; } } UNLOCK (ctx_list_lock); diff -urpNP gpgme-1.1.2/gpgme.spec gpgme-1.1.3/gpgme.spec --- gpgme-1.1.2/gpgme.spec 2006-03-02 10:25:42.000000000 +0000 +++ gpgme-1.1.3/gpgme.spec 2007-01-29 20:17:57.000000000 +0000 @@ -1,7 +1,7 @@ # This is a template. The dist target uses it to create the real file. Summary: GPGME - GnuPG Made Easy Name: gpgme -Version: 1.1.2 +Version: 1.1.3 Release: 1 URL: http://www.gnupg.org/gpgme.html Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz diff -urpNP gpgme-1.1.2/lang/Makefile.am gpgme-1.1.3/lang/Makefile.am --- gpgme-1.1.2/lang/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/Makefile.am 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,22 @@ +# Makefile.am for gpgme/lang. +# Copyright (C) 2003, 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 + +SUBDIRS = cl + +EXTRA_DIST = README diff -urpNP gpgme-1.1.2/lang/Makefile.in gpgme-1.1.3/lang/Makefile.in --- gpgme-1.1.2/lang/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/Makefile.in 2007-01-29 20:17:00.000000000 +0000 @@ -0,0 +1,551 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program 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. + +@SET_MAKE@ + +# Makefile.am for gpgme/lang. +# Copyright (C) 2003, 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 +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = lang +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gpg-error.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/pth.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_ASSUAN_FALSE = @BUILD_ASSUAN_FALSE@ +BUILD_ASSUAN_TRUE = @BUILD_ASSUAN_TRUE@ +BUILD_COMPLUS_FALSE = @BUILD_COMPLUS_FALSE@ +BUILD_COMPLUS_TRUE = @BUILD_COMPLUS_TRUE@ +BUILD_FILEVERSION = @BUILD_FILEVERSION@ +BUILD_REVISION = @BUILD_REVISION@ +BUILD_TIMESTAMP = @BUILD_TIMESTAMP@ +BUILD_W32_GLIB_FALSE = @BUILD_W32_GLIB_FALSE@ +BUILD_W32_GLIB_TRUE = @BUILD_W32_GLIB_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GLIBC21 = @GLIBC21@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GPG = @GPG@ +GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@ +GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@ +GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ +GPGSM = @GPGSM@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_PATH = @GPG_PATH@ +HAVE_DOSISH_SYSTEM_FALSE = @HAVE_DOSISH_SYSTEM_FALSE@ +HAVE_DOSISH_SYSTEM_TRUE = @HAVE_DOSISH_SYSTEM_TRUE@ +HAVE_GPGSM_FALSE = @HAVE_GPGSM_FALSE@ +HAVE_GPGSM_TRUE = @HAVE_GPGSM_TRUE@ +HAVE_LD_VERSION_SCRIPT_FALSE = @HAVE_LD_VERSION_SCRIPT_FALSE@ +HAVE_LD_VERSION_SCRIPT_TRUE = @HAVE_LD_VERSION_SCRIPT_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ +HAVE_PTH_FALSE = @HAVE_PTH_FALSE@ +HAVE_PTH_TRUE = @HAVE_PTH_TRUE@ +HAVE_W32_SYSTEM_FALSE = @HAVE_W32_SYSTEM_FALSE@ +HAVE_W32_SYSTEM_TRUE = @HAVE_W32_SYSTEM_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@ +LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@ +LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PTH_CFLAGS = @PTH_CFLAGS@ +PTH_CPPFLAGS = @PTH_CPPFLAGS@ +PTH_LDFLAGS = @PTH_LDFLAGS@ +PTH_LIBS = @PTH_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +RUN_GPGSM_TESTS_FALSE = @RUN_GPGSM_TESTS_FALSE@ +RUN_GPGSM_TESTS_TRUE = @RUN_GPGSM_TESTS_TRUE@ +RUN_GPG_TESTS_FALSE = @RUN_GPG_TESTS_FALSE@ +RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_AS = @ac_ct_AS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_OBJDUMP = @ac_ct_OBJDUMP@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_RC = @ac_ct_RC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = cl +EXTRA_DIST = README +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lang/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lang/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -urpNP gpgme-1.1.2/lang/README gpgme-1.1.3/lang/README --- gpgme-1.1.2/lang/README 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/README 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,12 @@ +Language Support for GPGME +-------------------------- + +This directory contains support for other languages than C. + +Please note that language support components may be under a different +license than GPGME itself. You can find more information in each +sub-directory. + +Directory Language + +cl Common Lisp diff -urpNP gpgme-1.1.2/lang/cl/ChangeLog gpgme-1.1.3/lang/cl/ChangeLog --- gpgme-1.1.2/lang/cl/ChangeLog 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/ChangeLog 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,4 @@ +2006-07-06 Marcus Brinkmann + + * Initial release. + diff -urpNP gpgme-1.1.2/lang/cl/Makefile.am gpgme-1.1.3/lang/cl/Makefile.am --- gpgme-1.1.2/lang/cl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/Makefile.am 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,29 @@ +# Makefile.am for GPGME-CL. +# Copyright (C) 2003, 2006 g10 Code GmbH +# +# This file is part of GPGME-CL. +# +# GPGME-CL is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# GPGME-CL 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 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 + +clfiles = gpgme.asd gpgme-package.lisp gpgme.lisp + +# FIXME: Should be configurable. +clfilesdir = $(datadir)/common-lisp/source/gpgme +dist_clfiles_DATA = $(clfiles) + +EXTRA_DIST = README + + diff -urpNP gpgme-1.1.2/lang/cl/Makefile.in gpgme-1.1.3/lang/cl/Makefile.in --- gpgme-1.1.2/lang/cl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/Makefile.in 2007-01-29 20:17:00.000000000 +0000 @@ -0,0 +1,433 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program 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. + +@SET_MAKE@ + +# Makefile.am for GPGME-CL. +# Copyright (C) 2003, 2006 g10 Code GmbH +# +# This file is part of GPGME-CL. +# +# GPGME-CL is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# GPGME-CL 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 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 + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = lang/cl +DIST_COMMON = README $(dist_clfiles_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/gpgme.asd.in ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gpg-error.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/pth.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = gpgme.asd +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(clfilesdir)" +dist_clfilesDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_clfiles_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_ASSUAN_FALSE = @BUILD_ASSUAN_FALSE@ +BUILD_ASSUAN_TRUE = @BUILD_ASSUAN_TRUE@ +BUILD_COMPLUS_FALSE = @BUILD_COMPLUS_FALSE@ +BUILD_COMPLUS_TRUE = @BUILD_COMPLUS_TRUE@ +BUILD_FILEVERSION = @BUILD_FILEVERSION@ +BUILD_REVISION = @BUILD_REVISION@ +BUILD_TIMESTAMP = @BUILD_TIMESTAMP@ +BUILD_W32_GLIB_FALSE = @BUILD_W32_GLIB_FALSE@ +BUILD_W32_GLIB_TRUE = @BUILD_W32_GLIB_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GLIBC21 = @GLIBC21@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GPG = @GPG@ +GPGME_CONFIG_API_VERSION = @GPGME_CONFIG_API_VERSION@ +GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@ +GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ +GPGSM = @GPGSM@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_PATH = @GPG_PATH@ +HAVE_DOSISH_SYSTEM_FALSE = @HAVE_DOSISH_SYSTEM_FALSE@ +HAVE_DOSISH_SYSTEM_TRUE = @HAVE_DOSISH_SYSTEM_TRUE@ +HAVE_GPGSM_FALSE = @HAVE_GPGSM_FALSE@ +HAVE_GPGSM_TRUE = @HAVE_GPGSM_TRUE@ +HAVE_LD_VERSION_SCRIPT_FALSE = @HAVE_LD_VERSION_SCRIPT_FALSE@ +HAVE_LD_VERSION_SCRIPT_TRUE = @HAVE_LD_VERSION_SCRIPT_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ +HAVE_PTH_FALSE = @HAVE_PTH_FALSE@ +HAVE_PTH_TRUE = @HAVE_PTH_TRUE@ +HAVE_W32_SYSTEM_FALSE = @HAVE_W32_SYSTEM_FALSE@ +HAVE_W32_SYSTEM_TRUE = @HAVE_W32_SYSTEM_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBGPGME_LT_AGE = @LIBGPGME_LT_AGE@ +LIBGPGME_LT_CURRENT = @LIBGPGME_LT_CURRENT@ +LIBGPGME_LT_REVISION = @LIBGPGME_LT_REVISION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PTH_CFLAGS = @PTH_CFLAGS@ +PTH_CPPFLAGS = @PTH_CPPFLAGS@ +PTH_LDFLAGS = @PTH_LDFLAGS@ +PTH_LIBS = @PTH_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +RUN_GPGSM_TESTS_FALSE = @RUN_GPGSM_TESTS_FALSE@ +RUN_GPGSM_TESTS_TRUE = @RUN_GPGSM_TESTS_TRUE@ +RUN_GPG_TESTS_FALSE = @RUN_GPG_TESTS_FALSE@ +RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_AS = @ac_ct_AS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_OBJDUMP = @ac_ct_OBJDUMP@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_RC = @ac_ct_RC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +clfiles = gpgme.asd gpgme-package.lisp gpgme.lisp + +# FIXME: Should be configurable. +clfilesdir = $(datadir)/common-lisp/source/gpgme +dist_clfiles_DATA = $(clfiles) +EXTRA_DIST = README +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lang/cl/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lang/cl/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +gpgme.asd: $(top_builddir)/config.status $(srcdir)/gpgme.asd.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-dist_clfilesDATA: $(dist_clfiles_DATA) + @$(NORMAL_INSTALL) + test -z "$(clfilesdir)" || $(mkdir_p) "$(DESTDIR)$(clfilesdir)" + @list='$(dist_clfiles_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_clfilesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(clfilesdir)/$$f'"; \ + $(dist_clfilesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(clfilesdir)/$$f"; \ + done + +uninstall-dist_clfilesDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_clfiles_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(clfilesdir)/$$f'"; \ + rm -f "$(DESTDIR)$(clfilesdir)/$$f"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(clfilesdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-dist_clfilesDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_clfilesDATA uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_clfilesDATA \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am uninstall uninstall-am uninstall-dist_clfilesDATA \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -urpNP gpgme-1.1.2/lang/cl/README gpgme-1.1.3/lang/cl/README --- gpgme-1.1.2/lang/cl/README 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/README 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,40 @@ +Common Lisp Support for GPGME +----------------------------- + +Requirements: + +ASDF Packaging Support +CFFI Foreign Function Interface +gpg-error GPG Error Codes + +Use with: + +> (asdf:operate 'asdf:load-op ':gpgme) + + +Examples +-------- + +(with-open-file (stream "/tmp/myout" :direction :output + :if-exists :supersede :element-type '(unsigned-byte 8)) + (with-context (ctx) + (setf (armor-p ctx) t) + (op-export ctx "DEADBEEF" out))) + +(with-context (ctx) + (with-output-to-string (out) + (setf (armor-p ctx) t) + (op-export ctx "McTester" out))) + +(gpgme:with-context (ctx :armor t) + (with-output-to-string (out) + (gpgme:op-export ctx "McTester" out))) + + +TODO +---- + +* When GPGME defines macros for include cert values -2, -1, 0 and 1, + define lisp macros for them as well. + +* diff -urpNP gpgme-1.1.2/lang/cl/gpgme-package.lisp gpgme-1.1.3/lang/cl/gpgme-package.lisp --- gpgme-1.1.2/lang/cl/gpgme-package.lisp 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/gpgme-package.lisp 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,49 @@ +;;;; gpgme-package.lisp + +;;; Copyright (C) 2006 g10 Code GmbH +;;; +;;; This file is part of GPGME-CL. +;;; +;;; GPGME-CL is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published +;;; by the Free Software Foundation; either version 2 of the License, +;;; or (at your option) any later version. +;;; +;;; GPGME-CL 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 General Public License +;;; along with GPGME; if not, write to the Free Software Foundation, +;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;;; Conventions: +;;; +;;; gpg-error is used for error handling. +;;; +;;; Standard I/O streams are used for input and output. + +(defpackage #:gpgme + (:use #:common-lisp #:cffi #:gpg-error) + + (:export #:check-version + #:*version* + #:context + #:protocol + #:armorp + #:textmodep + #:+include-certs-default+ + #:include-certs + #:keylist-mode + #:signers + #:sig-notations + #:with-context + #:key-data + #:get-key + #:op-encrypt + #:op-decrypt + #:op-sign + #:op-verify + #:op-import + #:op-export)) diff -urpNP gpgme-1.1.2/lang/cl/gpgme.asd gpgme-1.1.3/lang/cl/gpgme.asd --- gpgme-1.1.2/lang/cl/gpgme.asd 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/gpgme.asd 2007-01-29 20:17:39.000000000 +0000 @@ -0,0 +1,35 @@ +;;; -*- Mode: lisp -*- + +;;; Copyright (C) 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 GPGME; if not, write to the Free +;;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +;;; 02111-1307, USA. + +(defpackage #:gpgme-system + (:use #:common-lisp #:asdf)) + +(in-package #:gpgme-system) + +(defsystem gpgme + :description "GnuPG Made Easy." + :author "g10 Code GmbH" + :version "1.1.3" + :licence "GPL" + :depends-on ("cffi" "gpg-error") + :components ((:file "gpgme-package") + (:file "gpgme" + :depends-on ("gpgme-package")))) diff -urpNP gpgme-1.1.2/lang/cl/gpgme.asd.in gpgme-1.1.3/lang/cl/gpgme.asd.in --- gpgme-1.1.2/lang/cl/gpgme.asd.in 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/gpgme.asd.in 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,35 @@ +;;; -*- Mode: lisp -*- + +;;; Copyright (C) 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 GPGME; if not, write to the Free +;;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +;;; 02111-1307, USA. + +(defpackage #:gpgme-system + (:use #:common-lisp #:asdf)) + +(in-package #:gpgme-system) + +(defsystem gpgme + :description "GnuPG Made Easy." + :author "g10 Code GmbH" + :version "@VERSION@" + :licence "GPL" + :depends-on ("cffi" "gpg-error") + :components ((:file "gpgme-package") + (:file "gpgme" + :depends-on ("gpgme-package")))) diff -urpNP gpgme-1.1.2/lang/cl/gpgme.lisp gpgme-1.1.3/lang/cl/gpgme.lisp --- gpgme-1.1.2/lang/cl/gpgme.lisp 1970-01-01 00:00:00.000000000 +0000 +++ gpgme-1.1.3/lang/cl/gpgme.lisp 2007-01-29 20:16:20.000000000 +0000 @@ -0,0 +1,2077 @@ +;;;; gpgme.lisp + +;;; Copyright (C) 2006 g10 Code GmbH +;;; +;;; This file is part of GPGME-CL. +;;; +;;; GPGME-CL is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 2 of the License, or +;;; (at your option) any later version. +;;; +;;; GPGME-CL 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 General Public License +;;; along with GPGME; if not, write to the Free Software Foundation, +;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;;; TODO + +;;; Set up the library. + +(in-package :gpgme) + +;;; Debugging. + +(defvar *debug* nil "If debugging output should be given or not.") + +;;; Load the foreign library. + +(define-foreign-library libgpgme + (:unix "libgpgme.so") + (t (:default "libgpgme"))) + +(use-foreign-library libgpgme) + +;;; System dependencies. + +; FIXME: Use cffi-grovel? cffi-unix? + +(defctype size-t :unsigned-int + :documentation "The system size_t type.") + +(defctype ssize-t :int + :documentation "The system ssize_t type.") + +; FIXME: Ouch. Grovel? Helper function? +(defconstant +seek-set+ 0) +(defconstant +seek-cur+ 1) +(defconstant +seek-end+ 2) +(defctype off-t :long-long + :documentation "The system off_t type.") + +(defcfun ("strerror" c-strerror) :string + (err :int)) + +; Access to ERRNO. +; FIXME: Ouch. Should be grovel + helper function. + +(define-condition system-error (error) + ((errno :initarg :errno :reader system-error-errno)) + (:report (lambda (c stream) + (format stream "System error: ~A: ~A" + (system-error-errno c) + (c-strerror (system-error-errno c))))) + (:documentation "Signalled when an errno is encountered.")) + +(defconstant +ebadf+ 1) + +; Ouch. +(defun get-errno () + +ebadf+) + +;;; More about errno below. + +; Needed to write passphrases. +(defcfun ("write" c-write) ssize-t + (fd :int) + (buffer :string) ; Actually :pointer, but we only need string. + (size size-t)) + +(defun system-write (fd buffer size) + (let ((res (c-write fd buffer size))) + (when (< res 0) (error 'system-error :errno (get-errno))) + res)) + +;;; More about errno here. + +(defun set-errno (errno) + (cond + ; Works on GNU/Linux. + ((eql errno +ebadf+) (system-write -1 (null-pointer) 0)) + (t (error 'invalid-errno :errno errno)))) + +;;; +;;; C Interface Definitions +;;; + +;;; Data Type Interface + +;;; Some new data types used for easier translation. + +;;; The number of include certs. Translates to NIL for default. +(defctype cert-int-t :int) + +;;; A string that may be NIL to indicate a null pointer. +(defctype string-or-nil-t :string) + +;;; Some opaque data types used by GPGME. + +(defctype gpgme-ctx-t :pointer + :documentation "The GPGME context type.") + +(defctype gpgme-data-t :pointer + :documentation "The GPGME data object type.") + +;;; Wrappers for the libgpg-error library. + +(defctype gpgme-error-t gpg-error::gpg-error-t + :documentation "The GPGME error type.") + +(defctype gpgme-error-no-signal-t gpg-error::gpg-error-t + :documentation "The GPGME error type (this version does not + signal conditions in translation.") + +(defctype gpgme-err-code-t gpg-error::gpg-err-code-t + :documentation "The GPGME error code type.") + +(defctype gpgme-err-source-t gpg-error::gpg-err-source-t + :documentation "The GPGME error source type.") + +(defun gpgme-err-make (source code) + "Construct an error value from an error code and source." + (gpg-err-make source code)) + +(defun gpgme-error (code) + "Construct an error value from an error code." + (gpgme-err-make :gpg-err-source-gpgme code)) + +(defun gpgme-err-code (err) + "Retrieve an error code from the error value ERR." + (gpg-err-code err)) + +(defun gpgme-err-source (err) + "Retrieve an error source from the error value ERR." + (gpg-err-source err)) + +(defun gpgme-strerror (err) + "Return a string containig a description of the error code." + (gpg-strerror err)) + +(defun gpgme-strsource (err) + "Return a string containig a description of the error source." + (gpg-strsource err)) + +(defun gpgme-err-code-from-errno (err) + "Retrieve the error code for the system error. If the system error + is not mapped, :gpg-err-unknown-errno is returned." + (gpg-err-code-from-errno err)) + +(defun gpgme-err-code-to-errno (code) + "Retrieve the system error for the error code. If this is not a + system error, 0 is returned." + (gpg-err-code-to-errno code)) + +(defun gpgme-err-make-from-errno (source err) + (gpg-err-make-from-errno source err)) + +(defun gpgme-error-from-errno (err) + (gpg-error-from-errno err)) + +;;; + +(defcenum gpgme-data-encoding-t + "The possible encoding mode of gpgme-data-t objects." + (:none 0) + (:binary 1) + (:base64 2) + (:armor 3)) + +;;; + +(defcenum gpgme-pubkey-algo-t + "Public key algorithms from libgcrypt." + (:rsa 1) + (:rsa-e 2) + (:rsa-s 3) + (:elg-e 16) + (:dsa 17) + (:elg 20)) + +(defcenum gpgme-hash-algo-t + "Hash algorithms from libgcrypt." + (:none 0) + (:md5 1) + (:sha1 2) + (:rmd160 3) + (:md2 5) + (:tiger 6) + (:haval 7) + (:sha256 8) + (:sha384 9) + (:sha512 10) + (:md4 301) + (:crc32 302) + (:crc32-rfc1510 303) + (:crc24-rfc2440 304)) + +;;; + +(defcenum gpgme-sig-mode-t + "The available signature modes." + (:none 0) + (:detach 1) + (:clear 2)) + +;;; + +(defcenum gpgme-validity-t + "The available validities for a trust item or key." + (:unknown 0) + (:undefined 1) + (:never 2) + (:marginal 3) + (:full 4) + (:ultimate 5)) + +;;; + +(defcenum gpgme-protocol-t + "The available protocols." + (:openpgp 0) + (:cms 1)) + +;;; + +(defbitfield (gpgme-keylist-mode-t :unsigned-int) + "The available keylist mode flags." + (:local 1) + (:extern 2) + (:sigs 4) + (:validate 256)) + +;;; + +(defbitfield (gpgme-sig-notation-flags-t :unsigned-int) + "The available signature notation flags." + (:human-readable 1) + (:critical 2)) + +(defctype gpgme-sig-notation-t :pointer + :documentation "Signature notation pointer type.") + +;; FIXME: Doesn't this depend on endianess? +(defbitfield (gpgme-sig-notation-bitfield :unsigned-int) + (:human-readable 1) + (:critical 2)) + +(defcstruct gpgme-sig-notation + "Signature notations." + (next gpgme-sig-notation-t) + (name :pointer) + (value :pointer) + (name-len :int) + (value-len :int) + (flags gpgme-sig-notation-flags-t) + (bitfield gpgme-sig-notation-bitfield)) + +;;; + +;; FIXME: Add status codes. +(defcenum gpgme-status-code-t + "The possible status codes for the edit operation." + (:eof 0) + (:enter 1)) + +;;; + +(defctype gpgme-engine-info-t :pointer + :documentation "The engine information structure pointer type.") + +(defcstruct gpgme-engine-info + "Engine information." + (next gpgme-engine-info-t) + (protocol gpgme-protocol-t) + (file-name :string) + (version :string) + (req-version :string) + (home-dir :string)) + +;;; + +(defctype gpgme-subkey-t :pointer + :documentation "A subkey from a key.") + +;; FIXME: Doesn't this depend on endianess? +(defbitfield (gpgme-subkey-bitfield :unsigned-int) + "The subkey bitfield." + (:revoked 1) + (:expired 2) + (:disabled 4) + (:invalid 8) + (:can-encrypt 16) + (:can-sign 32) + (:can-certify 64) + (:secret 128) + (:can-authenticate 256) + (:is-qualified 512)) + +(defcstruct gpgme-subkey + "Subkey from a key." + (next gpgme-subkey-t) + (bitfield gpgme-subkey-bitfield) + (pubkey-algo gpgme-pubkey-algo-t) + (length :unsigned-int) + (keyid :string) + (-keyid :char :count 17) + (fpr :string) + (timestamp :long) + (expires :long)) + + +(defctype gpgme-key-sig-t :pointer + :documentation "A signature on a user ID.") + +;; FIXME: Doesn't this depend on endianess? +(defbitfield (gpgme-key-sig-bitfield :unsigned-int) + "The key signature bitfield." + (:revoked 1) + (:expired 2) + (:invalid 4) + (:exportable 16)) + +(defcstruct gpgme-key-sig + "A signature on a user ID." + (next gpgme-key-sig-t) + (bitfield gpgme-key-sig-bitfield) + (pubkey-algo gpgme-pubkey-algo-t) + (keyid :string) + (-keyid :char :count 17) + (timestamp :long) + (expires :long) + (status gpgme-error-no-signal-t) + (-class :unsigned-int) + (uid :string) + (name :string) + (email :string) + (comment :string) + (sig-class :unsigned-int)) + + +(defctype gpgme-user-id-t :pointer + :documentation "A user ID from a key.") + +;; FIXME: Doesn't this depend on endianess? +(defbitfield (gpgme-user-id-bitfield :unsigned-int) + "The user ID bitfield." + (:revoked 1) + (:invalid 2)) + +(defcstruct gpgme-user-id + "A user ID from a key." + (next gpgme-user-id-t) + (bitfield gpgme-user-id-bitfield) + (validity gpgme-validity-t) + (uid :string) + (name :string) + (email :string) + (comment :string) + (signatures gpgme-key-sig-t) + (-last-keysig gpgme-key-sig-t)) + + +(defctype gpgme-key-t :pointer + :documentation "A key from the keyring.") + +;; FIXME: Doesn't this depend on endianess? +(defbitfield (gpgme-key-bitfield :unsigned-int) + "The key bitfield." + (:revoked 1) + (:expired 2) + (:disabled 4) + (:invalid 8) + (:can-encrypt 16) + (:can-sign 32) + (:can-certify 64) + (:secret 128) + (:can-authenticate 256) + (:is-qualified 512)) + +(defcstruct gpgme-key + "A signature on a user ID." + (-refs :unsigned-int) + (bitfield gpgme-key-bitfield) + (protocol gpgme-protocol-t) + (issuer-serial :string) + (issuer-name :string) + (chain-id :string) + (owner-trust gpgme-validity-t) + (subkeys gpgme-subkey-t) + (uids gpgme-user-id-t) + (-last-subkey gpgme-subkey-t) + (-last-uid gpgme-user-id-t) + (keylist-mode gpgme-keylist-mode-t)) + +;;; + +;;; There is no support in CFFI to define callback C types and have +;;; automatic type checking with the callback definition. + +(defctype gpgme-passphrase-cb-t :pointer) + +(defctype gpgme-progress-cb-t :pointer) + +(defctype gpgme-edit-cb-t :pointer) + + +;;; +;;; Function Interface +;;; + +;;; Context management functions. + +(defcfun ("gpgme_new" c-gpgme-new) gpgme-error-t + (ctx :pointer)) + +(defcfun ("gpgme_release" c-gpgme-release) :void + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_set_protocol" c-gpgme-set-protocol) gpgme-error-t + (ctx gpgme-ctx-t) + (proto gpgme-protocol-t)) + +(defcfun ("gpgme_get_protocol" c-gpgme-get-protocol) gpgme-protocol-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_get_protocol_name" c-gpgme-get-protocol-name) :string + (proto gpgme-protocol-t)) + +(defcfun ("gpgme_set_armor" c-gpgme-set-armor) :void + (ctx gpgme-ctx-t) + (yes :boolean)) + +(defcfun ("gpgme_get_armor" c-gpgme-get-armor) :boolean + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_set_textmode" c-gpgme-set-textmode) :void + (ctx gpgme-ctx-t) + (yes :boolean)) + +(defcfun ("gpgme_get_textmode" c-gpgme-get-textmode) :boolean + (ctx gpgme-ctx-t)) + +(defconstant +include-certs-default+ -256) + +(defcfun ("gpgme_set_include_certs" c-gpgme-set-include-certs) :void + (ctx gpgme-ctx-t) + (nr-of-certs cert-int-t)) + +(defcfun ("gpgme_get_include_certs" c-gpgme-get-include-certs) cert-int-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_set_keylist_mode" c-gpgme-set-keylist-mode) gpgme-error-t + (ctx gpgme-ctx-t) + (mode gpgme-keylist-mode-t)) + +(defcfun ("gpgme_get_keylist_mode" c-gpgme-get-keylist-mode) + gpgme-keylist-mode-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_set_passphrase_cb" c-gpgme-set-passphrase-cb) :void + (ctx gpgme-ctx-t) + (cb gpgme-passphrase-cb-t) + (hook-value :pointer)) + +(defcfun ("gpgme_get_passphrase_cb" c-gpgme-get-passphrase-cb) :void + (ctx gpgme-ctx-t) + (cb-p :pointer) + (hook-value-p :pointer)) + +(defcfun ("gpgme_set_progress_cb" c-gpgme-set-progress-cb) :void + (ctx gpgme-ctx-t) + (cb gpgme-progress-cb-t) + (hook-value :pointer)) + +(defcfun ("gpgme_get_progress_cb" c-gpgme-get-progress-cb) :void + (ctx gpgme-ctx-t) + (cb-p :pointer) + (hook-value-p :pointer)) + +(defcfun ("gpgme_set_locale" c-gpgme-set-locale) gpgme-error-t + (ctx gpgme-ctx-t) + (category :int) + (value string-or-nil-t)) + +(defcfun ("gpgme_ctx_get_engine_info" c-gpgme-ctx-get-engine-info) + gpgme-engine-info-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_ctx_set_engine_info" c-gpgme-ctx-set-engine-info) + gpgme-error-t + (ctx gpgme-ctx-t) + (proto gpgme-protocol-t) + (file-name string-or-nil-t) + (home-dir string-or-nil-t)) + +;;; + +(defcfun ("gpgme_pubkey_algo_name" c-gpgme-pubkey-algo-name) :string + (algo gpgme-pubkey-algo-t)) + +(defcfun ("gpgme_hash_algo_name" c-gpgme-hash-algo-name) :string + (algo gpgme-hash-algo-t)) + +;;; + +(defcfun ("gpgme_signers_clear" c-gpgme-signers-clear) :void + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_signers_add" c-gpgme-signers-add) gpgme-error-t + (ctx gpgme-ctx-t) + (key gpgme-key-t)) + +(defcfun ("gpgme_signers_enum" c-gpgme-signers-enum) gpgme-key-t + (ctx gpgme-ctx-t) + (seq :int)) + +;;; + +(defcfun ("gpgme_sig_notation_clear" c-gpgme-sig-notation-clear) :void + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_sig_notation_add" c-gpgme-sig-notation-add) gpgme-error-t + (ctx gpgme-ctx-t) + (name :string) + (value string-or-nil-t) + (flags gpgme-sig-notation-flags-t)) + +(defcfun ("gpgme_sig_notation_get" c-gpgme-sig-notation-get) + gpgme-sig-notation-t + (ctx gpgme-ctx-t)) + +;;; Run Control. + +;;; There is no support in CFFI to define callback C types and have +;;; automatic type checking with the callback definition. + +(defctype gpgme-io-cb-t :pointer) + +(defctype gpgme-register-io-cb-t :pointer) + +(defctype gpgme-remove-io-cb-t :pointer) + +(defcenum gpgme-event-io-t + "The possible events on I/O event callbacks." + (:start 0) + (:done 1) + (:next-key 2) + (:next-trustitem 3)) + +(defctype gpgme-event-io-cb-t :pointer) + +(defcstruct gpgme-io-cbs + "I/O callbacks." + (add gpgme-register-io-cb-t) + (add-priv :pointer) + (remove gpgme-remove-io-cb-t) + (event gpgme-event-io-cb-t) + (event-priv :pointer)) + +(defctype gpgme-io-cbs-t :pointer) + +(defcfun ("gpgme_set_io_cbs" c-gpgme-set-io-cbs) :void + (ctx gpgme-ctx-t) + (io-cbs gpgme-io-cbs-t)) + +(defcfun ("gpgme_get_io_cbs" c-gpgme-get-io-cbs) :void + (ctx gpgme-ctx-t) + (io-cbs gpgme-io-cbs-t)) + +(defcfun ("gpgme_wait" c-gpgme-wait) gpgme-ctx-t + (ctx gpgme-ctx-t) + (status-p :pointer) + (hang :int)) + +;;; Functions to handle data objects. + +;;; There is no support in CFFI to define callback C types and have +;;; automatic type checking with the callback definition. + +(defctype gpgme-data-read-cb-t :pointer) +(defctype gpgme-data-write-cb-t :pointer) +(defctype gpgme-data-seek-cb-t :pointer) +(defctype gpgme-data-release-cb-t :pointer) + +(defcstruct gpgme-data-cbs + "Data callbacks." + (read gpgme-data-read-cb-t) + (write gpgme-data-write-cb-t) + (seek gpgme-data-seek-cb-t) + (release gpgme-data-release-cb-t)) + +(defctype gpgme-data-cbs-t :pointer + :documentation "Data callbacks pointer.") + +(defcfun ("gpgme_data_read" c-gpgme-data-read) ssize-t + (dh gpgme-data-t) + (buffer :pointer) + (size size-t)) + +(defcfun ("gpgme_data_write" c-gpgme-data-write) ssize-t + (dh gpgme-data-t) + (buffer :pointer) + (size size-t)) + +(defcfun ("gpgme_data_seek" c-gpgme-data-seek) off-t + (dh gpgme-data-t) + (offset off-t) + (whence :int)) + +(defcfun ("gpgme_data_new" c-gpgme-data-new) gpgme-error-t + (dh-p :pointer)) + +(defcfun ("gpgme_data_release" c-gpgme-data-release) :void + (dh gpgme-data-t)) + +(defcfun ("gpgme_data_new_from_mem" c-gpgme-data-new-from-mem) gpgme-error-t + (dh-p :pointer) + (buffer :pointer) + (size size-t) + (copy :int)) + +(defcfun ("gpgme_data_release_and_get_mem" c-gpgme-data-release-and-get-mem) + :pointer + (dh gpgme-data-t) + (len-p :pointer)) + +(defcfun ("gpgme_data_new_from_cbs" c-gpgme-data-new-from-cbs) gpgme-error-t + (dh-p :pointer) + (cbs gpgme-data-cbs-t) + (handle :pointer)) + +(defcfun ("gpgme_data_new_from_fd" c-gpgme-data-new-from-fd) gpgme-error-t + (dh-p :pointer) + (fd :int)) + +(defcfun ("gpgme_data_new_from_stream" c-gpgme-data-new-from-stream) + gpgme-error-t + (dh-p :pointer) + (stream :pointer)) + +(defcfun ("gpgme_data_get_encoding" c-gpgme-data-get-encoding) + gpgme-data-encoding-t + (dh gpgme-data-t)) + +(defcfun ("gpgme_data_set_encoding" c-gpgme-data-set-encoding) + gpgme-error-t + (dh gpgme-data-t) + (enc gpgme-data-encoding-t)) + +(defcfun ("gpgme_data_get_file_name" c-gpgme-data-get-file-name) :string + (dh gpgme-data-t)) + +(defcfun ("gpgme_data_set_file_name" c-gpgme-data-set-file-name) gpgme-error-t + (dh gpgme-data-t) + (file-name string-or-nil-t)) + +(defcfun ("gpgme_data_new_from_file" c-gpgme-data-new-from-file) gpgme-error-t + (dh-p :pointer) + (fname :string) + (copy :int)) + +(defcfun ("gpgme_data_new_from_filepart" c-gpgme-data-new-from-filepart) + gpgme-error-t + (dh-p :pointer) + (fname :string) + (fp :pointer) + (offset off-t) + (length size-t)) + +;;; Key and trust functions. + +(defcfun ("gpgme_get_key" c-gpgme-get-key) gpgme-error-t + (ctx gpgme-ctx-t) + (fpr :string) + (key-p :pointer) + (secret :boolean)) + +(defcfun ("gpgme_key_ref" c-gpgme-key-ref) :void + (key gpgme-key-t)) + +(defcfun ("gpgme_key_unref" c-gpgme-key-unref) :void + (key gpgme-key-t)) + +;;; Crypto operations. + +(defcfun ("gpgme_cancel" c-gpgme-cancel) gpgme-error-t + (ctx gpgme-ctx-t)) + +;;; + +(defctype gpgme-invalid-key-t :pointer + :documentation "An invalid key structure.") + +(defcstruct gpgme-invalid-key + "An invalid key structure." + (next gpgme-invalid-key-t) + (fpr :string) + (reason gpgme-error-no-signal-t)) + +;;; Encryption. + +(defcstruct gpgme-op-encrypt-result + "Encryption result structure." + (invalid-recipients gpgme-invalid-key-t)) + +(defctype gpgme-op-encrypt-result-t :pointer + :documentation "An encryption result structure.") + +(defcfun ("gpgme_op_encrypt_result" c-gpgme-op-encrypt-result) + gpgme-op-encrypt-result-t + (ctx gpgme-ctx-t)) + +(defbitfield gpgme-encrypt-flags-t + (:always-trust 1)) + +(defcfun ("gpgme_op_encrypt_start" c-gpgme-op-encrypt-start) gpgme-error-t + (ctx gpgme-ctx-t) + (recp :pointer) ; Key array. + (flags gpgme-encrypt-flags-t) + (plain gpgme-data-t) + (cipher gpgme-data-t)) + +(defcfun ("gpgme_op_encrypt" c-gpgme-op-encrypt) gpgme-error-t + (ctx gpgme-ctx-t) + (recp :pointer) ; Key array. + (flags gpgme-encrypt-flags-t) + (plain gpgme-data-t) + (cipher gpgme-data-t)) + +(defcfun ("gpgme_op_encrypt_sign_start" c-gpgme-op-encrypt-sign-start) + gpgme-error-t + (ctx gpgme-ctx-t) + (recp :pointer) ; Key array. + (flags gpgme-encrypt-flags-t) + (plain gpgme-data-t) + (cipher gpgme-data-t)) + +(defcfun ("gpgme_op_encrypt_sign" c-gpgme-op-encrypt-sign) gpgme-error-t + (ctx gpgme-ctx-t) + (recp :pointer) ; Key array. + (flags gpgme-encrypt-flags-t) + (plain gpgme-data-t) + (cipher gpgme-data-t)) + +;;; Decryption. + +(defctype gpgme-recipient-t :pointer + :documentation "A recipient structure.") + +(defcstruct gpgme-recipient + "Recipient structure." + (next gpgme-recipient-t) + (keyid :string) + (-keyid :char :count 17) + (pubkey-algo gpgme-pubkey-algo-t) + (status gpgme-error-no-signal-t)) + +(defbitfield gpgme-op-decrypt-result-bitfield + "Decryption result structure bitfield." + (:wrong-key-usage 1)) + +(defcstruct gpgme-op-decrypt-result + "Decryption result structure." + (unsupported-algorithm :string) + (bitfield gpgme-op-decrypt-result-bitfield) + (recipients gpgme-recipient-t) + (file-name :string)) + +(defctype gpgme-op-decrypt-result-t :pointer + :documentation "A decryption result structure.") + +(defcfun ("gpgme_op_decrypt_result" c-gpgme-op-decrypt-result) + gpgme-op-decrypt-result-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_op_decrypt_start" c-gpgme-op-decrypt-start) gpgme-error-t + (ctx gpgme-ctx-t) + (cipher gpgme-data-t) + (plain gpgme-data-t)) + +(defcfun ("gpgme_op_decrypt" c-gpgme-op-decrypt) gpgme-error-t + (ctx gpgme-ctx-t) + (cipher gpgme-data-t) + (plain gpgme-data-t)) + +(defcfun ("gpgme_op_decrypt_verify_start" c-gpgme-op-decrypt-verify-start) + gpgme-error-t + (ctx gpgme-ctx-t) + (cipher gpgme-data-t) + (plain gpgme-data-t)) + +(defcfun ("gpgme_op_decrypt_verify" c-gpgme-op-decrypt-verify) gpgme-error-t + (ctx gpgme-ctx-t) + (cipher gpgme-data-t) + (plain gpgme-data-t)) + +;;; Signing. + +(defctype gpgme-new-signature-t :pointer + :documentation "A new signature structure.") + +(defcstruct gpgme-new-signature + "New signature structure." + (next gpgme-new-signature-t) + (type gpgme-sig-mode-t) + (pubkey-algo gpgme-pubkey-algo-t) + (hash-algo gpgme-hash-algo-t) + (-obsolete-class :unsigned-long) + (timestamp :long) + (fpr :string) + (-obsolete-class-2 :unsigned-int) + (sig-class :unsigned-int)) + +(defcstruct gpgme-op-sign-result + "Signing result structure." + (invalid-signers gpgme-invalid-key-t) + (signatures gpgme-new-signature-t)) + +(defctype gpgme-op-sign-result-t :pointer + :documentation "A signing result structure.") + +(defcfun ("gpgme_op_sign_result" c-gpgme-op-sign-result) + gpgme-op-sign-result-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_op_sign_start" c-gpgme-op-sign-start) gpgme-error-t + (ctx gpgme-ctx-t) + (plain gpgme-data-t) + (sig gpgme-data-t) + (mode gpgme-sig-mode-t)) + +(defcfun ("gpgme_op_sign" c-gpgme-op-sign) gpgme-error-t + (ctx gpgme-ctx-t) + (plain gpgme-data-t) + (sig gpgme-data-t) + (mode gpgme-sig-mode-t)) + +;;; Verify. + +(defbitfield (gpgme-sigsum-t :unsigned-int) + "Flags used for the summary field in a gpgme-signature-t." + (:valid #x0001) + (:green #x0002) + (:red #x0004) + (:key-revoked #x0010) + (:key-expired #x0020) + (:sig-expired #x0040) + (:key-missing #x0080) + (:crl-missing #x0100) + (:crl-too-old #x0200) + (:bad-policy #x0400) + (:sys-error #x0800)) + +(defctype gpgme-signature-t :pointer + :documentation "A signature structure.") + +;; FIXME: Doesn't this depend on endianess? +(defbitfield (gpgme-signature-bitfield :unsigned-int) + "The signature bitfield." + (:wrong-key-usage 1)) + +(defcstruct gpgme-signature + "Signature structure." + (next gpgme-signature-t) + (summary gpgme-sigsum-t) + (fpr :string) + (status gpgme-error-no-signal-t) + (notations gpgme-sig-notation-t) + (timestamp :unsigned-long) + (exp-timestamp :unsigned-long) + (bitfield gpgme-signature-bitfield) + (validity gpgme-validity-t) + (validity-reason gpgme-error-no-signal-t) + (pubkey-algo gpgme-pubkey-algo-t) + (hash-algo gpgme-hash-algo-t)) + +(defcstruct gpgme-op-verify-result + "Verify result structure." + (signatures gpgme-signature-t) + (file-name :string)) + +(defctype gpgme-op-verify-result-t :pointer + :documentation "A verify result structure.") + +(defcfun ("gpgme_op_verify_result" c-gpgme-op-verify-result) + gpgme-op-verify-result-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_op_verify_start" c-gpgme-op-verify-start) gpgme-error-t + (ctx gpgme-ctx-t) + (sig gpgme-data-t) + (signed-text gpgme-data-t) + (plaintext gpgme-data-t)) + +(defcfun ("gpgme_op_verify" c-gpgme-op-verify) gpgme-error-t + (ctx gpgme-ctx-t) + (sig gpgme-data-t) + (signed-text gpgme-data-t) + (plaintext gpgme-data-t)) + +;;; Import. + +(defbitfield (gpgme-import-flags-t :unsigned-int) + "Flags used for the import status field." + (:new #x0001) + (:uid #x0002) + (:sig #x0004) + (:subkey #x0008) + (:secret #x0010)) + +(defctype gpgme-import-status-t :pointer + :documentation "An import status structure.") + +(defcstruct gpgme-import-status + "New import status structure." + (next gpgme-import-status-t) + (fpr :string) + (result gpgme-error-no-signal-t) + (status :unsigned-int)) + +(defcstruct gpgme-op-import-result + "Import result structure." + (considered :int) + (no-user-id :int) + (imported :int) + (imported-rsa :int) + (unchanged :int) + (new-user-ids :int) + (new-sub-keys :int) + (new-signatures :int) + (new-revocations :int) + (secret-read :int) + (secret-imported :int) + (secret-unchanged :int) + (skipped-new-keys :int) + (not-imported :int) + (imports gpgme-import-status-t)) + +(defctype gpgme-op-import-result-t :pointer + :documentation "An import status result structure.") + +(defcfun ("gpgme_op_import_result" c-gpgme-op-import-result) + gpgme-op-import-result-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_op_import_start" c-gpgme-op-import-start) gpgme-error-t + (ctx gpgme-ctx-t) + (keydata gpgme-data-t)) + +(defcfun ("gpgme_op_import" c-gpgme-op-import) gpgme-error-t + (ctx gpgme-ctx-t) + (keydata gpgme-data-t)) + +;;; Export. + +(defcfun ("gpgme_op_export_start" c-gpgme-op-export-start) gpgme-error-t + (ctx gpgme-ctx-t) + (pattern :string) + (reserved :unsigned-int) + (keydata gpgme-data-t)) + +(defcfun ("gpgme_op_export" c-gpgme-op-export) gpgme-error-t + (ctx gpgme-ctx-t) + (pattern :string) + (reserved :unsigned-int) + (keydata gpgme-data-t)) + +;;; FIXME: Extended export interfaces require array handling. + +;;; Key generation. + +(defbitfield (gpgme-genkey-flags-t :unsigned-int) + "Flags used for the key generation result bitfield." + (:primary #x0001) + (:sub #x0002)) + +(defcstruct gpgme-op-genkey-result + "Key generation result structure." + (bitfield gpgme-genkey-flags-t) + (fpr :string)) + +(defctype gpgme-op-genkey-result-t :pointer + :documentation "A key generation result structure.") + +(defcfun ("gpgme_op_genkey_result" c-gpgme-op-genkey-result) + gpgme-op-genkey-result-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_op_genkey_start" c-gpgme-op-genkey-start) gpgme-error-t + (ctx gpgme-ctx-t) + (parms :string) + (pubkey gpgme-data-t) + (seckey gpgme-data-t)) + +(defcfun ("gpgme_op_genkey" c-gpgme-op-genkey) gpgme-error-t + (ctx gpgme-ctx-t) + (parms :string) + (pubkey gpgme-data-t) + (seckey gpgme-data-t)) + +;;; Key deletion. + +(defcfun ("gpgme_op_delete_start" c-gpgme-op-delete-start) gpgme-error-t + (ctx gpgme-ctx-t) + (key gpgme-key-t) + (allow-secret :int)) + +(defcfun ("gpgme_op_delete" c-gpgme-op-delete) gpgme-error-t + (ctx gpgme-ctx-t) + (key gpgme-key-t) + (allow-secret :int)) + +;;; FIXME: Add edit interfaces. + +;;; Keylist interface. + +(defbitfield (gpgme-keylist-flags-t :unsigned-int) + "Flags used for the key listing result bitfield." + (:truncated #x0001)) + +(defcstruct gpgme-op-keylist-result + "Key listing result structure." + (bitfield gpgme-keylist-flags-t)) + +(defctype gpgme-op-keylist-result-t :pointer + :documentation "A key listing result structure.") + +(defcfun ("gpgme_op_keylist_result" c-gpgme-op-keylist-result) + gpgme-op-keylist-result-t + (ctx gpgme-ctx-t)) + +(defcfun ("gpgme_op_keylist_start" c-gpgme-op-keylist-start) gpgme-error-t + (ctx gpgme-ctx-t) + (pattern :string) + (secret_only :boolean)) + +;;; FIXME: Extended keylisting requires array handling. + +(defcfun ("gpgme_op_keylist_next" c-gpgme-op-keylist-next) gpgme-error-t + (ctx gpgme-ctx-t) + (r-key :pointer)) + +(defcfun ("gpgme_op_keylist_end" c-gpgme-op-keylist-end) gpgme-error-t + (ctx gpgme-ctx-t)) + +;;; Various functions. + +(defcfun ("gpgme_check_version" c-gpgme-check-version) :string + (req-version string-or-nil-t)) + +(defcfun ("gpgme_get_engine_info" c-gpgme-get-engine-info) gpgme-error-t + (engine-info-p :pointer)) + +(defcfun ("gpgme_set_engine_info" c-gpgme-set-engine-info) gpgme-error-t + (proto gpgme-protocol-t) + (file-name string-or-nil-t) + (home-dir string-or-nil-t)) + +(defcfun ("gpgme_engine_check_version" c-gpgme-engine-check-verson) + gpgme-error-t + (proto gpgme-protocol-t)) + +;;; +;;; L I S P I N T E R F A C E +;;; + +;;; +;;; Lisp type translators. +;;; + +;;; Both directions. + +;;; cert-int-t is a helper type that takes care of representing the +;;; default number of certs as NIL. + +(defmethod translate-from-foreign (value (type (eql 'cert-int-t))) + (cond + ((eql value +include-certs-default+) nil) + (t value))) + +(defmethod translate-to-foreign (value (type (eql 'cert-int-t))) + (cond + (value value) + (t +include-certs-default+))) + +;;; string-or-nil-t translates a null pointer to NIL and vice versa. +;;; Translation from foreign null pointer already works as expected. +;;; FIXME: May the "to foreign" conversion problem be a bug in CFFI? + +(defmethod translate-to-foreign (value (type (eql 'string-or-nil-t))) + (cond + (value value) + (t (null-pointer)))) + +;;; Output only. + +;;; These type translators only convert from foreign type, because we +;;; never use these types in the other direction. + +;;; Convert gpgme-engine-info-t linked lists into a list of property +;;; lists. Note that this converter will automatically be invoked +;;; recursively. +;;; +;;; FIXME: Should we use a hash table (or struct, or clos) instead of +;;; property list, as recommended by the Lisp FAQ? + +(defmethod translate-from-foreign (value (type (eql 'gpgme-engine-info-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next protocol file-name version req-version home-dir) + value gpgme-engine-info) + (append (list protocol (list + :file-name file-name + :version version + :req-version req-version + :home-dir home-dir)) + next))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-invalid-key-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next fpr reason) + value gpgme-invalid-key) + (append (list (list :fpr fpr + :reason reason)) + next))))) + +(defmethod translate-from-foreign (value + (type (eql 'gpgme-op-encrypt-result-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((invalid-recipients) + value gpgme-op-encrypt-result) + (list :encrypt + (list :invalid-recipients invalid-recipients)))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-recipient-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next keyid pubkey-algo status) + value gpgme-recipient) + (append (list (list :keyid keyid + :pubkey-algo pubkey-algo + :status status)) + next))))) + +(defmethod translate-from-foreign (value + (type (eql 'gpgme-op-decrypt-result-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((unsupported-algorithm bitfield recipients file-name) + value gpgme-op-decrypt-result) + (list :decrypt (list :unsupported-algorithm unsupported-algorithm + :bitfield bitfield + :recipients recipients + :file-name file-name)))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-new-signature-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next type pubkey-algo hash-algo timestamp fpr sig-class) + value gpgme-new-signature) + (append (list (list :type type + :pubkey-algo pubkey-algo + :hash-algo hash-algo + :timestamp timestamp + :fpr fpr + :sig-class sig-class)) + next))))) + +(defmethod translate-from-foreign (value + (type (eql 'gpgme-op-sign-result-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((invalid-signers signatures) + value gpgme-op-sign-result) + (list :sign (list :invalid-signers invalid-signers + :signatures signatures)))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-signature-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next summary fpr status notations timestamp + exp-timestamp bitfield validity validity-reason + pubkey-algo hash-algo) + value gpgme-signature) + (append (list (list :summary summary + :fpr fpr + :status status + :notations notations + :timestamp timestamp + :exp-timestamp exp-timestamp + :bitfield bitfield + :validity validity + :validity-reason validity-reason + :pubkey-algo pubkey-algo)) + next))))) + +(defmethod translate-from-foreign (value + (type (eql 'gpgme-op-verify-result-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((signatures file-name) + value gpgme-op-verify-result) + (list :verify (list :signatures signatures + :file-name file-name)))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-import-status-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next fpr result status) + value gpgme-import-status) + (append (list (list :fpr fpr + :result result + :status status)) + next))))) + +(defmethod translate-from-foreign (value + (type (eql 'gpgme-op-import-result-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((considered no-user-id imported imported-rsa unchanged + new-user-ids new-sub-keys new-signatures + new-revocations secret-read secret-imported + secret-unchanged skipped-new-keys not-imported + imports) + value gpgme-op-import-result) + (list :verify (list :considered considered + :no-user-id no-user-id + :imported imported + :imported-rsa imported-rsa + :unchanged unchanged + :new-user-ids new-user-ids + :new-sub-keys new-sub-keys + :new-signatures new-signatures + :new-revocations new-revocations + :secret-read secret-read + :secret-imported secret-imported + :secret-unchanged secret-unchanged + :skipped-new-keys skipped-new-keys + :not-imported not-imported + :imports imports)))))) + +;;; Error handling. + +;;; Use gpgme-error-no-signal-t to suppress automatic error handling +;;; at translation time. +;;; +;;; FIXME: Part of this probably should be in gpg-error! + +(define-condition gpgme-error (error) + ((value :initarg :gpgme-error :reader gpgme-error-value)) + (:report (lambda (c stream) + (format stream "GPGME returned error: ~A (~A)" + (gpgme-strerror (gpgme-error-value c)) + (gpgme-strsource (gpgme-error-value c))))) + (:documentation "Signalled when a GPGME function returns an error.")) + +(defmethod translate-from-foreign (value (name (eql 'gpgme-error-t))) + "Raise a GPGME-ERROR if VALUE is non-zero." + (when (not (eql (gpgme-err-code value) :gpg-err-no-error)) + (error 'gpgme-error :gpgme-error value)) + (gpg-err-canonicalize value)) + +(defmethod translate-to-foreign (value (name (eql 'gpgme-error-t))) + "Canonicalize the error value." + (if (eql (gpgme-err-code value) :gpg-err-no-error) + 0 + (gpg-err-as-value value))) + +(defmethod translate-from-foreign (value (name (eql 'gpgme-error-no-signal-t))) + "Canonicalize the error value." + (gpg-err-canonicalize value)) + + +;;; *INTERNAL* Lispy Function Interface that is still close to the C +;;; interface. + +;;; Passphrase callback management. + +;;; Maybe: Instead, use subclassing, and provide a customizable +;;; default implementation for ease-of-use. + +(defvar *passphrase-handles* (make-hash-table) + "Hash table with GPGME context address as key and the corresponding + passphrase callback object as value.") + +(defcallback passphrase-cb gpgme-error-t ((handle :pointer) + (uid-hint :string) + (passphrase-info :string) + (prev-was-bad :boolean) + (fd :int)) + (handler-case + (let* ((passphrase-cb + (gethash (pointer-address handle) *passphrase-handles*)) + (passphrase + (cond + ((functionp passphrase-cb) + (concatenate 'string + (funcall passphrase-cb uid-hint passphrase-info + prev-was-bad) + '(#\Newline))) + (t (concatenate 'string passphrase-cb '(#\Newline))))) + (passphrase-len (length passphrase)) + ;; FIXME: Could be more robust. + (res (system-write fd passphrase passphrase-len))) + (cond + ((< res passphrase-len) ; FIXME: Blech. A weak attempt to be robust. + (gpgme-error :gpg-err-inval)) + (t (gpgme-error :gpg-err-no-error)))) + (gpgme-error (err) (gpgme-error-value err)) + (system-error (err) (gpgme-error-from-errno (system-error-errno err))) + ;; FIXME: The original error gets lost here. + (condition (err) (progn + (when *debug* + (format t "DEBUG: passphrase-cb: Unexpressable: ~A~%" + err)) + (gpgme-error :gpg-err-general))))) + +;;; CTX is a C-pointer to the context. +(defun gpgme-set-passphrase-cb (ctx cb) + "Set the passphrase callback for CTX." + (let ((handle (pointer-address ctx))) + (cond + (cb (setf (gethash handle *passphrase-handles*) cb) + (c-gpgme-set-passphrase-cb ctx (callback passphrase-cb) ctx)) + (t (c-gpgme-set-passphrase-cb ctx (null-pointer) (null-pointer)) + (remhash handle *passphrase-handles*))))) + +;;; Progress callback management. + +;;; Maybe: Instead, use subclassing, and provide a customizable +;;; default implementation for ease-of-use. + +(defvar *progress-handles* (make-hash-table) + "Hash table with GPGME context address as key and the corresponding + progress callback object as value.") + +(defcallback progress-cb :void ((handle :pointer) + (what :string) + (type :int) + (current :int) + (total :int)) + (handler-case + (let* ((progress-cb + (gethash (pointer-address handle) *progress-handles*))) + (funcall progress-cb what type current total)) + ;; FIXME: The original error gets lost here. + (condition (err) (when *debug* + (format t "DEBUG: progress-cb: Unexpressable: ~A~%" + err))))) + +;;; CTX is a C-pointer to the context. +(defun gpgme-set-progress-cb (ctx cb) + "Set the progress callback for CTX." + (let ((handle (pointer-address ctx))) + (cond + (cb (setf (gethash handle *progress-handles*) cb) + (c-gpgme-set-progress-cb ctx (callback progress-cb) ctx)) + (t (c-gpgme-set-progress-cb ctx (null-pointer) (null-pointer)) + (remhash handle *progress-handles*))))) + +;;; Context management. + +(defun gpgme-new (&key (protocol :openpgp) armor textmode include-certs + keylist-mode passphrase progress file-name home-dir) + "Allocate a new GPGME context." + (with-foreign-object (ctx-p 'gpgme-ctx-t) + (c-gpgme-new ctx-p) + (let ((ctx (mem-ref ctx-p 'gpgme-ctx-t))) + ;;; Set locale? + (gpgme-set-protocol ctx protocol) + (gpgme-set-armor ctx armor) + (gpgme-set-textmode ctx textmode) + (when include-certs (gpgme-set-include-certs ctx include-certs)) + (when keylist-mode (gpgme-set-keylist-mode ctx keylist-mode)) + (gpgme-set-passphrase-cb ctx passphrase) + (gpgme-set-progress-cb ctx progress) + (gpgme-set-engine-info ctx protocol + :file-name file-name :home-dir home-dir) + (when *debug* (format t "DEBUG: gpgme-new: ~A~%" ctx)) + ctx))) + +(defun gpgme-release (ctx) + "Release a GPGME context." + (when *debug* (format t "DEBUG: gpgme-release: ~A~%" ctx)) + (c-gpgme-release ctx)) + +(defun gpgme-set-protocol (ctx proto) + "Set the protocol to be used by CTX to PROTO." + (c-gpgme-set-protocol ctx proto)) + +(defun gpgme-get-protocol (ctx) + "Get the protocol used with CTX." + (c-gpgme-get-protocol ctx)) + +;;; FIXME: How to do pretty printing? +;;; +;;; gpgme-get-protocol-name + +(defun gpgme-set-armor (ctx armor) + "If ARMOR is true, enable armor mode in CTX, disable it otherwise." + (c-gpgme-set-armor ctx armor)) + +(defun gpgme-armor-p (ctx) + "Return true if armor mode is set for CTX." + (c-gpgme-get-armor ctx)) + +(defun gpgme-set-textmode (ctx textmode) + "If TEXTMODE is true, enable text mode mode in CTX, disable it otherwise." + (c-gpgme-set-textmode ctx textmode)) + +(defun gpgme-textmode-p (ctx) + "Return true if text mode mode is set for CTX." + (c-gpgme-get-textmode ctx)) + +(defun gpgme-set-include-certs (ctx &optional certs) + "Include up to CERTS certificates in an S/MIME message." + (c-gpgme-set-include-certs ctx certs)) + +(defun gpgme-get-include-certs (ctx) + "Return the number of certs to include in an S/MIME message, + or NIL if the default is used." + (c-gpgme-get-include-certs ctx)) + +(defun gpgme-get-keylist-mode (ctx) + "Get the keylist mode in CTX." + (c-gpgme-get-keylist-mode ctx)) + +(defun gpgme-set-keylist-mode (ctx mode) + "Set the keylist mode in CTX." + (c-gpgme-set-keylist-mode ctx mode)) + + +;;; FIXME: How to handle locale? cffi-grovel? + +(defun gpgme-get-engine-info (&optional ctx) + "Retrieve the engine info for CTX, or the default if CTX is omitted." + (cond + (ctx (c-gpgme-ctx-get-engine-info ctx)) + (t (with-foreign-object (info-p 'gpgme-engine-info-t) + (c-gpgme-get-engine-info info-p) + (mem-ref info-p 'gpgme-engine-info-t))))) + +(defun gpgme-set-engine-info (ctx proto &key file-name home-dir) + "Set the engine info for CTX, or the default if CTX is NIL." + (cond + (ctx (c-gpgme-ctx-set-engine-info ctx proto file-name home-dir)) + (t (c-gpgme-set-engine-info proto file-name home-dir)))) + +;;; FIXME: How to do pretty printing? +;;; +;;; gpgme_pubkey_algo_name, gpgme_hash_algo_name + +(defun gpgme-set-signers (ctx keys) + "Set the signers for the context CTX." + (c-gpgme-signers-clear ctx) + (dolist (key keys) (c-gpgme-signers-add ctx key))) + +;;; + +(defun gpgme-set-sig-notation (ctx notations) + "Set the sig notation for the context CTX." + (c-gpgme-sig-notation-clear ctx) + (dolist (notation notations) + (c-gpgme-sig-notation-add + ctx (first notation) (second notation) (third notation)))) + +(defun gpgme-get-sig-notation (ctx) + "Get the signature notation data for the context CTX." + (c-gpgme-sig-notation-get ctx)) + +;;; FIXME: Add I/O callback interface, for integration with clg. + +;;; FIXME: Add gpgme_wait? + +;;; Streams +;;; ------- +;;; +;;; GPGME uses standard streams. You can define your own streams, or +;;; use the existing file or string streams. +;;; +;;; A stream-spec is either a stream, or a list with a stream as its +;;; first argument followed by keyword parameters: encoding, +;;; file-name. +;;; +;;; FIXME: Eventually, we should provide a class that can be mixed +;;; into stream classes and which provides accessors for encoding and +;;; file-names. This interface should be provided in addition to the +;;; above sleazy interface, because the sleazy interface is easier to +;;; use (less typing), and is quite sufficient in a number of cases. +;;; +;;; For best results, streams with element type (unsigned-byte 8) +;;; should be used. Character streams may work if armor mode is used. + +;;; Do we need to provide access to GPGME data objects through streams +;;; as well? It seems to me that specific optimizations, like +;;; directly writing to file descriptors, is better done by extending +;;; the sleazy syntax (stream-spec) instead of customized streams. +;;; Customized streams do buffering, and this may mess up things. Mmh. + +(defvar *data-handles* (make-hash-table) + "Hash table with GPGME data user callback handle address as key + and the corresponding stream as value.") + +;;; The release callback removes the stream from the *data-handles* +;;; hash and releases the CBS structure that is used as the key in +;;; that hash. It is implicitely invoked (through GPGME) by +;;; gpgme-data-release. +(defcallback data-release-cb :void ((handle :pointer)) + (unwind-protect (remhash (pointer-address handle) *data-handles*) + (when (not (null-pointer-p handle)) (foreign-free handle)))) + +(defcallback data-read-cb ssize-t ((handle :pointer) (buffer :pointer) + (size size-t)) + (when *debug* (format t "DEBUG: gpgme-data-read-cb: want ~A~%" size)) + (let ((stream (gethash (pointer-address handle) *data-handles*))) + (cond + (stream + (let* ((stream-type (stream-element-type stream)) + (seq (make-array size :element-type stream-type)) + (read (read-sequence seq stream))) + (loop for i from 0 to (- read 1) + do (setf (mem-aref buffer :unsigned-char i) + ;;; FIXME: This is a half-assed attempt at + ;;; supporting character streams. + (cond + ((eql stream-type 'character) + (char-code (elt seq i))) + (t (coerce (elt seq i) stream-type))))) + (when *debug* (format t "DEBUG: gpgme-data-read-cb: read ~A~%" read)) + read)) + (t (set-errno +ebadf+) + -1)))) + +(defcallback data-write-cb ssize-t ((handle :pointer) (buffer :pointer) + (size size-t)) + (when *debug* (format t "DEBUG: gpgme-data-write-cb: want ~A~%" size)) + (let ((stream (gethash (pointer-address handle) *data-handles*))) + (cond + (stream + (let* ((stream-type (stream-element-type stream)) + (seq (make-array size :element-type stream-type))) + (loop for i from 0 to (- size 1) + do (setf (elt seq i) + ;;; FIXME: This is a half-assed attempt at + ;;; supporting character streams. + (cond + ((eql stream-type 'character) + (code-char (mem-aref buffer :unsigned-char i))) + (t (coerce (mem-aref buffer :unsigned-char i) + stream-type))))) + (write-sequence seq stream) + ;;; FIXME: What about write errors? + size)) + (t (set-errno +ebadf+) + -1)))) + +;;; This little helper macro allows us to swallow the cbs structure by +;;; simply setting it to a null pointer, but still protect against +;;; conditions. +(defmacro with-cbs-swallowed ((cbs) &body body) + `(let ((,cbs (foreign-alloc 'gpgme-data-cbs))) + (unwind-protect (progn ,@body) + (when (not (null-pointer-p ,cbs)) (foreign-free ,cbs))))) + +;;; FIXME: Wrap the object and attach to it a finalizer. Requires new +;;; CFFI. Should we use an OO interface, ie make-instance? For now, +;;; we do not provide direct access to data objects. +(defun gpgme-data-new (stream &key encoding file-name) + "Allocate a new GPGME data object for STREAM." + (with-foreign-object (dh-p 'gpgme-data-t) + ;;; We allocate one CBS structure for each stream we wrap in a + ;;; data object. Although we could also share all these + ;;; structures, as they contain the very same callbacks, we need a + ;;; unique C pointer as handle anyway to look up the stream in the + ;;; callback. This is a convenient one to use. + (with-cbs-swallowed (cbs) + (setf + (foreign-slot-value cbs 'gpgme-data-cbs 'read) (callback data-read-cb) + (foreign-slot-value cbs 'gpgme-data-cbs 'write) (callback data-write-cb) + (foreign-slot-value cbs 'gpgme-data-cbs 'seek) (null-pointer) + (foreign-slot-value cbs 'gpgme-data-cbs 'release) (callback + data-release-cb)) + (c-gpgme-data-new-from-cbs dh-p cbs cbs) + (let ((dh (mem-ref dh-p 'gpgme-data-t))) + (when encoding (gpgme-data-set-encoding dh encoding)) + (when file-name (gpgme-data-set-file-name dh file-name)) + ;;; Install the stream into the hash table and swallow the cbs + ;;; structure while protecting against any errors. + (unwind-protect + (progn + (setf (gethash (pointer-address cbs) *data-handles*) stream) + (setf cbs (null-pointer))) + (when (not (null-pointer-p cbs)) (c-gpgme-data-release dh))) + (when *debug* (format t "DEBUG: gpgme-data-new: ~A~%" dh)) + dh)))) + +;;; This function releases a GPGME data object. It implicitely +;;; invokes the data-release-cb function to clean up associated junk. +(defun gpgme-data-release (dh) + "Release a GPGME data object." + (when *debug* (format t "DEBUG: gpgme-data-release: ~A~%" dh)) + (c-gpgme-data-release dh)) + +(defmacro with-gpgme-data ((dh streamspec) &body body) + `(let ((,dh (if (listp ,streamspec) + (apply 'gpgme-data-new ,streamspec) + (gpgme-data-new ,streamspec)))) + (unwind-protect (progn ,@body) + (when (not (null-pointer-p ,dh)) (gpgme-data-release ,dh))))) + +(defun gpgme-data-get-encoding (dh) + "Get the encoding associated with the data object DH." + (c-gpgme-data-get-encoding dh)) + +(defun gpgme-data-set-encoding (dh encoding) + "Set the encoding associated with the data object DH to ENCODING." + (c-gpgme-data-set-encoding dh encoding)) + +(defun gpgme-data-get-file-name (dh) + "Get the file name associated with the data object DH." + (c-gpgme-data-get-file-name dh)) + +(defun gpgme-data-set-file-name (dh file-name) + "Set the file name associated with the data object DH to FILE-NAME." + (c-gpgme-data-set-file-name dh file-name)) + +;;; FIXME: Add key accessor interfaces. + +(defun gpgme-get-key (ctx fpr &optional secret) + "Get the key with the fingerprint FPR from the context CTX." + (with-foreign-object (key-p 'gpgme-key-t) + (c-gpgme-get-key ctx fpr key-p secret) + (mem-ref key-p 'gpgme-key-t))) + +(defun gpgme-key-ref (key) + "Acquire an additional reference to the key KEY." + (when *debug* (format t "DEBUG: gpgme-key-ref: ~A~%" key)) + (c-gpgme-key-ref key)) + +(defun gpgme-key-unref (key) + "Release a reference to the key KEY." + (when *debug* (format t "DEBUG: gpgme-key-unref: ~A~%" key)) + (c-gpgme-key-unref key)) + +;;; FIXME: We REALLY need pretty printing for keys and all the other +;;; big structs. + +;;; Various interfaces. + +(defun gpgme-check-version (&optional req-version) + (c-gpgme-check-version req-version)) + +;;; +;;; The *EXPORTED* CLOS interface. +;;; + +;;; The context type. + +;;; We wrap the C context pointer into a class object to be able to +;;; stick a finalizer on it. + +(defclass context () + (c-ctx ; The C context object pointer. + signers ; The list of signers. + sig-notation) ; The list of signers. + (:documentation "The GPGME context type.")) + +(defmethod initialize-instance :after ((ctx context) &rest rest + &key &allow-other-keys) + (let ((c-ctx (apply #'gpgme-new rest)) + (cleanup t)) + (unwind-protect + (progn (setf (slot-value ctx 'c-ctx) c-ctx) + (finalize ctx (lambda () (gpgme-release c-ctx))) + (setf cleanup nil)) + (if cleanup (gpgme-release c-ctx))))) + +(defmethod translate-to-foreign (value (type (eql 'gpgme-ctx-t))) + ;; Allow a pointer to be passed directly for the finalizer to work. + (if (pointerp value) value (slot-value value 'c-ctx))) + +(defmacro context (&rest rest) + "Create a new GPGME context." + `(make-instance 'context ,@rest)) + +;;; The context type: Accessor functions. + +;;; The context type: Accessor functions: Protocol. + +(defgeneric protocol (ctx) + (:documentation "Get the protocol of CONTEXT.")) + +(defmethod protocol ((ctx context)) + (gpgme-get-protocol ctx)) + +(defgeneric (setf protocol) (protocol ctx) + (:documentation "Set the protocol of CONTEXT to PROTOCOL.")) + +;;; FIXME: Adjust translator to reject invalid protocols. Currently, +;;; specifing an invalid protocol throws a "NIL is not 32 signed int" +;;; error. This is suboptimal. +(defmethod (setf protocol) (protocol (ctx context)) + (gpgme-set-protocol ctx protocol)) + +;;; The context type: Accessor functions: Armor. +;;; FIXME: Is it good style to make foop setf-able? Or should it be +;;; foo/foop for set/get? + +(defgeneric armorp (ctx) + (:documentation "Get the armor flag of CONTEXT.")) + +(defmethod armorp ((ctx context)) + (gpgme-armor-p ctx)) + +(defgeneric (setf armorp) (armor ctx) + (:documentation "Set the armor flag of CONTEXT to ARMOR.")) + +(defmethod (setf armorp) (armor (ctx context)) + (gpgme-set-armor ctx armor)) + +;;; The context type: Accessor functions: Textmode. +;;; FIXME: Is it good style to make foop setf-able? Or should it be +;;; foo/foop for set/get? + +(defgeneric textmodep (ctx) + (:documentation "Get the text mode flag of CONTEXT.")) + +(defmethod textmodep ((ctx context)) + (gpgme-textmode-p ctx)) + +(defgeneric (setf textmodep) (textmode ctx) + (:documentation "Set the text mode flag of CONTEXT to TEXTMODE.")) + +(defmethod (setf textmodep) (textmode (ctx context)) + (gpgme-set-textmode ctx textmode)) + +;;; The context type: Accessor functions: Include Certs. + +(defgeneric include-certs (ctx) + (:documentation "Get the number of included certificates in an + S/MIME message, or NIL if the default is used.")) + +(defmethod include-certs ((ctx context)) + (gpgme-get-include-certs ctx)) + +(defgeneric (setf include-certs) (certs ctx) + (:documentation "Return the number of certificates to include in an + S/MIME message, or NIL if the default is used.")) + +(defmethod (setf include-certs) (certs (ctx context)) + (gpgme-set-include-certs ctx certs)) + +;;; The context type: Accessor functions: Engine info. + +(defgeneric engine-info (ctx) + (:documentation "Retrieve the engine info for CTX.")) + +(defmethod engine-info ((ctx context)) + (gpgme-get-engine-info ctx)) + +(defgeneric (setf engine-info) (info ctx) + (:documentation "Set the engine info for CTX.")) + +(defmethod (setf engine-info) (info (ctx context)) + (dolist (proto '(:openpgp :cms)) + (let ((pinfo (getf info proto))) + (when pinfo + (gpgme-set-engine-info ctx proto :file-name (getf pinfo :file-name) + :home-dir (getf pinfo :home-dir)))))) + +;;; The context type: Accessor functions: Keylist mode. + +(defgeneric keylist-mode (ctx) + (:documentation "Get the keylist mode of CTX.")) + +(defmethod keylist-mode ((ctx context)) + (gpgme-get-keylist-mode ctx)) + +(defgeneric (setf keylist-mode) (mode ctx) + (:documentation "Set the keylist mode of CTX to MODE.")) + +(defmethod (setf keylist-mode) (mode (ctx context)) + (gpgme-set-keylist-mode ctx mode)) + +;;; The context type: Accessor functions: Signers. + +(defgeneric signers (ctx) + (:documentation "Get the signers of CTX.")) + +(defmethod signers ((ctx context)) + (slot-value ctx 'signers)) + +(defgeneric (setf signers) (signers ctx) + (:documentation "Set the signers of CTX to SIGNERS.")) + +(defmethod (setf keylist-mode) (signers (ctx context)) + (gpgme-set-signers ctx signers) + (setf (slot-value ctx 'signers) signers)) + +;;; The context type: Accessor functions: Sig notations. + +(defgeneric sig-notations (ctx) + (:documentation "Get the signature notations of CTX.")) + +(defmethod sig-notations ((ctx context)) + (slot-value ctx 'signers)) + +(defgeneric (setf sig-notations) (notations ctx) + (:documentation "Set the signatire notations of CTX to NOTATIONS.")) + +(defmethod (setf sig-notations) (notations (ctx context)) + (gpgme-set-signers ctx notations) + (setf (slot-value ctx 'notations) notations)) + +;;; The context type: Support macros. + +(defmacro with-context ((ctx &rest rest) &body body) + `(let ((,ctx (make-instance 'context ,@rest))) + ,@body)) + +;;; The key type. + +(defclass key () + (c-key) ; The C key object pointer. + (:documentation "The GPGME key type.")) + +;;; In the initializer, we swallow the c-key argument. +(defmethod initialize-instance :after ((key key) &key c-key + &allow-other-keys) + (setf (slot-value key 'c-key) c-key) + (finalize key (lambda () (gpgme-key-unref c-key)))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-key-t))) + (when *debug* (format t "DEBUG: import key: ~A~%" value)) + (make-instance 'key :c-key value)) + +(defmethod translate-to-foreign (value (type (eql 'gpgme-key-t))) + ;; Allow a pointer to be passed directly for the finalizer to work. + (if (pointerp value) value (slot-value value 'c-key))) + +(defmethod print-object ((key key) stream) + (print-unreadable-object (key stream :type t :identity t) + (format stream "~s" (fpr key)))) + +;;; The key type: Accessor functions. + +;;; FIXME: The bitfield and flags contain redundant information at +;;; this point. FIXME: Deal nicer with zero-length name (policy url) +;;; and zero length value (omit?) and human-readable (convert to string). +;;; FIXME: Turn binary data into sequence or vector or what it should be. +;;; FIXME: Turn the whole thing into a hash? +(defmethod translate-from-foreign (value (type (eql 'gpgme-sig-notation-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next name value name-len value-len flags bitfield) + value gpgme-sig-notation) + (append (list (list + :name name + :value value + :name-len name-len + :value-len value-len + :flags flags + :bitfield bitfield)) + next))))) + +;;; FIXME: Deal nicer with timestamps. bitfield field name? +(defmethod translate-from-foreign (value (type (eql 'gpgme-subkey-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next bitfield pubkey-algo length keyid fpr timestamp expires) + value gpgme-subkey) + (append (list (list + :bitfield bitfield + :pubkey-algo pubkey-algo + :length length + :keyid keyid + :fpr fpr + :timestamp timestamp + :expires expires)) + next))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-key-sig-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next bitfield pubkey-algo keyid timestamp expires status + uid name email comment sig-class) + value gpgme-key-sig) + (append (list (list + :bitfield bitfield + :pubkey-algo pubkey-algo + :keyid keyid + :timestamp timestamp + :expires expires + :status status + :uid uid + :name name + :email email + :comment comment + :sig-class sig-class)) + next))))) + +(defmethod translate-from-foreign (value (type (eql 'gpgme-user-id-t))) + (cond + ((null-pointer-p value) nil) + (t (with-foreign-slots + ((next bitfield validity uid name email comment signatures) + value gpgme-user-id) + (append (list (list + :bitfield bitfield + :validity validity + :uid uid + :name name + :email email + :comment comment + :signatures signatures)) + next))))) + +(defun key-data (key) + (with-slots (c-key) key + (with-foreign-slots + ((bitfield protocol issuer-serial issuer-name chain-id + owner-trust subkeys uids keylist-mode) + c-key gpgme-key) + (list + :bitfield bitfield + :protocol protocol + :issuer-serial issuer-serial + :issuer-name issuer-name + :chain-id chain-id + :owner-trust owner-trust + :subkeys subkeys + :uids uids + :keylist-mode keylist-mode)) + )) + + +(defgeneric fpr (key) + (:documentation "Get the primary fingerprint of the key.")) + +(defmethod fpr ((key key)) + (getf (car (getf (key-data key) :subkeys)) :fpr)) + + +;;; The context type: Crypto-Operations. + +(defgeneric get-key (ctx fpr &optional secret) + (:documentation "Get the (secret) key FPR from CTX.")) + +(defmethod get-key ((ctx context) fpr &optional secret) + (gpgme-get-key ctx fpr secret)) + +;;; Encrypt. + +(defgeneric op-encrypt (ctx recp plain cipher &key always-trust sign) + (:documentation "Encrypt.")) + +(defmethod op-encrypt ((ctx context) recp plain cipher + &key always-trust sign) + (with-foreign-object (c-recp :pointer (+ 1 (length recp))) + (dotimes (i (length recp)) + (setf (mem-aref c-recp 'gpgme-key-t i) (elt recp i))) + (setf (mem-aref c-recp :pointer (length recp)) (null-pointer)) + (with-gpgme-data (in plain) + (with-gpgme-data (out cipher) + (let ((flags)) + (if always-trust (push :always-trust flags)) + (cond + (sign + (c-gpgme-op-encrypt-sign ctx c-recp flags in out) + (append (c-gpgme-op-encrypt-result ctx) + (c-gpgme-op-sign-result ctx))) + (t + (c-gpgme-op-encrypt ctx c-recp flags in out) + (c-gpgme-op-encrypt-result ctx)))))))) + +;;; Decrypt. + +(defgeneric op-decrypt (ctx cipher plain &key verify) + (:documentation "Decrypt.")) + +(defmethod op-decrypt ((ctx context) cipher plain &key verify) + (with-gpgme-data (in cipher) + (with-gpgme-data (out plain) + (cond + (verify + (c-gpgme-op-decrypt-verify ctx in out) + (append (c-gpgme-op-decrypt-result ctx) + (c-gpgme-op-verify-result ctx))) + (t + (c-gpgme-op-decrypt ctx in out) + (c-gpgme-op-decrypt-result ctx)))))) + +;;; Signing. + +(defgeneric op-sign (ctx plain sig &optional mode) + (:documentation "Sign.")) + +(defmethod op-sign ((ctx context) plain sig &optional (mode :none)) + (with-gpgme-data (in plain) + (with-gpgme-data (out sig) + (c-gpgme-op-sign ctx in out mode) + (c-gpgme-op-sign-result ctx)))) + +;;; Verify. + +(defgeneric op-verify (ctx sig text &key detached) + (:documentation "Verify.")) + +(defmethod op-verify ((ctx context) sig text &key detached) + (with-gpgme-data (in sig) + (with-gpgme-data (on text) + (c-gpgme-op-verify ctx in (if detached on nil) + (if detached nil on)) + (c-gpgme-op-verify-result ctx)))) + +;;; Import. + +(defgeneric op-import (ctx keydata) + (:documentation "Import.")) + +(defmethod op-import ((ctx context) keydata) + (with-gpgme-data (in keydata) + (c-gpgme-op-import ctx in) + (c-gpgme-op-import-result ctx))) + +;;; Export. + +(defgeneric op-export (ctx pattern keydata) + (:documentation "Export public key data matching PATTERN to the + stream KEYDATA.")) + +(defmethod op-export ((ctx context) pattern keydata) + (with-gpgme-data (dh keydata) + (c-gpgme-op-export ctx pattern 0 dh))) + +;;; Key generation. + + +;;; +;;; Initialization +;;; + +(defun check-version (&optional req-version) + "Check that the GPGME version requirement is satisfied." + (gpgme-check-version req-version)) + +(defparameter *version* (check-version) + "The version number of GPGME used.") diff -urpNP gpgme-1.1.2/ltmain.sh gpgme-1.1.3/ltmain.sh --- gpgme-1.1.2/ltmain.sh 2005-09-08 14:42:33.000000000 +0000 +++ gpgme-1.1.3/ltmain.sh 2007-01-29 20:16:20.000000000 +0000 @@ -44,7 +44,7 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.4 -TIMESTAMP=" (1.1220.2.90 2004/04/03 14:10:19) Debian$Rev: 931 $" +TIMESTAMP=" (1.1220.2.90 2004/04/03 14:10:19) Debian$Rev: 1208 $" # Check that we have a working $echo. diff -urpNP gpgme-1.1.2/m4/libtool.m4 gpgme-1.1.3/m4/libtool.m4 --- gpgme-1.1.2/m4/libtool.m4 2005-09-08 14:42:29.000000000 +0000 +++ gpgme-1.1.3/m4/libtool.m4 2007-01-29 20:16:18.000000000 +0000 @@ -23,7 +23,7 @@ ## the same distribution terms that you use for the rest of that program. # serial 47 AC_PROG_LIBTOOL -# Debian $Rev: 928 $ +# Debian $Rev: 1208 $ # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) diff -urpNP gpgme-1.1.2/m4/pth.m4 gpgme-1.1.3/m4/pth.m4 --- gpgme-1.1.2/m4/pth.m4 2006-02-22 11:33:02.000000000 +0000 +++ gpgme-1.1.3/m4/pth.m4 2007-01-29 20:16:18.000000000 +0000 @@ -121,7 +121,7 @@ if test ".$with_pth" != .no; then _pth_cppflags=`pth-config --cflags` _pth_cflags=`pth-config --cflags` _pth_ldflags=`pth-config --ldflags` - _pth_libs=`pth-config --libs` + _pth_libs=`pth-config --libs --all` fi elif test -d "$with_pth"; then with_pth=`echo $with_pth | sed -e 's;/*$;;'` @@ -162,7 +162,7 @@ if test ".$with_pth" != .no; then _pth_cppflags=`$_dir/pth-config --cflags` _pth_cflags=`$_dir/pth-config --cflags` _pth_ldflags=`$_dir/pth-config --ldflags` - _pth_libs=`$_dir/pth-config --libs` + _pth_libs=`$_dir/pth-config --libs --all` _pth_found=yes break fi diff -urpNP gpgme-1.1.2/tests/ChangeLog gpgme-1.1.3/tests/ChangeLog --- gpgme-1.1.2/tests/ChangeLog 2005-12-18 15:18:05.000000000 +0000 +++ gpgme-1.1.3/tests/ChangeLog 2007-01-29 20:16:20.000000000 +0000 @@ -1,3 +1,8 @@ +2006-12-02 Marcus Brinkmann + + * gpgsm/t-keylist.c (main): Skip unknown keys. Newer versions of + GPGSM import more keys than older ones. + 2005-12-06 Werner Koch * gpg/t-keylist.c (main): Changed for that secondary keys now have diff -urpNP gpgme-1.1.2/tests/Makefile.in gpgme-1.1.3/tests/Makefile.in --- gpgme-1.1.2/tests/Makefile.in 2006-03-02 10:23:07.000000000 +0000 +++ gpgme-1.1.3/tests/Makefile.in 2007-01-29 20:17:01.000000000 +0000 @@ -191,6 +191,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -214,6 +215,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ diff -urpNP gpgme-1.1.2/tests/gpg/Makefile.in gpgme-1.1.3/tests/gpg/Makefile.in --- gpgme-1.1.2/tests/gpg/Makefile.in 2006-03-02 10:23:07.000000000 +0000 +++ gpgme-1.1.3/tests/gpg/Makefile.in 2007-01-29 20:17:02.000000000 +0000 @@ -270,6 +270,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -293,6 +294,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ diff -urpNP gpgme-1.1.2/tests/gpgsm/Makefile.in gpgme-1.1.3/tests/gpgsm/Makefile.in --- gpgme-1.1.2/tests/gpgsm/Makefile.in 2006-03-02 10:23:07.000000000 +0000 +++ gpgme-1.1.3/tests/gpgsm/Makefile.in 2007-01-29 20:17:02.000000000 +0000 @@ -209,6 +209,7 @@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +NETLIBS = @NETLIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -232,6 +233,8 @@ RUN_GPG_TESTS_TRUE = @RUN_GPG_TESTS_TRUE SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +USE_DESCRIPTOR_PASSING_FALSE = @USE_DESCRIPTOR_PASSING_FALSE@ +USE_DESCRIPTOR_PASSING_TRUE = @USE_DESCRIPTOR_PASSING_TRUE@ VERSION = @VERSION@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ diff -urpNP gpgme-1.1.2/tests/gpgsm/t-keylist.c gpgme-1.1.3/tests/gpgsm/t-keylist.c --- gpgme-1.1.2/tests/gpgsm/t-keylist.c 2006-02-09 19:56:31.000000000 +0000 +++ gpgme-1.1.3/tests/gpgsm/t-keylist.c 2007-01-29 20:16:20.000000000 +0000 @@ -106,6 +106,15 @@ main (int argc, char **argv) exit (1); } + if (strcmp (key->subkeys->fpr, keys[i].fpr)) + { + fprintf (stderr, "Warning: Skipping unknown key %s\n", + key->subkeys->fpr); + continue; + } + else + printf ("Checking key %s\n", key->subkeys->fpr); + /* Global key flags. */ if (key->revoked) { -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFFvlguwKTLuYeXhWkRAlb8AJ9JqYlbM8t2JXYyQNCHjZuvcYr4KwCferTV QUUzqs+kHJIM8PIGXgPMyX0= =TK2a -----END PGP SIGNATURE-----