2009-06-22 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Add AC_TYPE_UINTPTR_T. * assuan/assuan.h [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Declare _gpgme_io_connect. src/ 2009-06-22 Marcus Brinkmann <marcus@g10code.de> * debug.h: Everywhere, use %p instead of 0x%x to print pointer. [HAVE_STDINT_H]: Include <stdint.h>. (_TRACE, TRACE, TRACE0, TRACE1, TRACE2, TRACE3, TRACE6): Cast tag to (uintptr_t) before casting it to (void*) to silence GCC warning. * gpgme.h.in (_GPGME_DEPRECATED_OUTSIDE_GPGME): New macro. * sign.c (_GPGME_IN_GPGME): Define it. * keylist.c (_GPGME_IN_GPGME): Define it. * debug.c (_gpgme_debug_begin, _gpgme_debug_add): Handle error in vasprintf and asprintf. * priv-io.h: Include <sys/socket.h>. Declare _gpgme_io_connect. tests/ 2009-06-22 Marcus Brinkmann <marcus@g10code.de> * gpg/t-support.h (passphrase_cb): Implement write() according to the book to silence compiler warning. * gpgsm/t-support.h (passphrase_cb): Likewise.
This commit is contained in:
parent
b207a32d4d
commit
1c454aee81
@ -1,3 +1,10 @@
|
|||||||
|
2009-06-22 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* configure.ac: Add AC_TYPE_UINTPTR_T.
|
||||||
|
|
||||||
|
* assuan/assuan.h [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Declare
|
||||||
|
_gpgme_io_connect.
|
||||||
|
|
||||||
2009-06-18 Marcus Brinkmann <marcus@g10code.de>
|
2009-06-18 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
Released GPGME 1.2.0.
|
Released GPGME 1.2.0.
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
int _gpgme_io_close (int fd);
|
int _gpgme_io_close (int fd);
|
||||||
int _gpgme_io_read (int fd, void *buffer, size_t count);
|
int _gpgme_io_read (int fd, void *buffer, size_t count);
|
||||||
int _gpgme_io_write (int fd, const void *buffer, size_t count);
|
int _gpgme_io_write (int fd, const void *buffer, size_t count);
|
||||||
|
int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen);
|
||||||
int _gpgme_io_sendmsg (int sock, const 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);
|
int _gpgme_io_recvmsg (int sock, struct msghdr *msg, int flags);
|
||||||
int _gpgme_io_socket (int domain, int type, int proto);
|
int _gpgme_io_socket (int domain, int type, int proto);
|
||||||
|
@ -197,6 +197,7 @@ AC_C_INLINE
|
|||||||
AC_CHECK_SIZEOF(unsigned int)
|
AC_CHECK_SIZEOF(unsigned int)
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
|
AC_TYPE_UINTPTR_T
|
||||||
|
|
||||||
# A simple compile time check in gpgme.h for GNU/Linux systems that
|
# A simple compile time check in gpgme.h for GNU/Linux systems that
|
||||||
# prevents a file offset bits mismatch between gpgme and the application.
|
# prevents a file offset bits mismatch between gpgme and the application.
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2009-06-22 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* debug.h: Everywhere, use %p instead of 0x%x to print pointer.
|
||||||
|
[HAVE_STDINT_H]: Include <stdint.h>.
|
||||||
|
(_TRACE, TRACE, TRACE0, TRACE1, TRACE2, TRACE3, TRACE6): Cast tag
|
||||||
|
to (uintptr_t) before casting it to (void*) to silence GCC
|
||||||
|
warning.
|
||||||
|
|
||||||
|
* gpgme.h.in (_GPGME_DEPRECATED_OUTSIDE_GPGME): New macro.
|
||||||
|
* sign.c (_GPGME_IN_GPGME): Define it.
|
||||||
|
* keylist.c (_GPGME_IN_GPGME): Define it.
|
||||||
|
|
||||||
|
* debug.c (_gpgme_debug_begin, _gpgme_debug_add): Handle error in
|
||||||
|
vasprintf and asprintf.
|
||||||
|
|
||||||
|
* priv-io.h: Include <sys/socket.h>. Declare _gpgme_io_connect.
|
||||||
|
|
||||||
2009-06-18 Marcus Brinkmann <marcus@g10code.de>
|
2009-06-18 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* gpgme.h.in (GPGME_CONF_PATHNAME): Revert last change, it's
|
* gpgme.h.in (GPGME_CONF_PATHNAME): Revert last change, it's
|
||||||
|
24
src/debug.c
24
src/debug.c
@ -1,6 +1,6 @@
|
|||||||
/* debug.c - helpful output in desperate situations
|
/* debug.c - helpful output in desperate situations
|
||||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 g10 Code GmbH
|
||||||
|
|
||||||
This file is part of GPGME.
|
This file is part of GPGME.
|
||||||
|
|
||||||
@ -197,6 +197,7 @@ void
|
|||||||
_gpgme_debug_begin (void **line, int level, const char *format, ...)
|
_gpgme_debug_begin (void **line, int level, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list arg_ptr;
|
va_list arg_ptr;
|
||||||
|
int res;
|
||||||
|
|
||||||
debug_init ();
|
debug_init ();
|
||||||
if (debug_level < level)
|
if (debug_level < level)
|
||||||
@ -207,8 +208,10 @@ _gpgme_debug_begin (void **line, int level, const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start (arg_ptr, format);
|
va_start (arg_ptr, format);
|
||||||
vasprintf ((char **) line, format, arg_ptr);
|
res = vasprintf ((char **) line, format, arg_ptr);
|
||||||
va_end (arg_ptr);
|
va_end (arg_ptr);
|
||||||
|
if (res < 0)
|
||||||
|
*line = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -219,17 +222,26 @@ _gpgme_debug_add (void **line, const char *format, ...)
|
|||||||
va_list arg_ptr;
|
va_list arg_ptr;
|
||||||
char *toadd;
|
char *toadd;
|
||||||
char *result;
|
char *result;
|
||||||
|
int res;
|
||||||
|
|
||||||
if (!*line)
|
if (!*line)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_start (arg_ptr, format);
|
va_start (arg_ptr, format);
|
||||||
vasprintf (&toadd, format, arg_ptr);
|
res = vasprintf (&toadd, format, arg_ptr);
|
||||||
va_end (arg_ptr);
|
va_end (arg_ptr);
|
||||||
asprintf (&result, "%s%s", *(char **) line, toadd);
|
if (res < 0)
|
||||||
free (*line);
|
{
|
||||||
|
free (*line);
|
||||||
|
*line = NULL;
|
||||||
|
}
|
||||||
|
res = asprintf (&result, "%s%s", *(char **) line, toadd);
|
||||||
free (toadd);
|
free (toadd);
|
||||||
*line = result;
|
free (*line);
|
||||||
|
if (res < 0)
|
||||||
|
*line = NULL;
|
||||||
|
else
|
||||||
|
*line = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
78
src/debug.h
78
src/debug.h
@ -22,6 +22,9 @@
|
|||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Indirect stringification, requires __STDC__ to work. */
|
/* Indirect stringification, requires __STDC__ to work. */
|
||||||
#define STRINGIFY(v) #v
|
#define STRINGIFY(v) #v
|
||||||
@ -81,133 +84,134 @@ void _gpgme_debug_buffer (int lvl, const char *const fmt,
|
|||||||
int _gpgme_trace_level = lvl; \
|
int _gpgme_trace_level = lvl; \
|
||||||
const char *const _gpgme_trace_func = name; \
|
const char *const _gpgme_trace_func = name; \
|
||||||
const char *const _gpgme_trace_tagname = STRINGIFY (tag); \
|
const char *const _gpgme_trace_tagname = STRINGIFY (tag); \
|
||||||
void *_gpgme_trace_tag = (void *) tag
|
void *_gpgme_trace_tag = (void *) (uintptr_t) tag
|
||||||
|
|
||||||
#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=0x%x): enter\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag), 0
|
_gpgme_trace_tag), 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=0x%x): enter: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag), 0
|
_gpgme_trace_tag), 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=0x%x): enter: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1), 0
|
_gpgme_trace_tag, 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=0x%x): enter: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2), 0
|
_gpgme_trace_tag, 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=0x%x): enter: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2, arg3), 0
|
_gpgme_trace_tag, 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=0x%x): enter: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2, arg3, arg4), 0
|
_gpgme_trace_tag, arg1, arg2, arg3, arg4), 0
|
||||||
|
|
||||||
#define TRACE(lvl, name, tag) \
|
#define TRACE(lvl, name, tag) \
|
||||||
_gpgme_debug (lvl, "%s (%s=0x%x): call\n", \
|
_gpgme_debug (lvl, "%s (%s=%p): call\n", \
|
||||||
name, STRINGIFY (tag), (void *) tag), 0
|
name, STRINGIFY (tag), (void *) (uintptr_t) tag), 0
|
||||||
#define TRACE0(lvl, name, tag, fmt) \
|
#define TRACE0(lvl, name, tag, fmt) \
|
||||||
_gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \
|
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \
|
||||||
name, STRINGIFY (tag), (void *) tag), 0
|
name, STRINGIFY (tag), (void *) (uintptr_t) tag), 0
|
||||||
#define TRACE1(lvl, name, tag, fmt, arg1) \
|
#define TRACE1(lvl, name, tag, fmt, arg1) \
|
||||||
_gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \
|
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \
|
||||||
name, STRINGIFY (tag), (void *) tag, arg1), 0
|
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), 0
|
||||||
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
|
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
|
||||||
_gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \
|
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \
|
||||||
name, STRINGIFY (tag), (void *) tag, arg1, arg2), 0
|
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
|
||||||
|
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=0x%x): call: " fmt "\n", \
|
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \
|
||||||
name, STRINGIFY (tag), (void *) tag, arg1, arg2, \
|
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
|
||||||
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=0x%x): call: " fmt "\n", \
|
_gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \
|
||||||
name, STRINGIFY (tag), (void *) tag, arg1, arg2, arg3, \
|
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
|
||||||
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=0x%x): error: %s <%s>\n", \
|
(_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s <%s>\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, gpgme_strerror (err), \
|
_gpgme_trace_tag, 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=0x%x): error: %s\n", \
|
(_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, strerror (errno)), (res))
|
_gpgme_trace_tag, 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=0x%x): error: %s\n", \
|
(_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, strerror (res)), (res))
|
_gpgme_trace_tag, strerror (res)), (res))
|
||||||
|
|
||||||
#define TRACE_SUC() \
|
#define TRACE_SUC() \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag), 0
|
_gpgme_trace_tag), 0
|
||||||
#define TRACE_SUC0(fmt) \
|
#define TRACE_SUC0(fmt) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag), 0
|
_gpgme_trace_tag), 0
|
||||||
#define TRACE_SUC1(fmt, arg1) \
|
#define TRACE_SUC1(fmt, arg1) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1), 0
|
_gpgme_trace_tag, arg1), 0
|
||||||
#define TRACE_SUC2(fmt, arg1, arg2) \
|
#define TRACE_SUC2(fmt, arg1, arg2) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2), 0
|
_gpgme_trace_tag, 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=0x%x): leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5), 0
|
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5), 0
|
||||||
|
|
||||||
#define TRACE_LOG(fmt) \
|
#define TRACE_LOG(fmt) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag), 0
|
_gpgme_trace_tag), 0
|
||||||
#define TRACE_LOG1(fmt, arg1) \
|
#define TRACE_LOG1(fmt, arg1) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1), 0
|
_gpgme_trace_tag, arg1), 0
|
||||||
#define TRACE_LOG2(fmt, arg1, arg2) \
|
#define TRACE_LOG2(fmt, arg1, arg2) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2), 0
|
_gpgme_trace_tag, arg1, arg2), 0
|
||||||
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \
|
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2, arg3), 0
|
_gpgme_trace_tag, 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=0x%x): check: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2, arg3, arg4), 0
|
_gpgme_trace_tag, arg1, arg2, arg3, arg4), 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=0x%x): check: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5, \
|
_gpgme_trace_tag, 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=0x%x): check: %s", \
|
_gpgme_debug_buffer (_gpgme_trace_level, "%s (%s=%p): check: %s", \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag, buf, len)
|
_gpgme_trace_tag, 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=0x%x): check: " fmt, \
|
"%s (%s=%p): check: " fmt, \
|
||||||
_gpgme_trace_func, _gpgme_trace_tagname, \
|
_gpgme_trace_func, _gpgme_trace_tagname, \
|
||||||
_gpgme_trace_tag)
|
_gpgme_trace_tag)
|
||||||
#define TRACE_ADD0(hlp,fmt) \
|
#define TRACE_ADD0(hlp,fmt) \
|
||||||
|
@ -66,6 +66,14 @@ extern "C" {
|
|||||||
#define _GPGME_DEPRECATED
|
#define _GPGME_DEPRECATED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The macro _GPGME_DEPRECATED_OUTSIDE_GPGME suppresses warnings for
|
||||||
|
fields we must access in GPGME for ABI compatibility. */
|
||||||
|
#ifdef _GPGME_IN_GPGME
|
||||||
|
#define _GPGME_DEPRECATED_OUTSIDE_GPGME
|
||||||
|
#else
|
||||||
|
#define _GPGME_DEPRECATED_OUTSIDE_GPGME _GPGME_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* The version of this header should match the one of the library. Do
|
/* The version of this header should match the one of the library. Do
|
||||||
not use this symbol in your application, use gpgme_check_version
|
not use this symbol in your application, use gpgme_check_version
|
||||||
@ -615,7 +623,7 @@ struct _gpgme_key_sig
|
|||||||
unsigned int _obsolete_class _GPGME_DEPRECATED;
|
unsigned int _obsolete_class _GPGME_DEPRECATED;
|
||||||
#else
|
#else
|
||||||
/* Must be set to SIG_CLASS below. */
|
/* Must be set to SIG_CLASS below. */
|
||||||
unsigned int class _GPGME_DEPRECATED;
|
unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The user ID string. */
|
/* The user ID string. */
|
||||||
@ -1294,7 +1302,7 @@ struct _gpgme_new_signature
|
|||||||
unsigned int _obsolete_class_2;
|
unsigned int _obsolete_class_2;
|
||||||
#else
|
#else
|
||||||
/* Must be set to SIG_CLASS below. */
|
/* Must be set to SIG_CLASS below. */
|
||||||
unsigned int class _GPGME_DEPRECATED;
|
unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Crypto backend specific signature class. */
|
/* Crypto backend specific signature class. */
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* Suppress warning for accessing deprecated member "class". */
|
||||||
|
#define _GPGME_IN_GPGME
|
||||||
#include "gpgme.h"
|
#include "gpgme.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#ifndef IO_H
|
#ifndef IO_H
|
||||||
#define IO_H
|
#define IO_H
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
/* A single file descriptor passed to spawn. For child fds, dup_to
|
/* A single file descriptor passed to spawn. For child fds, dup_to
|
||||||
specifies the fd it should become in the child, but only 0, 1 and 2
|
specifies the fd it should become in the child, but only 0, 1 and 2
|
||||||
@ -50,6 +51,7 @@ struct io_select_fd_s
|
|||||||
|
|
||||||
/* These function are either defined in posix-io.c or w32-io.c. */
|
/* These function are either defined in posix-io.c or w32-io.c. */
|
||||||
void _gpgme_io_subsystem_init (void);
|
void _gpgme_io_subsystem_init (void);
|
||||||
|
int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen);
|
||||||
int _gpgme_io_read (int fd, void *buffer, size_t count);
|
int _gpgme_io_read (int fd, void *buffer, size_t count);
|
||||||
int _gpgme_io_write (int fd, const void *buffer, size_t count);
|
int _gpgme_io_write (int fd, const void *buffer, size_t count);
|
||||||
int _gpgme_io_pipe (int filedes[2], int inherit_idx);
|
int _gpgme_io_pipe (int filedes[2], int inherit_idx);
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* Suppress warning for accessing deprecated member "class". */
|
||||||
|
#define _GPGME_IN_GPGME 1
|
||||||
#include "gpgme.h"
|
#include "gpgme.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2009-06-22 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* gpg/t-support.h (passphrase_cb): Implement write() according to
|
||||||
|
the book to silence compiler warning.
|
||||||
|
* gpgsm/t-support.h (passphrase_cb): Likewise.
|
||||||
|
|
||||||
2009-06-16 Werner Koch <wk@g10code.com>
|
2009-06-16 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg/pgp-import.c: New.
|
* gpg/pgp-import.c: New.
|
||||||
|
@ -80,7 +80,20 @@ passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
|
|||||||
DWORD written;
|
DWORD written;
|
||||||
WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
|
WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
|
||||||
#else
|
#else
|
||||||
write (fd, "abc\n", 4);
|
int res;
|
||||||
|
char *pass = "abc\n";
|
||||||
|
int passlen = strlen (pass);
|
||||||
|
int off = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
res = write (fd, &pass[off], passlen - off);
|
||||||
|
if (res > 0)
|
||||||
|
off += res;
|
||||||
|
}
|
||||||
|
while (res > 0 && off != passlen);
|
||||||
|
|
||||||
|
return off == passlen ? 0 : gpgme_error_from_errno (errno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -62,8 +62,20 @@ gpgme_error_t
|
|||||||
passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
|
passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
|
||||||
int last_was_bad, int fd)
|
int last_was_bad, int fd)
|
||||||
{
|
{
|
||||||
write (fd, "abc\n", 4);
|
int res;
|
||||||
return 0;
|
char *pass = "abc\n";
|
||||||
|
int passlen = strlen (pass);
|
||||||
|
int off = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
res = write (fd, &pass[off], passlen - off);
|
||||||
|
if (res > 0)
|
||||||
|
off += res;
|
||||||
|
}
|
||||||
|
while (res > 0 && off != passlen);
|
||||||
|
|
||||||
|
return off == passlen ? 0 : gpgme_error_from_errno (errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user