Hello community,
here is the log from the commit of package libassuan for openSUSE:Factory checked in at 2015-08-31 22:58:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libassuan (Old)
and /work/SRC/openSUSE:Factory/.libassuan.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libassuan"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libassuan/libassuan.changes 2015-05-15 09:02:39.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libassuan.new/libassuan.changes 2015-08-31 22:58:11.000000000 +0200
@@ -1,0 +2,15 @@
+Fri Aug 28 13:25:28 UTC 2015 - astieger@suse.com
+
+- libassuan 2.3.0:
+ * Now wipes out the memory of the context structure before freeing.
+ The context may have stored sensitive data in its line buffers.
+ * Fixed a problem with the data length limit in assuan_inquire.
+ * Returns GPG_ERR_SOURCE_ASSUAN with errors from functions w/o a
+ context.
+ * Two new functions to tweak the behaviour of the socket wrappers.
+ * By default build without a build timestamp.
+ * Interface changes relative to the 2.2.1 release:
+ assuan_sock_set_flag NEW.
+ assuan_sock_get_flag NEW.
+
+-------------------------------------------------------------------
Old:
----
libassuan-2.2.1.tar.bz2
libassuan-2.2.1.tar.bz2.sig
New:
----
libassuan-2.3.0.tar.bz2
libassuan-2.3.0.tar.bz2.sig
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libassuan.spec ++++++
--- /var/tmp/diff_new_pack.9jEo5t/_old 2015-08-31 22:58:12.000000000 +0200
+++ /var/tmp/diff_new_pack.9jEo5t/_new 2015-08-31 22:58:12.000000000 +0200
@@ -17,7 +17,7 @@
Name: libassuan
-Version: 2.2.1
+Version: 2.3.0
Release: 0
Summary: IPC library used by GnuPG version 2
License: GPL-3.0+ and LGPL-2.1+
++++++ libassuan-2.2.1.tar.bz2 -> libassuan-2.3.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/AUTHORS new/libassuan-2.3.0/AUTHORS
--- old/libassuan-2.2.1/AUTHORS 2014-08-17 13:03:32.000000000 +0200
+++ new/libassuan-2.3.0/AUTHORS 2015-08-28 14:38:59.000000000 +0200
@@ -55,7 +55,7 @@
Copyright (C) 1992-2013 Free Software Foundation, Inc.
Copyright (C) 1994 X Consortium
Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001-2014 g10 Code GmbH
+ Copyright (C) 2001-2015 g10 Code GmbH
Copyright (C) 2004 Simon Josefsson
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/ChangeLog new/libassuan-2.3.0/ChangeLog
--- old/libassuan-2.2.1/ChangeLog 2015-05-12 13:49:46.000000000 +0200
+++ new/libassuan-2.3.0/ChangeLog 2015-08-28 14:50:33.000000000 +0200
@@ -1,3 +1,64 @@
+2015-08-28 Werner Koch
+
+ Release 2.3.0.
+ * configure.ac: Set LT version to C6/A6/R0.
+
+ Support Cygwin local sockets.
+ * src/assuan-socket.c (cygwin_fdtable, cygwin_fdtable_cs): New.
+ (is_cygwin_fd, insert_cygwin_fd, delete_cygwin_fd): New.
+ (assuan_sock_init) [W32]: Init the CS.
+ (assuan_sock_deinit) [W32]: Deinit the CS.
+ (read_port_and_nonce): Add arg cygwin and detect Cygwin socket files.
+ (_assuan_sock_set_flag): Add "cygwin" flag.
+ (_assuan_sock_get_flag): Ditto.
+ (do_readn, do_writen): New.
+ (_assuan_sock_bind): Create a Cygwin socket file depending on a socket
+ flag.
+ (_assuan_sock_connect): Handle the cygwin socket protocol.
+ (_assuan_sock_check_nonce): Ditto.
+
+ Read up remaining lines in assuan_inquire after reaching MAXLEN.
+ * src/assuan-inquire.c (assuan_inquire): Clear return args on error.
+ Read up remaining lines after MAXLEN has been hit.
+
+2015-08-25 Werner Koch
+
+ Add configure option --enable-build-timestamp.
+ * configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default.
+
+2015-08-07 Werner Koch
+
+ Wipe the context before releasing as an extra safeguard.
+ * src/assuan-defs.h (wipememory2, wipememory): New. Taken from GnuPG.
+ * src/assuan.c (assuan_release): Wipe the context.
+
+2015-06-30 Werner Koch
+
+ Add assuan_sock_set_flag and assuan_sock_get_flag.
+ * src/assuan-socket.c (_assuan_sock_set_flag): New.
+ (assuan_sock_set_flag): New.
+ (_assuan_sock_get_flag, assuan_sock_get_flag): New.
+ * src/assuan.h.in (assuan_sock_set_flag): New.
+ (assuan_sock_get_flag): New.
+ * src/libassuan.def: Add them.
+ * src/libassuan.vers: Add them.
+
+2015-06-26 Werner Koch
+
+ Return GPG_ERR_SOURCE_ASSUAN on errors with no CTX.
+ * src/assuan-defs.h (_assuan_error): Use error source Assuan if no CTX
+ is given.
+
+ Do not segv if NULL is passed for CTX in sendfd and receivefd.
+ * src/assuan-buffer.c (assuan_sendfd): Check that CTX is not NULL.
+ (assuan_receivefd): Ditto.
+
+2015-06-01 Neal H. Walfield
+
+ Fix documentation for assuan_inquire.
+ * doc/assuan.texi (assuan_inquire): Fix and improve description of
+ this function.
+
2015-05-12 Werner Koch
Release 2.2.1.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/NEWS new/libassuan-2.3.0/NEWS
--- old/libassuan-2.2.1/NEWS 2015-05-12 13:44:23.000000000 +0200
+++ new/libassuan-2.3.0/NEWS 2015-08-28 14:45:58.000000000 +0200
@@ -1,3 +1,26 @@
+Noteworthy changes in version 2.3.0 (2015-08-28) [C6/A6/R0]
+------------------------------------------------
+
+ * Now wipes out the memory of the context structure before freeing.
+ The context may have stored sensitive data in its line buffers.
+
+ * Fixed a problem with the data length limit in assuan_inquire.
+
+ * Returns GPG_ERR_SOURCE_ASSUAN with errors from functions w/o a
+ context.
+
+ * Two new functions to tweak the behaviour of the socket wrappers.
+
+ * Experimental code to support Cygwin's local sockets.
+
+ * By default build without a build timestamp.
+
+ * Interface changes relative to the 2.2.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ assuan_sock_set_flag NEW.
+ assuan_sock_get_flag NEW.
+
+
Noteworthy changes in version 2.2.1 (2015-05-12) [C5/A5/R1]
------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/README new/libassuan-2.3.0/README
--- old/libassuan-2.2.1/README 2014-08-17 12:50:06.000000000 +0200
+++ new/libassuan-2.3.0/README 2015-08-28 14:36:51.000000000 +0200
@@ -2,7 +2,7 @@
===========
Copyright (C) 2001-2013 Free Software Foundation, Inc.
- Copyright (C) 2001-2014 g10 Code GmbH
+ Copyright (C) 2001-2015 g10 Code GmbH
This is a general purpose IPC library which is for example used
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/VERSION new/libassuan-2.3.0/VERSION
--- old/libassuan-2.2.1/VERSION 2015-05-12 13:49:46.000000000 +0200
+++ new/libassuan-2.3.0/VERSION 2015-08-28 14:50:33.000000000 +0200
@@ -1 +1 @@
-2.2.1
+2.3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/configure new/libassuan-2.3.0/configure
--- old/libassuan-2.2.1/configure 2015-05-12 13:47:51.000000000 +0200
+++ new/libassuan-2.3.0/configure 2015-08-28 14:50:09.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libassuan 2.2.1.
+# Generated by GNU Autoconf 2.69 for libassuan 2.3.0.
#
# Report bugs to http://bugs.gnupg.org.
#
@@ -590,8 +590,8 @@
# Identity of this package.
PACKAGE_NAME='libassuan'
PACKAGE_TARNAME='libassuan'
-PACKAGE_VERSION='2.2.1'
-PACKAGE_STRING='libassuan 2.2.1'
+PACKAGE_VERSION='2.3.0'
+PACKAGE_STRING='libassuan 2.3.0'
PACKAGE_BUGREPORT='http://bugs.gnupg.org'
PACKAGE_URL=''
@@ -794,6 +794,7 @@
with_gnu_ld
with_sysroot
enable_libtool_lock
+enable_build_timestamp
with_libgpg_error_prefix
with_gpg_error_prefix
'
@@ -1347,7 +1348,7 @@
# 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 libassuan 2.2.1 to adapt to many kinds of systems.
+\`configure' configures libassuan 2.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1417,7 +1418,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libassuan 2.2.1:";;
+ short | recursive ) echo "Configuration of libassuan 2.3.0:";;
esac
cat <<\_ACEOF
@@ -1439,6 +1440,9 @@
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-build-timestamp
+ set an explicit build timestamp for reproducibility.
+ (default is the current time in ISO-8601 format)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1530,7 +1534,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libassuan configure 2.2.1
+libassuan configure 2.3.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2110,7 +2114,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libassuan $as_me 2.2.1, which was
+It was created by libassuan $as_me 2.3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2465,9 +2469,9 @@
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBASSUAN_LT_CURRENT=5
-LIBASSUAN_LT_AGE=5
-LIBASSUAN_LT_REVISION=1
+LIBASSUAN_LT_CURRENT=6
+LIBASSUAN_LT_AGE=6
+LIBASSUAN_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
LIBASSUAN_CONFIG_API_VERSION=2
@@ -2995,7 +2999,7 @@
# Define the identity of the package.
PACKAGE='libassuan'
- VERSION='2.2.1'
+ VERSION='2.3.0'
cat >>confdefs.h <<_ACEOF
@@ -4767,7 +4771,7 @@
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
-VERSION_NUMBER=0x020201
+VERSION_NUMBER=0x020300
@@ -13543,7 +13547,7 @@
#
# Provide information about the build.
#
-BUILD_REVISION="1f0896c"
+BUILD_REVISION="cdb1e64"
cat >>confdefs.h <<_ACEOF
@@ -13552,10 +13556,20 @@
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
-BUILD_FILEVERSION="${BUILD_FILEVERSION}7944"
+BUILD_FILEVERSION="${BUILD_FILEVERSION}52657"
-BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
+# Check whether --enable-build-timestamp was given.
+if test "${enable_build_timestamp+set}" = set; then :
+ enableval=$enable_build_timestamp; if test "$enableval" = "yes"; then
+ BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
+ else
+ BUILD_TIMESTAMP="$enableval"
+ fi
+else
+ BUILD_TIMESTAMP="<none>"
+fi
+
cat >>confdefs.h <<_ACEOF
@@ -15257,7 +15271,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libassuan $as_me 2.2.1, which was
+This file was extended by libassuan $as_me 2.3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15323,7 +15337,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libassuan config.status 2.2.1
+libassuan config.status 2.3.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -17318,6 +17332,6 @@
echo "
Libassuan v${VERSION} has been configured as follows:
- Revision: 1f0896c (7944)
+ Revision: cdb1e64 (52657)
Platform: $host
"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/configure.ac new/libassuan-2.3.0/configure.ac
--- old/libassuan-2.2.1/configure.ac 2015-05-12 13:44:36.000000000 +0200
+++ new/libassuan-2.3.0/configure.ac 2015-08-28 14:36:18.000000000 +0200
@@ -31,8 +31,8 @@
# for the LT versions.
m4_define([mym4_package],[libassuan])
m4_define([mym4_major], [2])
-m4_define([mym4_minor], [2])
-m4_define([mym4_micro], [1])
+m4_define([mym4_minor], [3])
+m4_define([mym4_micro], [0])
# To start a new development series, i.e a new major or minor number
# you need to mark an arbitrary commit before the first beta release
@@ -59,9 +59,9 @@
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBASSUAN_LT_CURRENT=5
-LIBASSUAN_LT_AGE=5
-LIBASSUAN_LT_REVISION=1
+LIBASSUAN_LT_CURRENT=6
+LIBASSUAN_LT_AGE=6
+LIBASSUAN_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
LIBASSUAN_CONFIG_API_VERSION=2
@@ -254,7 +254,16 @@
BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
AC_SUBST(BUILD_FILEVERSION)
-BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
+AC_ARG_ENABLE([build-timestamp],
+ AC_HELP_STRING([--enable-build-timestamp],
+ [set an explicit build timestamp for reproducibility.
+ (default is the current time in ISO-8601 format)]),
+ [if test "$enableval" = "yes"; then
+ BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
+ else
+ BUILD_TIMESTAMP="$enableval"
+ fi],
+ [BUILD_TIMESTAMP="<none>"])
AC_SUBST(BUILD_TIMESTAMP)
AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
[The time this package was configured for a build])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/doc/assuan.info new/libassuan-2.3.0/doc/assuan.info
--- old/libassuan-2.2.1/doc/assuan.info 2015-05-12 13:49:45.000000000 +0200
+++ new/libassuan-2.3.0/doc/assuan.info 2015-08-28 14:41:39.000000000 +0200
@@ -7,15 +7,15 @@
This file documents the use and the internals of Assuan.
- This is Edition 2.2.1, last updated 12 May 2015, of 'The 'Developing
-with Assuan' Manual', for Version 2.2.1.
+ This is Edition 2.3.0, last updated 28 August 2015, of 'The
+'Developing with Assuan' Manual', for Version 2.3.0.
Published by the Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
- Copyright (C) 2002, 2003, 2006, 2007, 2011 Free Software Foundation,
-Inc.
+ Copyright (C) 2001-2013 Free Software Foundation, Inc.
+Copyright (C) 2001-2015 g10 Code GmbH
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License as published by the
@@ -1066,10 +1066,11 @@
descriptor must be sent before the command is issued that makes use
of the descriptor.
- Note that calling this function with a CTX of 'NULL' and FD of '-1'
- can be used as a runtime test to check whether descriptor passing
- is available on the platform. If it is, 0 is returned, otherwise
- an error with the error code 'GPG_ERR_NOT_IMPLEMENTED'.
+ Note that calling this function with a CTX of 'NULL' and FD of
+ 'ASSUAN_INVALID_FD' can be used as a runtime test to check whether
+ descriptor passing is available on the platform: '0' is returned if
+ descriptor passing is available, otherwise an error with the error
+ code 'GPG_ERR_NOT_IMPLEMENTED' is returned.
-- Function: gpg_error_t assuan_receivefd (assuan_context_t CTX,
assuan_fd_t *FD)
@@ -1579,18 +1580,18 @@
const char *KEYWORD, unsigned char **R_BUFFER,
size_t *R_LENGTH, size_t MAXLEN)
- A server may use this function to inquire data from a client. It
- sends an 'INQUIRE' command back to the server and returns the
- response conveniently in a newly allocated buffer. You need to
- pass at least the server's context CTX and the KEYWORD describing
- the requested data. All other parameters may be 'NULL' or '0',
- although this is rarely useful.
+ A server may use this function to request specific data from a
+ client. This function sends an 'INQUIRE' command back to the
+ client and returns the client's response in a newly allocated
+ buffer. You need to pass at least the server's context (CTX) and a
+ description of the required data (KEYWORD). All other parameters
+ may be 'NULL' or '0', but this is rarely useful.
On success the result is stored in a newly allocated buffer stored
at R_BUFFER. The length of the data is stored at R_LENGTH. If
- MAXLEN has not been given as '0', it describes an upper size
- limited of the expected data. If the client returns too much data
- the function fails and an error with the error code
+ MAXLEN has not been given as '0', it specifies an upper size limit
+ of the expected data. If the client returns too much data the
+ function fails and an error with the error code
'GPG_ERR_ASS_TOO_MUCH_DATA' will be returned.
-- Function: FILE* assuan_get_data_fp (assuan_context_t CTX)
@@ -1830,6 +1831,35 @@
cleanness of code it may be used on POSIX systems as well, where
this function is a nop.
+ To control certain properties of the wrapper two additional functions
+are provided:
+
+ -- Function: int assuan_sock_set_flag ( assuan_fd_t FD,
+ const char *NAME, int VALUE)
+
+ Set the flags NAME for socket FD to VALUE. See below for a list of
+ valid names. Returns 0 on success; on failure sets ERRNO and
+ returns -1.
+
+ -- Function: int assuan_sock_get_flag ( assuan_fd_t FD,
+ const char *NAME, int *R_VALUE)
+
+ Store the current value of the flag NAME for socket FD at R_VALUE.
+ See below for a list of valid names. Returns 0 on success; on
+ failure sets ERRNO and returns -1.
+
+ The supported flags are:
+
+'cygwin'
+ This flag has an effect only on Windows. If the value is 1, the
+ socket is set into Cygwin mode so that Cygwin clients can connect
+ to such a socket. This flag needs to be set before a bind and
+ should not be changed during the lifetime of the socket. There is
+ no need to set this flag for connecting to a Cygwin style socket
+ because no state is required at the client. On non-Windows
+ platforms setting this flag is ignored, reading the flag always
+ returns a value of 0.
+
File: assuan.info, Node: Library Copying, Next: Copying, Prev: Socket wrappers, Up: Top
@@ -3122,7 +3152,7 @@
* assuan_process_next: External I/O Loop Server.
(line 69)
* assuan_read_line: Reading and Writing. (line 12)
-* assuan_receivefd: Client code. (line 120)
+* assuan_receivefd: Client code. (line 121)
* assuan_register_bye_notify: Server code. (line 168)
* assuan_register_cancel_notify: Server code. (line 180)
* assuan_register_command: Server code. (line 141)
@@ -3157,9 +3187,11 @@
* assuan_sock_close: Socket wrappers. (line 20)
* assuan_sock_connect: Socket wrappers. (line 27)
* assuan_sock_deinit: Socket wrappers. (line 17)
+* assuan_sock_get_flag: Socket wrappers. (line 102)
* assuan_sock_get_nonce: Socket wrappers. (line 70)
* assuan_sock_init: Socket wrappers. (line 13)
* assuan_sock_new: Socket wrappers. (line 23)
+* assuan_sock_set_flag: Socket wrappers. (line 95)
* assuan_sock_set_sockaddr_un: Socket wrappers. (line 44)
* assuan_transact: Client code. (line 72)
* assuan_write_line: Reading and Writing. (line 23)
@@ -3179,38 +3211,38 @@
Tag Table:
-Node: Top884
-Node: Introduction1950
-Node: Assuan4205
-Node: Implementation5249
-Node: Server responses6428
-Node: Client requests8718
-Node: Error codes11756
-Node: Preparation12095
-Node: Header12670
-Node: Building sources13456
-Node: Automake15355
-Node: Multi Threading16503
-Node: Generalities17462
-Node: Data Types17866
-Node: Initializing the library18974
-Ref: function assuan_set_gpg_err_source21477
-Node: Default Log Handler23796
-Node: Contexts25562
-Ref: function assuan_new26142
-Node: Reading and Writing36332
-Node: Client code39807
-Ref: function assuan_sendfd44804
-Ref: function assuan_receivefd45337
-Node: Server code45712
-Node: External I/O Loop57837
-Node: External I/O Loop Client59662
-Node: External I/O Loop Server62747
-Node: Utilities67331
-Ref: Utilities-Footnote-175418
-Node: Socket wrappers75482
-Node: Library Copying79650
-Node: Copying107762
-Node: Index145276
+Node: Top906
+Node: Introduction1972
+Node: Assuan4227
+Node: Implementation5271
+Node: Server responses6450
+Node: Client requests8740
+Node: Error codes11778
+Node: Preparation12117
+Node: Header12692
+Node: Building sources13478
+Node: Automake15377
+Node: Multi Threading16525
+Node: Generalities17484
+Node: Data Types17888
+Node: Initializing the library18996
+Ref: function assuan_set_gpg_err_source21499
+Node: Default Log Handler23818
+Node: Contexts25584
+Ref: function assuan_new26164
+Node: Reading and Writing36354
+Node: Client code39829
+Ref: function assuan_sendfd44826
+Ref: function assuan_receivefd45417
+Node: Server code45792
+Node: External I/O Loop57917
+Node: External I/O Loop Client59742
+Node: External I/O Loop Server62827
+Node: Utilities67411
+Ref: Utilities-Footnote-175512
+Node: Socket wrappers75576
+Node: Library Copying80919
+Node: Copying109031
+Node: Index146545
End Tag Table
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/doc/assuan.texi new/libassuan-2.3.0/doc/assuan.texi
--- old/libassuan-2.2.1/doc/assuan.texi 2015-05-12 13:39:30.000000000 +0200
+++ new/libassuan-2.3.0/doc/assuan.texi 2015-08-28 14:41:37.000000000 +0200
@@ -3,7 +3,8 @@
@setfilename assuan.info
@macro copyrightnotice
-Copyright @copyright{} 2002, 2003, 2006, 2007, 2011 Free Software Foundation, Inc.
+Copyright @copyright{} 2001--2013 Free Software Foundation, Inc. @*
+Copyright @copyright{} 2001--2015 g10 Code GmbH
@end macro
@macro permissionnotice
Permission is granted to copy, distribute and/or modify this document
@@ -1205,8 +1206,10 @@
use of the descriptor.
Note that calling this function with a @var{ctx} of @code{NULL} and
-@var{fd} of @code{-1} can be used as a runtime test to check whether
-descriptor passing is available on the platform. If it is, 0 is returned, otherwise an error with the error code @code{GPG_ERR_NOT_IMPLEMENTED}.
+@var{fd} of @code{ASSUAN_INVALID_FD} can be used as a runtime test to
+check whether descriptor passing is available on the platform:
+@code{0} is returned if descriptor passing is available, otherwise an
+error with the error code @code{GPG_ERR_NOT_IMPLEMENTED} is returned.
@end deftypefun
@anchor{function assuan_receivefd}
@@ -1752,17 +1755,17 @@
@deftypefun gpg_error_t assuan_inquire (@w{assuan_context_t @var{ctx}}, @w{const char *@var{keyword}}, @w{unsigned char **@var{r_buffer}}, @w{size_t *@var{r_length}}, @w{size_t @var{maxlen}})
-A server may use this function to inquire data from a client. It sends
-an @code{INQUIRE} command back to the server and returns the response
-conveniently in a newly allocated buffer. You need to pass at least the
-server's context @var{ctx} and the @var{keyword} describing the
-requested data. All other parameters may be @code{NULL} or @code{0},
-although this is rarely useful.
+A server may use this function to request specific data from a client.
+This function sends an 'INQUIRE' command back to the client and
+returns the client's response in a newly allocated buffer. You need
+to pass at least the server's context (@var{ctx}) and a description of
+the required data (@var{keyword}). All other parameters may be
+@code{NULL} or @code{0}, but this is rarely useful.
On success the result is stored in a newly allocated buffer stored at
@var{r_buffer}. The length of the data is stored at @var{r_length}.
-If @var{maxlen} has not been given as @code{0}, it describes an upper
-size limited of the expected data. If the client returns too much
+If @var{maxlen} has not been given as @code{0}, it specifies an upper
+size limit of the expected data. If the client returns too much
data the function fails and an error with the error code
@code{GPG_ERR_ASS_TOO_MUCH_DATA} will be returned.
@end deftypefun
@@ -2044,6 +2047,42 @@
a nop.
@end deftypefun
+To control certain properties of the wrapper two additional functions
+are provided:
+
+@deftypefun int assuan_sock_set_flag ( @
+ @w{assuan_fd_t @var{fd}}, @
+ @w{const char *@var{name}}, @
+ @w{int @var{value}})
+
+Set the flags @var{name} for socket @var{fd} to @var{value}. See
+below for a list of valid names. Returns 0 on success; on failure
+sets ERRNO and returns -1.
+@end deftypefun
+
+@deftypefun int assuan_sock_get_flag ( @
+ @w{assuan_fd_t @var{fd}}, @
+ @w{const char *@var{name}}, @
+ @w{int *@var{r_value}})
+
+Store the current value of the flag @var{name} for socket @var{fd} at
+@var{r_value}. See below for a list of valid names. Returns 0 on
+success; on failure sets ERRNO and returns -1.
+@end deftypefun
+
+The supported flags are:
+
+@table @code
+@item cygwin
+This flag has an effect only on Windows. If the value is 1, the
+socket is set into Cygwin mode so that Cygwin clients can connect to
+such a socket. This flag needs to be set before a bind and should not
+be changed during the lifetime of the socket. There is no need to set
+this flag for connecting to a Cygwin style socket because no state is
+required at the client. On non-Windows platforms setting this flag is
+ignored, reading the flag always returns a value of 0.
+
+@end table
@c ---------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/doc/stamp-vti new/libassuan-2.3.0/doc/stamp-vti
--- old/libassuan-2.2.1/doc/stamp-vti 2015-05-12 13:49:43.000000000 +0200
+++ new/libassuan-2.3.0/doc/stamp-vti 2015-08-28 14:50:32.000000000 +0200
@@ -1,4 +1,4 @@
-@set UPDATED 12 May 2015
-@set UPDATED-MONTH May 2015
-@set EDITION 2.2.1
-@set VERSION 2.2.1
+@set UPDATED 28 August 2015
+@set UPDATED-MONTH August 2015
+@set EDITION 2.3.0
+@set VERSION 2.3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/doc/version.texi new/libassuan-2.3.0/doc/version.texi
--- old/libassuan-2.2.1/doc/version.texi 2015-05-12 13:49:43.000000000 +0200
+++ new/libassuan-2.3.0/doc/version.texi 2015-08-28 10:22:53.000000000 +0200
@@ -1,4 +1,4 @@
-@set UPDATED 12 May 2015
-@set UPDATED-MONTH May 2015
-@set EDITION 2.2.1
-@set VERSION 2.2.1
+@set UPDATED 28 August 2015
+@set UPDATED-MONTH August 2015
+@set EDITION 2.3.0
+@set VERSION 2.3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/Makefile.in new/libassuan-2.3.0/src/Makefile.in
--- old/libassuan-2.2.1/src/Makefile.in 2015-05-12 13:47:50.000000000 +0200
+++ new/libassuan-2.3.0/src/Makefile.in 2015-08-28 14:50:08.000000000 +0200
@@ -108,7 +108,7 @@
subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/libassuan-config.in $(srcdir)/versioninfo.rc.in \
- memrchr.c funopen.c setenv.c vasprintf.c isascii.c stpcpy.c \
+ setenv.c isascii.c memrchr.c vasprintf.c stpcpy.c funopen.c \
putc_unlocked.c $(top_srcdir)/build-aux/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/assuan-buffer.c new/libassuan-2.3.0/src/assuan-buffer.c
--- old/libassuan-2.2.1/src/assuan-buffer.c 2014-11-07 17:12:45.000000000 +0100
+++ new/libassuan-2.3.0/src/assuan-buffer.c 2015-06-26 11:55:19.000000000 +0200
@@ -524,6 +524,9 @@
return _assuan_error (ctx, GPG_ERR_NOT_IMPLEMENTED);
#endif
+ if (!ctx)
+ return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
+
if (! ctx->engine.sendfd)
return set_error (ctx, GPG_ERR_NOT_IMPLEMENTED,
"server does not support sending and receiving "
@@ -534,6 +537,9 @@
gpg_error_t
assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd)
{
+ if (!ctx)
+ return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
+
if (! ctx->engine.receivefd)
return set_error (ctx, GPG_ERR_NOT_IMPLEMENTED,
"server does not support sending and receiving "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/assuan-defs.h new/libassuan-2.3.0/src/assuan-defs.h
--- old/libassuan-2.2.1/src/assuan-defs.h 2014-11-28 15:59:45.000000000 +0100
+++ new/libassuan-2.3.0/src/assuan-defs.h 2015-08-28 12:28:15.000000000 +0200
@@ -228,7 +228,7 @@
static GPG_ERR_INLINE gpg_error_t
_assuan_error (assuan_context_t ctx, gpg_err_code_t errcode)
{
- return gpg_err_make (ctx?ctx->err_source:0, errcode);
+ return gpg_err_make (ctx?ctx->err_source: GPG_ERR_SOURCE_ASSUAN, errcode);
}
/* Release all resources associated with an engine operation. */
@@ -404,6 +404,16 @@
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
+/* To avoid that a compiler optimizes memset calls away, these macros
+ can be used. */
+#define wipememory2(_ptr,_set,_len) do { \
+ volatile char *_vptr=(volatile char *)(_ptr); \
+ size_t _vlen=(_len); \
+ while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \
+ } while(0)
+#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
+
+
#if HAVE_W64_SYSTEM
# define SOCKET2HANDLE(s) ((void *)(s))
# define HANDLE2SOCKET(h) ((uintptr_t)(h))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/assuan-inquire.c new/libassuan-2.3.0/src/assuan-inquire.c
--- old/libassuan-2.2.1/src/assuan-inquire.c 2015-01-27 17:04:45.000000000 +0100
+++ new/libassuan-2.3.0/src/assuan-inquire.c 2015-08-28 12:28:15.000000000 +0200
@@ -136,7 +136,7 @@
* A server may use this to send an inquire. r_buffer, r_length and
* maxlen may all be NULL/0 to indicate that no real data is expected.
* The returned buffer is guaranteed to have an extra 0-byte after the
- * length. Thus it can be used as a string if embedded o bytes are
+ * length. Thus it can be used as a string if embedded 0 bytes are
* not an issue.
*
* Return value: 0 on success or an ASSUAN error code
@@ -152,6 +152,11 @@
int linelen;
int nodataexpected;
+ if (r_buffer)
+ *r_buffer = NULL;
+ if (r_length)
+ *r_length = 0;
+
if (!ctx || !keyword || (10 + strlen (keyword) >= sizeof (cmdbuf)))
return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
nodataexpected = !r_buffer && !r_length && !maxlen;
@@ -212,6 +217,9 @@
line += 2;
linelen -= 2;
+ if (mb.too_large)
+ continue; /* Need to read up the remaining data. */
+
p = line;
while (linelen)
{
@@ -229,18 +237,18 @@
}
line = p;
}
- if (mb.too_large)
- {
- rc = _assuan_error (ctx, GPG_ERR_ASS_TOO_MUCH_DATA);
- goto out;
- }
}
if (!nodataexpected)
{
- *r_buffer = get_membuf (ctx, &mb, r_length);
- if (!*r_buffer)
- rc = _assuan_error (ctx, gpg_err_code_from_syserror ());
+ if (mb.too_large)
+ rc = _assuan_error (ctx, GPG_ERR_ASS_TOO_MUCH_DATA);
+ else
+ {
+ *r_buffer = get_membuf (ctx, &mb, r_length);
+ if (!*r_buffer)
+ rc = _assuan_error (ctx, gpg_err_code_from_syserror ());
+ }
}
out:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/assuan-socket.c new/libassuan-2.3.0/src/assuan-socket.c
--- old/libassuan-2.2.1/src/assuan-socket.c 2015-01-27 16:38:16.000000000 +0100
+++ new/libassuan-2.3.0/src/assuan-socket.c 2015-08-28 12:28:41.000000000 +0200
@@ -1,5 +1,6 @@
-/* assuan-socket.c
+/* assuan-socket.c - Socket wrapper
Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 g10 Code GmbH
This file is part of Assuan.
@@ -78,8 +79,96 @@
+ strlen ((ptr)->sun_path))
#endif
+/* In the future, we can allow access to sock_ctx, if that context's
+ hook functions need to be overridden. There can only be one global
+ assuan_sock_* user (one library or one application) with this
+ convenience interface, if non-standard hook functions are
+ needed. */
+static assuan_context_t sock_ctx;
+
#ifdef HAVE_W32_SYSTEM
+/* A table of active Cygwin connections. This is only used for
+ listening socket which should be only a few. We do not enter
+ sockets after a connect into this table. */
+static assuan_fd_t cygwin_fdtable[16];
+/* A critical section to guard access to the table of Cygwin
+ connections. */
+static CRITICAL_SECTION cygwin_fdtable_cs;
+
+
+/* Return true if SOCKFD is listed as Cygwin socket. */
+static int
+is_cygwin_fd (assuan_fd_t sockfd)
+{
+ int ret = 0;
+ int i;
+
+ EnterCriticalSection (&cygwin_fdtable_cs);
+ for (i=0; i < DIM(cygwin_fdtable); i++)
+ {
+ if (cygwin_fdtable[i] == sockfd)
+ {
+ ret = 1;
+ break;
+ }
+ }
+ LeaveCriticalSection (&cygwin_fdtable_cs);
+ return ret;
+}
+
+
+/* Insert SOCKFD into the table of Cygwin sockets. Return 0 on
+ success or -1 on error. */
+static int
+insert_cygwin_fd (assuan_fd_t sockfd)
+{
+ int ret = 0;
+ int mark = -1;
+ int i;
+
+ EnterCriticalSection (&cygwin_fdtable_cs);
+
+ for (i=0; i < DIM(cygwin_fdtable); i++)
+ {
+ if (cygwin_fdtable[i] == sockfd)
+ goto leave; /* Already in table. */
+ else if (cygwin_fdtable[i] == ASSUAN_INVALID_FD)
+ mark = i;
+ }
+ if (mark == -1)
+ {
+ gpg_err_set_errno (EMFILE);
+ ret = -1;
+ }
+ else
+ cygwin_fdtable[mark] = sockfd;
+
+ leave:
+ LeaveCriticalSection (&cygwin_fdtable_cs);
+ return ret;
+}
+
+
+/* Delete SOCKFD from the table of Cygwin sockets. */
+static void
+delete_cygwin_fd (assuan_fd_t sockfd)
+{
+ int i;
+
+ EnterCriticalSection (&cygwin_fdtable_cs);
+ for (i=0; i < DIM(cygwin_fdtable); i++)
+ {
+ if (cygwin_fdtable[i] == sockfd)
+ {
+ cygwin_fdtable[i] = ASSUAN_INVALID_FD;
+ break;
+ }
+ }
+ LeaveCriticalSection (&cygwin_fdtable_cs);
+ return;
+}
+
#ifdef HAVE_W32CE_SYSTEM
static wchar_t *
@@ -202,16 +291,19 @@
}
-/* W32: The buffer for NONCE needs to be at least 16 bytes. Returns 0 on
- success and sets errno on failure. */
+/* W32: The buffer for NONCE needs to be at least 16 bytes. Returns 0
+ on success and sets errno on failure. If FNAME has a Cygwin socket
+ descriptor True is stored at CYGWIN. */
static int
-read_port_and_nonce (const char *fname, unsigned short *port, char *nonce)
+read_port_and_nonce (const char *fname, unsigned short *port, char *nonce,
+ int *cygwin)
{
FILE *fp;
char buffer[50], *p;
size_t nread;
int aval;
+ *cygwin = 0;
fp = fopen (fname, "rb");
if (!fp)
return -1;
@@ -223,22 +315,52 @@
return -1;
}
buffer[nread] = 0;
- aval = atoi (buffer);
- if (aval < 1 || aval > 65535)
+ if (!strncmp (buffer, "!<socket >", 10))
{
- gpg_err_set_errno (EINVAL);
- return -1;
+ /* This is the Cygwin compatible socket emulation. The format
+ * of the file is:
+ *
+ * "!<socket >%u %c %08x-%08x-%08x-%08x\x00"
+ *
+ * %d for port number, %c for kind of socket (s for STREAM), and
+ * we have 16-byte random bytes for nonce. We only support
+ * stream mode.
+ */
+ unsigned int u0;
+ int narr[4];
+
+ if (sscanf (buffer+10, "%u s %08x-%08x-%08x-%08x",
+ &u0, narr+0, narr+1, narr+2, narr+3) != 5
+ || u0 < 1 || u0 > 65535)
+ {
+ gpg_err_set_errno (EINVAL);
+ return -1;
+ }
+ *port = u0;
+ memcpy (nonce, narr, 16);
+ *cygwin = 1;
}
- *port = (unsigned int)aval;
- for (p=buffer; nread && *p != '\n'; p++, nread--)
- ;
- if (*p != '\n' || nread != 17)
+ else
{
- gpg_err_set_errno (EINVAL);
- return -1;
+ /* This is our own socket emulation. */
+ aval = atoi (buffer);
+ if (aval < 1 || aval > 65535)
+ {
+ gpg_err_set_errno (EINVAL);
+ return -1;
+ }
+ *port = (unsigned int)aval;
+ for (p=buffer; nread && *p != '\n'; p++, nread--)
+ ;
+ if (*p != '\n' || nread != 17)
+ {
+ gpg_err_set_errno (EINVAL);
+ return -1;
+ }
+ p++; nread--;
+ memcpy (nonce, p, 16);
}
- p++; nread--;
- memcpy (nonce, p, 16);
+
return 0;
}
#endif /*HAVE_W32_SYSTEM*/
@@ -375,6 +497,111 @@
int
+_assuan_sock_set_flag (assuan_context_t ctx, assuan_fd_t sockfd,
+ const char *name, int value)
+{
+ if (!strcmp (name, "cygwin"))
+ {
+#ifdef HAVE_W32_SYSTEM
+ if (!value)
+ delete_cygwin_fd (sockfd);
+ else if (insert_cygwin_fd (sockfd))
+ return -1;
+#else
+ /* Setting the Cygwin flag on non-Windows is ignored. */
+#endif
+ }
+ else
+ {
+ gpg_err_set_errno (EINVAL);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int
+_assuan_sock_get_flag (assuan_context_t ctx, assuan_fd_t sockfd,
+ const char *name, int *r_value)
+{
+ (void)ctx;
+
+ if (!strcmp (name, "cygwin"))
+ {
+#ifdef HAVE_W32_SYSTEM
+ *r_value = is_cygwin_fd (sockfd);
+#else
+ *r_value = 0;
+#endif
+ }
+ else
+ {
+ gpg_err_set_errno (EINVAL);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+/* Read NBYTES from SOCKFD into BUFFER. Return 0 on success. Handle
+ EAGAIN and EINTR. */
+#ifdef HAVE_W32_SYSTEM
+static int
+do_readn (assuan_context_t ctx, assuan_fd_t sockfd,
+ void *buffer, size_t nbytes)
+{
+ char *p = buffer;
+ size_t n;
+
+ while (nbytes)
+ {
+ n = _assuan_read (ctx, sockfd, p, nbytes);
+ if (n < 0 && errno == EINTR)
+ ;
+ else if (n < 0 && errno == EAGAIN)
+ Sleep (100);
+ else if (n < 0)
+ return -1;
+ else if (!n)
+ {
+ gpg_err_set_errno (EIO);
+ return -1;
+ }
+ else
+ {
+ p += n;
+ nbytes -= n;
+ }
+ }
+ return 0;
+}
+
+
+/* Write NBYTES from BUFFER to SOCKFD. Return 0 on success; on error
+ return -1 and set ERRNO. */
+static int
+do_writen (assuan_context_t ctx, assuan_fd_t sockfd,
+ const void *buffer, size_t nbytes)
+{
+ int ret;
+
+ ret = _assuan_write (ctx, sockfd, buffer, nbytes);
+ if (ret >= 0 && ret != nbytes)
+ {
+ gpg_err_set_errno (EIO);
+ ret = -1;
+ }
+ else if (ret >= 0)
+ ret = 0;
+
+ return ret;
+}
+#endif /*HAVE_W32_SYSTEM*/
+
+
+int
_assuan_sock_connect (assuan_context_t ctx, assuan_fd_t sockfd,
struct sockaddr *addr, int addrlen)
{
@@ -385,10 +612,11 @@
struct sockaddr_un *unaddr;
unsigned short port;
char nonce[16];
+ int cygwin;
int ret;
unaddr = (struct sockaddr_un *)addr;
- if (read_port_and_nonce (unaddr->sun_path, &port, nonce))
+ if (read_port_and_nonce (unaddr->sun_path, &port, nonce, &cygwin))
return -1;
myaddr.sin_family = AF_INET;
@@ -405,20 +633,36 @@
if (!ret)
{
/* Send the nonce. */
- ret = _assuan_write (ctx, sockfd, nonce, 16);
- if (ret >= 0 && ret != 16)
+ ret = do_writen (ctx, sockfd, nonce, 16);
+ if (!ret && cygwin)
{
- gpg_err_set_errno (EIO);
- ret = -1;
+ char buffer[16];
+
+ /* The client sends the nonce back - not useful. We do
+ a dummy read. */
+ ret = do_readn (ctx, sockfd, buffer, 16);
+ if (!ret)
+ {
+ /* Send our credentials. */
+ int n = getpid ();
+ memcpy (buffer, &n, 4);
+ memset (buffer+4, 0, 4); /* uid = gid = 0 */
+ ret = do_writen (ctx, sockfd, buffer, 8);
+ if (!ret)
+ {
+ /* Receive credentials. We don't need them. */
+ ret = do_readn (ctx, sockfd, buffer, 8);
+ }
+ }
}
}
return ret;
}
else
{
- int res;
- res = _assuan_connect (ctx, HANDLE2SOCKET (sockfd), addr, addrlen);
- return res;
+ int ret;
+ ret = _assuan_connect (ctx, HANDLE2SOCKET (sockfd), addr, addrlen);
+ return ret;
}
#else
# if HAVE_STAT
@@ -470,11 +714,14 @@
HANDLE filehd;
int len = sizeof myaddr;
int rc;
- char nonce[16];
- char tmpbuf[33+16];
+ union {
+ char data[16];
+ int aint[4];
+ } nonce;
+ char tmpbuf[50+16];
DWORD nwritten;
- if (get_nonce (nonce, 16))
+ if (get_nonce (nonce.data, 16))
return -1;
unaddr = (struct sockaddr_un *)addr;
@@ -509,10 +756,22 @@
gpg_err_set_errno (save_e);
return rc;
}
- snprintf (tmpbuf, sizeof tmpbuf, "%d\n", ntohs (myaddr.sin_port));
- len = strlen (tmpbuf);
- memcpy (tmpbuf+len, nonce,16);
- len += 16;
+
+ if (is_cygwin_fd (sockfd))
+ {
+ snprintf (tmpbuf, sizeof tmpbuf,
+ "!<socket >%d s %08x-%08x-%08x-%08x",
+ ntohs (myaddr.sin_port),
+ nonce.aint[0], nonce.aint[1], nonce.aint[2], nonce.aint[3]);
+ len = strlen (tmpbuf) + 1;
+ }
+ else
+ {
+ snprintf (tmpbuf, sizeof tmpbuf-16, "%d\n", ntohs (myaddr.sin_port));
+ len = strlen (tmpbuf);
+ memcpy (tmpbuf+len, nonce.data,16);
+ len += 16;
+ }
if (!WriteFile (filehd, tmpbuf, len, &nwritten, NULL))
{
@@ -609,6 +868,7 @@
{
struct sockaddr_un *unaddr;
unsigned short port;
+ int dummy;
if (sizeof nonce->nonce != 16)
{
@@ -617,7 +877,7 @@
}
nonce->length = 16;
unaddr = (struct sockaddr_un *)addr;
- if (read_port_and_nonce (unaddr->sun_path, &port, nonce->nonce))
+ if (read_port_and_nonce (unaddr->sun_path, &port, nonce->nonce, &dummy))
return -1;
}
else
@@ -639,8 +899,7 @@
assuan_sock_nonce_t *nonce)
{
#ifdef HAVE_W32_SYSTEM
- char buffer[16], *p;
- size_t nleft;
+ char buffer[16];
int n;
if (sizeof nonce->nonce != 16)
@@ -658,33 +917,33 @@
return -1;
}
- p = buffer;
- nleft = 16;
- while (nleft)
- {
- n = _assuan_read (ctx, SOCKET2HANDLE(fd), p, nleft);
- if (n < 0 && errno == EINTR)
- ;
- else if (n < 0 && errno == EAGAIN)
- Sleep (100);
- else if (n < 0)
- return -1;
- else if (!n)
- {
- gpg_err_set_errno (EIO);
- return -1;
- }
- else
- {
- p += n;
- nleft -= n;
- }
- }
+ if (do_readn (ctx, fd, buffer, 16))
+ return -1;
if (memcmp (buffer, nonce->nonce, 16))
{
gpg_err_set_errno (EACCES);
return -1;
}
+ if (is_cygwin_fd (fd))
+ {
+ /* Send the nonce back to the client. */
+ if (do_writen (ctx, fd, buffer, 16))
+ return -1;
+ /* Read the credentials. Cygwin uses the
+ struct ucred { pid_t pid; uid_t uid; gid_t gid; };
+ with pid_t being an int (4 bytes) and uid_t and gid_t being
+ shorts (2 bytes). Thus we need to read 8 bytes. However we
+ we ignore the values because they are not kernel controlled. */
+ if (do_readn (ctx, fd, buffer, 8))
+ return -1;
+ /* Send our credentials: We use the uid and gid we received but
+ our own pid. */
+ n = getpid ();
+ memcpy (buffer, &n, 4);
+ if (do_writen (ctx, fd, buffer, 8))
+ return -1;
+ }
+
#else
(void)fd;
(void)nonce;
@@ -695,13 +954,6 @@
/* Public API. */
-/* In the future, we can allow access to sock_ctx, if that context's
- hook functions need to be overridden. There can only be one global
- assuan_sock_* user (one library or one application) with this
- convenience interface, if non-standard hook functions are
- needed. */
-static assuan_context_t sock_ctx;
-
gpg_error_t
assuan_sock_init ()
{
@@ -713,6 +965,10 @@
if (sock_ctx != NULL)
return 0;
+#ifdef HAVE_W32_SYSTEM
+ InitializeCriticalSection (&cygwin_fdtable_cs);
+#endif
+
err = assuan_new (&sock_ctx);
#ifdef HAVE_W32_SYSTEM
@@ -736,12 +992,20 @@
assuan_release (sock_ctx);
sock_ctx = NULL;
+
+#ifdef HAVE_W32_SYSTEM
+ DeleteCriticalSection (&cygwin_fdtable_cs);
+#endif
}
int
assuan_sock_close (assuan_fd_t fd)
{
+#ifdef HAVE_W32_SYSTEM
+ if (fd != ASSUAN_INVALID_FD)
+ delete_cygwin_fd (fd);
+#endif
return _assuan_close (sock_ctx, fd);
}
@@ -752,6 +1016,18 @@
}
int
+assuan_sock_set_flag (assuan_fd_t sockfd, const char *name, int value)
+{
+ return _assuan_sock_set_flag (sock_ctx, sockfd, name, value);
+}
+
+int
+assuan_sock_get_flag (assuan_fd_t sockfd, const char *name, int *r_value)
+{
+ return _assuan_sock_get_flag (sock_ctx, sockfd, name, r_value);
+}
+
+int
assuan_sock_connect (assuan_fd_t sockfd, struct sockaddr *addr, int addrlen)
{
return _assuan_sock_connect (sock_ctx, sockfd, addr, addrlen);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/assuan.c new/libassuan-2.3.0/src/assuan.c
--- old/libassuan-2.2.1/src/assuan.c 2013-03-15 20:26:09.000000000 +0100
+++ new/libassuan-2.3.0/src/assuan.c 2015-08-28 12:28:15.000000000 +0200
@@ -189,7 +189,11 @@
_assuan_reset (ctx);
/* None of the members that are our responsibility requires
- deallocation. */
+ deallocation. To avoid sensitive data in the line buffers we
+ wipe them out, though. Note that we can't wipe the entire
+ context because it also has a pointer to the actual free(). */
+ wipememory (&ctx->inbound, sizeof ctx->inbound);
+ wipememory (&ctx->outbound, sizeof ctx->outbound);
_assuan_free (ctx, ctx);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/assuan.h.in new/libassuan-2.3.0/src/assuan.h.in
--- old/libassuan-2.2.1/src/assuan.h.in 2014-11-28 15:59:24.000000000 +0100
+++ new/libassuan-2.3.0/src/assuan.h.in 2015-08-28 14:37:44.000000000 +0200
@@ -1,6 +1,6 @@
/* assuan.h - Definitions for the Assuan IPC library -*- c -*-
Copyright (C) 2001-2013 Free Software Foundation, Inc.
- Copyright (C) 2001-2014 g10 Code GmbH
+ Copyright (C) 2001-2015 g10 Code GmbH
This file is part of Assuan.
@@ -467,6 +467,8 @@
void assuan_sock_deinit (void);
int assuan_sock_close (assuan_fd_t fd);
assuan_fd_t assuan_sock_new (int domain, int type, int proto);
+int assuan_sock_set_flag (assuan_fd_t sockfd, const char *name, int value);
+int assuan_sock_get_flag (assuan_fd_t sockfd, const char *name, int *r_value);
int assuan_sock_connect (assuan_fd_t sockfd,
struct sockaddr *addr, int addrlen);
int assuan_sock_bind (assuan_fd_t sockfd, struct sockaddr *addr, int addrlen);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/context.c new/libassuan-2.3.0/src/context.c
--- old/libassuan-2.2.1/src/context.c 2014-08-14 19:32:45.000000000 +0200
+++ new/libassuan-2.3.0/src/context.c 2015-06-26 11:49:49.000000000 +0200
@@ -183,8 +183,8 @@
/* Store the error in the context so that the error sending function
- can take out a descriptive text. Inside the assuan code, use the
- macro set_error instead of this function. */
+ can take out a descriptive text. Inside the assuan code, use the
+ macro set_error instead of this function. */
gpg_error_t
assuan_set_error (assuan_context_t ctx, gpg_error_t err, const char *text)
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/libassuan.def new/libassuan-2.3.0/src/libassuan.def
--- old/libassuan-2.2.1/src/libassuan.def 2014-11-28 15:33:59.000000000 +0100
+++ new/libassuan-2.3.0/src/libassuan.def 2015-06-30 15:56:23.000000000 +0200
@@ -112,6 +112,8 @@
__assuan_waitpid @91
assuan_check_version @92
assuan_sock_set_sockaddr_un @93
+ assuan_sock_set_flag @94
+ assuan_sock_get_flag @95
; END
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/libassuan.vers new/libassuan-2.3.0/src/libassuan.vers
--- old/libassuan-2.2.1/src/libassuan.vers 2014-11-28 15:33:30.000000000 +0100
+++ new/libassuan-2.3.0/src/libassuan.vers 2015-06-29 18:16:30.000000000 +0200
@@ -102,6 +102,8 @@
assuan_socket_connect_fd;
assuan_check_version;
assuan_sock_set_sockaddr_un;
+ assuan_sock_set_flag;
+ assuan_sock_get_flag;
__assuan_close;
__assuan_pipe;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.2.1/src/versioninfo.rc.in new/libassuan-2.3.0/src/versioninfo.rc.in
--- old/libassuan-2.2.1/src/versioninfo.rc.in 2014-08-17 13:47:52.000000000 +0200
+++ new/libassuan-2.3.0/src/versioninfo.rc.in 2015-08-28 14:37:06.000000000 +0200
@@ -39,7 +39,7 @@
VALUE "FileDescription", "Assuan - GnuPG IPC\0"
VALUE "FileVersion", "@LIBASSUAN_LT_CURRENT@.@LIBASSUAN_LT_AGE@.@LIBASSUAN_LT_REVISION@.@BUILD_REVISION@\0"
VALUE "InternalName", "libassuan\0"
- VALUE "LegalCopyright", "Copyright © 2001-2014 g10 Code GmbH\0"
+ VALUE "LegalCopyright", "Copyright © 2001-2015 g10 Code GmbH\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libassuan.dll\0"
VALUE "PrivateBuild", "\0"