2009-10-30 Marcus Brinkmann <marcus@g10code.de>

* configure.ac: Check for argp.h and error_t.

src/
2009-10-30  Marcus Brinkmann  <marcus@g10code.de>

	* Makefile.am (noinst_PROGRAMS): New target gpgme-tool.
	(gpgme_tool_LDADD): New variable.
	* gpgme-tool.c: New file.
	* ops.h (_gpgme_sig_notation_clearm _gpgme_signers_clear): New
	prototypes.
	* gpgme.c (gpgme_set_protocol): Allow GPGME_PROTOCOL_GPGCONF (when
	had that gone missing?).
	(_gpgme_sig_notation_clear): New function without debug output.
	(gpgme_release): Call it and _gpgme_signers_clear.
	* signers.c (_gpgme_signers_clear): New function without debug output.
	* g13.c (gpgme_op_vfs_mount): Add debug output.
	* assuan-support.c (my_spawn): Allow fd_child_list to be NULL.
	* conversion.c (_gpgme_encode_percent_string): Fix infinite loop.
	* debug.h: Put tag in front of debug lines, should make for nicer
	output.
	* engine-assuan.c (llass_new): Use our new system hooks for libassuan.
	* engine-g13.c (g13_new): Remove redundant assuan context allocation.
	* version.c (gpgme_check_version_internal): Delay debug output
	until after gpgme_check_version was called.
This commit is contained in:
Marcus Brinkmann 2009-10-30 14:21:08 +00:00
parent 6c3fadef5e
commit 9d3fdd8c96
15 changed files with 2214 additions and 120 deletions

View File

@ -1,3 +1,7 @@
2009-10-30 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Check for argp.h and error_t.
2009-10-26 Marcus Brinkmann <marcus@g10code.de> 2009-10-26 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0 * configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0

View File

@ -850,6 +850,14 @@ LTLIBOBJS=`echo "$LIB@&t@OBJS" |
sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
AC_SUBST(LTLIBOBJS) AC_SUBST(LTLIBOBJS)
# Some checks for gpgme-tool
AC_CHECK_HEADER([argp.h])
AC_CHECK_TYPES([error_t], [],
[AC_DEFINE([error_t], [int],
[Define to a type to use for `error_t' if it is not otherwise available.])],
[#include <errno.h>])
# Last check. # Last check.
die=no die=no
if test "$require_libassuan" = "no"; then if test "$require_libassuan" = "no"; then

View File

@ -1,3 +1,25 @@
2009-10-30 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (noinst_PROGRAMS): New target gpgme-tool.
(gpgme_tool_LDADD): New variable.
* gpgme-tool.c: New file.
* ops.h (_gpgme_sig_notation_clearm _gpgme_signers_clear): New
prototypes.
* gpgme.c (gpgme_set_protocol): Allow GPGME_PROTOCOL_GPGCONF (when
had that gone missing?).
(_gpgme_sig_notation_clear): New function without debug output.
(gpgme_release): Call it and _gpgme_signers_clear.
* signers.c (_gpgme_signers_clear): New function without debug output.
* g13.c (gpgme_op_vfs_mount): Add debug output.
* assuan-support.c (my_spawn): Allow fd_child_list to be NULL.
* conversion.c (_gpgme_encode_percent_string): Fix infinite loop.
* debug.h: Put tag in front of debug lines, should make for nicer
output.
* engine-assuan.c (llass_new): Use our new system hooks for libassuan.
* engine-g13.c (g13_new): Remove redundant assuan context allocation.
* version.c (gpgme_check_version_internal): Delay debug output
until after gpgme_check_version was called.
2009-10-28 Marcus Brinkmann <marcus@g10code.de> 2009-10-28 Marcus Brinkmann <marcus@g10code.de>
* signers.c, encrypt-sign.c, encrypt.c, delete.c, keylist.c, * signers.c, encrypt-sign.c, encrypt.c, delete.c, keylist.c,

View File

@ -153,7 +153,6 @@ if HAVE_W32_SYSTEM
# wrapper process. # wrapper process.
libexec_PROGRAMS = gpgme-w32spawn libexec_PROGRAMS = gpgme-w32spawn
LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \ LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
`echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \ `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
sed -e 's/-I/--include-dir /g;s/-D/--define /g'` sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
@ -226,6 +225,9 @@ libgpgme_qt_la_LIBADD = @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
@GPG_ERROR_LIBS@ @QT4_CORE_LIBS@ @GPG_ERROR_LIBS@ @QT4_CORE_LIBS@
endif endif
noinst_PROGRAMS = gpgme-tool
gpgme_tool_LDADD = libgpgme.la
status-table.h : gpgme.h status-table.h : gpgme.h
$(srcdir)/mkstatus < $(builddir)/gpgme.h > status-table.h $(srcdir)/mkstatus < $(builddir)/gpgme.h > status-table.h

View File

@ -117,20 +117,26 @@ my_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
return gpg_error (GPG_ERR_NOT_IMPLEMENTED); return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
i = 0; i = 0;
if (fd_child_list)
{
while (fd_child_list[i] != ASSUAN_INVALID_FD) while (fd_child_list[i] != ASSUAN_INVALID_FD)
i++; i++;
}
/* fd_in, fd_out, terminator */ /* fd_in, fd_out, terminator */
i += 3; i += 3;
fd_items = malloc (sizeof (struct spawn_fd_item_s) * i); fd_items = malloc (sizeof (struct spawn_fd_item_s) * i);
if (! fd_items) if (! fd_items)
return gpg_error_from_syserror (); return gpg_error_from_syserror ();
i = 0; i = 0;
if (fd_child_list)
{
while (fd_child_list[i] != ASSUAN_INVALID_FD) while (fd_child_list[i] != ASSUAN_INVALID_FD)
{ {
fd_items[i].fd = fd_child_list[i]; fd_items[i].fd = fd_child_list[i];
fd_items[i].dup_to = -1; fd_items[i].dup_to = -1;
i++; i++;
} }
}
if (fd_in != ASSUAN_INVALID_FD) if (fd_in != ASSUAN_INVALID_FD)
{ {
fd_items[i].fd = fd_in; fd_items[i].fd = fd_in;
@ -151,12 +157,15 @@ my_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
{ {
i = 0; i = 0;
if (fd_child_list)
{
while (fd_child_list[i] != ASSUAN_INVALID_FD) while (fd_child_list[i] != ASSUAN_INVALID_FD)
{ {
fd_child_list[i] = fd_items[i].peer_name; fd_child_list[i] = fd_items[i].peer_name;
i++; i++;
} }
} }
}
free (fd_items); free (fd_items);
return err; return err;
} }

View File

@ -272,6 +272,7 @@ _gpgme_encode_percent_string (const char *src, char **destp, size_t len)
destlen += 3; destlen += 3;
else else
destlen++; destlen++;
str++;
} }
/* Terminating nul byte. */ /* Terminating nul byte. */
destlen++; destlen++;

View File

@ -89,155 +89,155 @@ void _gpgme_debug_buffer (int lvl, const char *const fmt,
#define TRACE_BEG(lvl, name, tag) \ #define TRACE_BEG(lvl, name, tag) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag), 0 _gpgme_trace_func), 0
#define TRACE_BEG0(lvl, name, tag, fmt) \ #define TRACE_BEG0(lvl, name, tag, fmt) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag), 0 _gpgme_trace_func), 0
#define TRACE_BEG1(lvl, name, tag, fmt, arg1) \ #define TRACE_BEG1(lvl, name, tag, fmt, arg1) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1), 0 _gpgme_trace_func, arg1), 0
#define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \ #define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2), 0 _gpgme_trace_func, arg1, arg2), 0
#define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \ #define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3), 0 _gpgme_trace_func, arg1, arg2, arg3), 0
#define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \ #define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4), 0 _gpgme_trace_func, arg1, arg2, arg3, arg4), 0
#define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \ #define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5), 0 _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \ #define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7) \ arg5, arg6, arg7) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5, \ _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
arg6, arg7), 0 arg6, arg7), 0
#define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \ #define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7, arg8) \ arg5, arg6, arg7, arg8) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5, \ _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
arg6, arg7, arg8), 0 arg6, arg7, arg8), 0
#define TRACE(lvl, name, tag) \ #define TRACE(lvl, name, tag) \
_gpgme_debug (lvl, "%s (%s=%p): call\n", \ _gpgme_debug (lvl, "[%s=%p] %s: call\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag), 0 STRINGIFY (tag), (void *) (uintptr_t) tag, name), 0
#define TRACE0(lvl, name, tag, fmt) \ #define TRACE0(lvl, name, tag, fmt) \
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag), 0 STRINGIFY (tag), (void *) (uintptr_t) tag, name), 0
#define TRACE1(lvl, name, tag, fmt, arg1) \ #define TRACE1(lvl, name, tag, fmt, arg1) \
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), 0 STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1), 0
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \ #define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
arg2), 0 arg2), 0
#define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \ #define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
arg2, arg3), 0 arg2, arg3), 0
#define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ #define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ _gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
arg2, arg3, arg4, arg5, arg6), 0 arg2, arg3, arg4, arg5, arg6), 0
#define TRACE_ERR(err) \ #define TRACE_ERR(err) \
err == 0 ? (TRACE_SUC ()) : \ err == 0 ? (TRACE_SUC ()) : \
(_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s <%s>\n", \ (_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s <%s>\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, gpgme_strerror (err), \ _gpgme_trace_func, gpgme_strerror (err), \
gpgme_strsource (err)), (err)) gpgme_strsource (err)), (err))
/* The cast to void suppresses GCC warnings. */ /* The cast to void suppresses GCC warnings. */
#define TRACE_SYSRES(res) \ #define TRACE_SYSRES(res) \
res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s\n", \ (_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, strerror (errno)), (res)) _gpgme_trace_func, strerror (errno)), (res))
#define TRACE_SYSERR(res) \ #define TRACE_SYSERR(res) \
res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s\n", \ (_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, strerror (res)), (res)) _gpgme_trace_func, strerror (res)), (res))
#define TRACE_SUC() \ #define TRACE_SUC() \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag), 0 _gpgme_trace_func), 0
#define TRACE_SUC0(fmt) \ #define TRACE_SUC0(fmt) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag), 0 _gpgme_trace_func), 0
#define TRACE_SUC1(fmt, arg1) \ #define TRACE_SUC1(fmt, arg1) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1), 0 _gpgme_trace_func, arg1), 0
#define TRACE_SUC2(fmt, arg1, arg2) \ #define TRACE_SUC2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2), 0 _gpgme_trace_func, arg1, arg2), 0
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \ #define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5), 0 _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_LOG(fmt) \ #define TRACE_LOG(fmt) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag), 0 _gpgme_trace_func), 0
#define TRACE_LOG1(fmt, arg1) \ #define TRACE_LOG1(fmt, arg1) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1), 0 _gpgme_trace_func, arg1), 0
#define TRACE_LOG2(fmt, arg1, arg2) \ #define TRACE_LOG2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2), 0 _gpgme_trace_func, arg1, arg2), 0
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \ #define TRACE_LOG3(fmt, arg1, arg2, arg3) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3), 0 _gpgme_trace_func, arg1, arg2, arg3), 0
#define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \ #define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4), 0 _gpgme_trace_func, arg1, arg2, arg3, arg4), 0
#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \ #define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5), 0 _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ #define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5, \ _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
arg6), 0 arg6), 0
#define TRACE_LOGBUF(buf, len) \ #define TRACE_LOGBUF(buf, len) \
_gpgme_debug_buffer (_gpgme_trace_level, "%s (%s=%p): check: %s", \ _gpgme_debug_buffer (_gpgme_trace_level, "[%s=%p] %s: check: %s", \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag, buf, len) _gpgme_trace_func, buf, len)
#define TRACE_SEQ(hlp,fmt) \ #define TRACE_SEQ(hlp,fmt) \
_gpgme_debug_begin (&(hlp), _gpgme_trace_level, \ _gpgme_debug_begin (&(hlp), _gpgme_trace_level, \
"%s (%s=%p): check: " fmt, \ "[%s=%p] %s: check: " fmt, \
_gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_tag) _gpgme_trace_func)
#define TRACE_ADD0(hlp,fmt) \ #define TRACE_ADD0(hlp,fmt) \
_gpgme_debug_add (&(hlp), fmt) _gpgme_debug_add (&(hlp), fmt)
#define TRACE_ADD1(hlp,fmt,a) \ #define TRACE_ADD1(hlp,fmt,a) \

View File

@ -233,9 +233,13 @@ llass_new (void **engine, const char *file_name, const char *home_dir)
llass->opt.gpg_agent = 1; llass->opt.gpg_agent = 1;
} }
err = assuan_new (&llass->assuan_ctx); err = assuan_new_ext (&llass->assuan_ctx, GPG_ERR_SOURCE_GPGME,
&_gpgme_assuan_malloc_hooks, _gpgme_assuan_log_cb,
NULL);
if (err) if (err)
goto leave; goto leave;
assuan_ctx_set_system_hooks (llass->assuan_ctx, &_gpgme_assuan_system_hooks);
err = assuan_socket_connect (llass->assuan_ctx, file_name, 0); err = assuan_socket_connect (llass->assuan_ctx, file_name, 0);
if (err) if (err)
goto leave; goto leave;

View File

@ -230,10 +230,6 @@ g13_new (void **engine, const char *file_name, const char *home_dir)
g13->status_cb.tag = 0; g13->status_cb.tag = 0;
g13->status_cb.data = g13; g13->status_cb.data = g13;
err = assuan_new (&g13->assuan_ctx);
if (err)
goto leave;
argc = 0; argc = 0;
argv[argc++] = "g13"; argv[argc++] = "g13";
if (home_dir) if (home_dir)

View File

@ -25,6 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "gpgme.h" #include "gpgme.h"
#include "debug.h"
#include "context.h" #include "context.h"
#include "ops.h" #include "ops.h"
#include "util.h" #include "util.h"
@ -135,8 +136,8 @@ gpgme_op_vfs_transact (gpgme_ctx_t ctx,
or destroyed. This is a synchronous convenience interface, which or destroyed. This is a synchronous convenience interface, which
automatically returns an operation error if there is no automatically returns an operation error if there is no
transmission error. */ transmission error. */
gpgme_error_t static gpgme_error_t
gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, _gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,
const char *mount_dir, int flags, gpgme_error_t *op_err) const char *mount_dir, int flags, gpgme_error_t *op_err)
{ {
gpg_error_t err; gpg_error_t err;
@ -194,3 +195,15 @@ gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,
return err; return err;
} }
gpgme_error_t
gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,
const char *mount_dir, int flags, gpgme_error_t *op_err)
{
TRACE_BEG4 (DEBUG_CTX, "gpgme_op_vfs_mount", ctx,
"container=%s, mount_dir=%s, flags=0x%x, op_err=%p",
container_file, mount_dir, flags, op_err);
return TRACE_ERR (_gpgme_op_vfs_mount (ctx, container_file, mount_dir,
flags, op_err));
}

2012
src/gpgme-tool.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -186,8 +186,8 @@ gpgme_release (gpgme_ctx_t ctx)
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
_gpgme_fd_table_deinit (&ctx->fdt); _gpgme_fd_table_deinit (&ctx->fdt);
_gpgme_release_result (ctx); _gpgme_release_result (ctx);
gpgme_signers_clear (ctx); _gpgme_signers_clear (ctx);
gpgme_sig_notation_clear (ctx); _gpgme_sig_notation_clear (ctx);
if (ctx->signers) if (ctx->signers)
free (ctx->signers); free (ctx->signers);
if (ctx->lc_ctype) if (ctx->lc_ctype)
@ -269,6 +269,7 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
if (protocol != GPGME_PROTOCOL_OpenPGP if (protocol != GPGME_PROTOCOL_OpenPGP
&& protocol != GPGME_PROTOCOL_CMS && protocol != GPGME_PROTOCOL_CMS
&& protocol != GPGME_PROTOCOL_GPGCONF
&& protocol != GPGME_PROTOCOL_ASSUAN && protocol != GPGME_PROTOCOL_ASSUAN
&& protocol != GPGME_PROTOCOL_G13) && protocol != GPGME_PROTOCOL_G13)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -311,6 +312,9 @@ gpgme_get_protocol_name (gpgme_protocol_t protocol)
case GPGME_PROTOCOL_CMS: case GPGME_PROTOCOL_CMS:
return "CMS"; return "CMS";
case GPGME_PROTOCOL_GPGCONF:
return "GPGCONF";
case GPGME_PROTOCOL_ASSUAN: case GPGME_PROTOCOL_ASSUAN:
return "Assuan"; return "Assuan";
@ -654,10 +658,9 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto,
/* Clear all notation data from the context. */ /* Clear all notation data from the context. */
void void
gpgme_sig_notation_clear (gpgme_ctx_t ctx) _gpgme_sig_notation_clear (gpgme_ctx_t ctx)
{ {
gpgme_sig_notation_t notation; gpgme_sig_notation_t notation;
TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx);
if (!ctx) if (!ctx)
return; return;
@ -672,6 +675,13 @@ gpgme_sig_notation_clear (gpgme_ctx_t ctx)
ctx->sig_notations = NULL; ctx->sig_notations = NULL;
} }
void
gpgme_sig_notation_clear (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx);
_gpgme_sig_notation_clear (ctx);
}
/* Add the human-readable notation data with name NAME and value VALUE /* Add the human-readable notation data with name NAME and value VALUE
to the context CTX, using the flags FLAGS. If NAME is NULL, then to the context CTX, using the flags FLAGS. If NAME is NULL, then

View File

@ -29,6 +29,8 @@
/* From gpgme.c. */ /* From gpgme.c. */
gpgme_error_t _gpgme_cancel_with_err (gpgme_ctx_t ctx, gpg_error_t ctx_err, gpgme_error_t _gpgme_cancel_with_err (gpgme_ctx_t ctx, gpg_error_t ctx_err,
gpg_error_t op_err); gpg_error_t op_err);
/* Clear all notation data from the context. */
void _gpgme_sig_notation_clear (gpgme_ctx_t ctx);
void _gpgme_release_result (gpgme_ctx_t ctx); void _gpgme_release_result (gpgme_ctx_t ctx);
@ -79,6 +81,9 @@ gpgme_error_t _gpgme_decrypt_status_handler (void *priv,
char *args); char *args);
/* From signers.c. */
void _gpgme_signers_clear (gpgme_ctx_t ctx);
/* From sign.c. */ /* From sign.c. */
/* Create an initial op data object for signing. Needs to be called /* Create an initial op data object for signing. Needs to be called

View File

@ -36,12 +36,10 @@
/* Delete all signers from CTX. */ /* Delete all signers from CTX. */
void void
gpgme_signers_clear (gpgme_ctx_t ctx) _gpgme_signers_clear (gpgme_ctx_t ctx)
{ {
unsigned int i; unsigned int i;
TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx);
if (!ctx || !ctx->signers) if (!ctx || !ctx->signers)
return; return;
@ -54,6 +52,15 @@ gpgme_signers_clear (gpgme_ctx_t ctx)
ctx->signers_len = 0; ctx->signers_len = 0;
} }
void
gpgme_signers_clear (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx);
return _gpgme_signers_clear (ctx);
}
/* Add KEY to list of signers in CTX. */ /* Add KEY to list of signers in CTX. */
gpgme_error_t gpgme_error_t
gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key)

View File

@ -193,7 +193,7 @@ gpgme_check_version (const char *req_version)
do_subsystem_inits (); do_subsystem_inits ();
/* Catch-22: We need to get at least the debug subsystem ready /* Catch-22: We need to get at least the debug subsystem ready
before using the tarce facility. If we won't the tarce would before using the trace facility. If we won't the trace would
automagically initialize the debug system with out the locks automagically initialize the debug system with out the locks
being initialized and missing the assuan log level setting. */ being initialized and missing the assuan log level setting. */
TRACE2 (DEBUG_INIT, "gpgme_check_version: ", 0, TRACE2 (DEBUG_INIT, "gpgme_check_version: ", 0,
@ -216,14 +216,15 @@ gpgme_check_version_internal (const char *req_version,
{ {
const char *result; const char *result;
TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
"req_version=%s, offset_sig_validity=%i",
req_version ? req_version : "(null)", offset_sig_validity);
result = gpgme_check_version (req_version); result = gpgme_check_version (req_version);
if (result == NULL) if (result == NULL)
return result; return result;
/* Catch-22, see above. */
TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
"req_version=%s, offset_sig_validity=%i",
req_version ? req_version : "(null)", offset_sig_validity);
if (offset_sig_validity != offsetof (struct _gpgme_signature, validity)) if (offset_sig_validity != offsetof (struct _gpgme_signature, validity))
{ {
TRACE1 (DEBUG_INIT, "gpgme_check_version_internal: ", 0, TRACE1 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,