commit libassuan for openSUSE:Factory
Hello community, here is the log from the commit of package libassuan for openSUSE:Factory checked in at 2014-12-31 11:21:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2014-11-24 11:18:47.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libassuan.new/libassuan.changes 2014-12-31 11:22:01.000000000 +0100 @@ -1,0 +2,9 @@ +Sun Dec 28 16:50:41 UTC 2014 - andreas.stieger@gmx.de + +- libassuan 2.2.0: + * Added support for socket redirection. + * Interface changes relative to the 2.1.3 release: + assuan_sock_set_sockaddr_un NEW. +- fix SLE 11 SP2 build (make install) + +------------------------------------------------------------------- Old: ---- libassuan-2.1.3.tar.bz2 libassuan-2.1.3.tar.bz2.sig New: ---- libassuan-2.2.0.tar.bz2 libassuan-2.2.0.tar.bz2.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libassuan.spec ++++++ --- /var/tmp/diff_new_pack.OV109r/_old 2014-12-31 11:22:02.000000000 +0100 +++ /var/tmp/diff_new_pack.OV109r/_new 2014-12-31 11:22:02.000000000 +0100 @@ -17,7 +17,7 @@ Name: libassuan -Version: 2.1.3 +Version: 2.2.0 Release: 0 Summary: IPC library used by GnuPG version 2 License: GPL-3.0+ and LGPL-2.1+ @@ -65,7 +65,7 @@ make %{?_smp_mflags} %install -%make_install +make DESTDIR=%{buildroot} install %{?_smp_mflags} find %{buildroot} -type f -name "*.la" -delete -print %check ++++++ libassuan-2.1.3.tar.bz2 -> libassuan-2.2.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/ChangeLog new/libassuan-2.2.0/ChangeLog --- old/libassuan-2.1.3/ChangeLog 2014-11-07 18:06:06.000000000 +0100 +++ new/libassuan-2.2.0/ChangeLog 2014-12-11 13:12:28.000000000 +0100 @@ -1,3 +1,24 @@ +2014-12-11 Werner Koch <wk@gnupg.org> + + Release 2.2.0. + * configure.ac: Set LT version to C5/A5/R0. + (AM_INIT_AUTOMAKE): Add options. + * Makefile.am (AUTOMAKE_OPTIONS): Remove. + +2014-11-28 Werner Koch <wk@gnupg.org> + + Do not allow LFs in the redirected name. + * src/assuan-socket.c (eval_redirection): Stop parsing at the first + LF. + + Implement socket file redirection. + * configure.ac (AC_CHECK_FUNC): Check for stat. + * src/assuan-socket.c (SUN_LEN): Add. + (eval_redirection): New. + (_assuan_sock_connect) [!W32]: Implement socket file redirection. + (_assuan_sock_set_sockaddr_un): New. + (assuan_sock_set_sockaddr_un): New. + 2014-11-07 Werner Koch <wk@gnupg.org> Release 2.1.3. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/Makefile.am new/libassuan-2.2.0/Makefile.am --- old/libassuan-2.1.3/Makefile.am 2014-01-10 17:18:45.000000000 +0100 +++ new/libassuan-2.2.0/Makefile.am 2014-12-11 13:06:30.000000000 +0100 @@ -19,7 +19,6 @@ ACLOCAL_AMFLAGS = -I m4 -AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip # (A suitable gitlog-to-changelog script can be found in GnuPG master.) GITLOG_TO_CHANGELOG=gitlog-to-changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/Makefile.in new/libassuan-2.2.0/Makefile.in --- old/libassuan-2.1.3/Makefile.in 2014-11-07 18:05:29.000000000 +0100 +++ new/libassuan-2.2.0/Makefile.in 2014-12-11 13:11:40.000000000 +0100 @@ -296,7 +296,6 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 -AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip # (A suitable gitlog-to-changelog script can be found in GnuPG master.) GITLOG_TO_CHANGELOG = gitlog-to-changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/NEWS new/libassuan-2.2.0/NEWS --- old/libassuan-2.1.3/NEWS 2014-11-07 18:01:12.000000000 +0100 +++ new/libassuan-2.2.0/NEWS 2014-12-11 13:08:16.000000000 +0100 @@ -1,3 +1,13 @@ +Noteworthy changes in version 2.2.0 (2014-12-11) [C5/A5/R0] +------------------------------------------------ + + * Added support for socket redirection. + + * Interface changes relative to the 2.1.3 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + assuan_sock_set_sockaddr_un NEW. + + Noteworthy changes in version 2.1.3 (2014-11-07) [C4/A4/R3] ------------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/VERSION new/libassuan-2.2.0/VERSION --- old/libassuan-2.1.3/VERSION 2014-11-07 18:06:06.000000000 +0100 +++ new/libassuan-2.2.0/VERSION 2014-12-11 13:12:28.000000000 +0100 @@ -1 +1 @@ -2.1.3 +2.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/config.h.in new/libassuan-2.2.0/config.h.in --- old/libassuan-2.1.3/config.h.in 2014-11-07 18:06:06.000000000 +0100 +++ new/libassuan-2.2.0/config.h.in 2014-12-11 13:12:27.000000000 +0100 @@ -79,6 +79,9 @@ /* Defined if SO_PEERCRED is supported (Linux specific) */ #undef HAVE_SO_PEERCRED +/* Define to 1 if you have the `stat' function. */ +#undef HAVE_STAT + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/configure new/libassuan-2.2.0/configure --- old/libassuan-2.1.3/configure 2014-11-07 18:05:30.000000000 +0100 +++ new/libassuan-2.2.0/configure 2014-12-11 13:11:40.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libassuan 2.1.3. +# Generated by GNU Autoconf 2.69 for libassuan 2.2.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.1.3' -PACKAGE_STRING='libassuan 2.1.3' +PACKAGE_VERSION='2.2.0' +PACKAGE_STRING='libassuan 2.2.0' PACKAGE_BUGREPORT='http://bugs.gnupg.org' PACKAGE_URL='' @@ -1347,7 +1347,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.1.3 to adapt to many kinds of systems. +\`configure' configures libassuan 2.2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1417,7 +1417,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libassuan 2.1.3:";; + short | recursive ) echo "Configuration of libassuan 2.2.0:";; esac cat <<\_ACEOF @@ -1527,7 +1527,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libassuan configure 2.1.3 +libassuan configure 2.2.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2107,7 +2107,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.1.3, which was +It was created by libassuan $as_me 2.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2462,9 +2462,9 @@ # (Interfaces added: AGE++) # (Interfaces removed/changed: AGE=0) # -LIBASSUAN_LT_CURRENT=4 -LIBASSUAN_LT_AGE=4 -LIBASSUAN_LT_REVISION=3 +LIBASSUAN_LT_CURRENT=5 +LIBASSUAN_LT_AGE=5 +LIBASSUAN_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. LIBASSUAN_CONFIG_API_VERSION=2 @@ -2944,7 +2944,7 @@ # Define the identity of the package. PACKAGE='libassuan' - VERSION='2.1.3' + VERSION='2.2.0' cat >>confdefs.h <<_ACEOF @@ -4604,7 +4604,7 @@ #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF -VERSION_NUMBER=0x020103 +VERSION_NUMBER=0x020200 @@ -13446,7 +13446,7 @@ # # Provide information about the build. # -BUILD_REVISION="3003c5d" +BUILD_REVISION="261498d" cat >>confdefs.h <<_ACEOF @@ -13455,7 +13455,7 @@ BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` -BUILD_FILEVERSION="${BUILD_FILEVERSION}12291" +BUILD_FILEVERSION="${BUILD_FILEVERSION}9748" BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date` @@ -14245,7 +14245,7 @@ # # Checks for library functions. # -for ac_func in flockfile funlockfile inet_pton +for ac_func in flockfile funlockfile inet_pton stat do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -15153,7 +15153,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.1.3, which was +This file was extended by libassuan $as_me 2.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15219,7 +15219,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.1.3 +libassuan config.status 2.2.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -17216,6 +17216,6 @@ echo " Libassuan v${VERSION} has been configured as follows: - Revision: 3003c5d (12291) + Revision: 261498d (9748) Platform: $host " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/configure.ac new/libassuan-2.2.0/configure.ac --- old/libassuan-2.1.3/configure.ac 2014-11-07 18:01:43.000000000 +0100 +++ new/libassuan-2.2.0/configure.ac 2014-12-11 13:08:04.000000000 +0100 @@ -30,8 +30,8 @@ # for the LT versions. m4_define([mym4_package],[libassuan]) m4_define([mym4_major], [2]) -m4_define([mym4_minor], [1]) -m4_define([mym4_micro], [3]) +m4_define([mym4_minor], [2]) +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 @@ -58,9 +58,9 @@ # (Interfaces added: AGE++) # (Interfaces removed/changed: AGE=0) # -LIBASSUAN_LT_CURRENT=4 -LIBASSUAN_LT_AGE=4 -LIBASSUAN_LT_REVISION=3 +LIBASSUAN_LT_CURRENT=5 +LIBASSUAN_LT_AGE=5 +LIBASSUAN_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. LIBASSUAN_CONFIG_API_VERSION=2 @@ -74,7 +74,7 @@ VERSION=$PACKAGE_VERSION AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) AM_MAINTAINER_MODE AC_CONFIG_SRCDIR(src/assuan.h.in) AC_CONFIG_MACRO_DIR(m4) @@ -346,7 +346,7 @@ # # Checks for library functions. # -AC_CHECK_FUNCS([flockfile funlockfile inet_pton]) +AC_CHECK_FUNCS([flockfile funlockfile inet_pton stat]) # On some systems (e.g. Solaris) nanosleep requires linking to librl. # Given that we use nanosleep only as an optimization over a select diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/doc/assuan.info new/libassuan-2.2.0/doc/assuan.info --- old/libassuan-2.1.3/doc/assuan.info 2014-11-07 18:06:06.000000000 +0100 +++ new/libassuan-2.2.0/doc/assuan.info 2014-12-11 13:12:28.000000000 +0100 @@ -7,8 +7,8 @@ END-INFO-DIR-ENTRY This file documents the use and the internals of Assuan. - This is Edition 2.1.3, last updated 15 March 2013, of `The -`Developing with Assuan' Manual', for Version 2.1.3. + This is Edition 2.2.0, last updated 28 November 2014, of `The +`Developing with Assuan' Manual', for Version 2.2.0. Published by the Free Software Foundation 51 Franklin Street, Fifth Floor @@ -1746,13 +1746,43 @@ struct sockaddr *ADDR, int ADDRLEN) Wrapper around connect. For Unix domain sockets under Windows this function also does a write immediately after the the connect to - send the nonce as read from the socket's file. + send the nonce as read from the socket's file. Under Unix this + function check whether the socket file is a redirection file and + connects to the redirected socket instead; see + `assuan_sock_set_sockaddr_un' for details on the redirection file + format. -- Function: int assuan_sock_bind ( assuan_fd_t SOCKFD, struct sockaddr *ADDR, int ADDRLEN) Wrapper around bind. Under Windows this creates a file and writes the port number and a random nonce to this file. + -- Function: int assuan_sock_set_sockaddr_un ( const char *FNAME, + struct sockaddr *ADDR, int *R_REDIRECTED) + This is a helper function to initialize the Unix socket domain + address structure ADDR and store the file name FNAME there. If + R_REDIRECTED is not NULL the function checks whether FNAME already + exists, is a regular file, and not a socket. In that case FNAME + is read to see whether this is a redirection to a socket file. If + that is the case 1 is stored at R_REDIRECTED. If the file does + not look like a redirection file 0 will be stored there and FNAME + will be used in the regular way. + + The format of a redirection file is + + %Assuan% + socket=NAME + + With NAME being is the actual socket to use. No white spaces are + allowed, both lines must be terminated by a single linefeed, and + extra lines are not allowed. Environment variables are + interpreted in NAME if given in `${VAR}' notation. No escape + characters are defined; if the string `${' shall be used in file + name, an environment variable with that content may be used. The + length of the redirection file is limited to 511 bytes which is + more than sufficient for any known implementation of Unix domain + sockets. + -- Function: int assuan_sock_get_nonce ( struct sockaddr *ADDR, int ADDRLEN, assuan_sock_nonce_t *NONCE) This is used by the server after a bind to return the random @@ -3101,14 +3131,15 @@ * assuan_set_pointer: Contexts. (line 54) * assuan_set_sock_nonce: Server code. (line 111) * assuan_set_system_hooks: Contexts. (line 206) -* assuan_sock_bind: Socket wrappers. (line 35) -* assuan_sock_check_nonce: Socket wrappers. (line 46) +* assuan_sock_bind: Socket wrappers. (line 39) +* assuan_sock_check_nonce: Socket wrappers. (line 76) * assuan_sock_close: Socket wrappers. (line 21) * assuan_sock_connect: Socket wrappers. (line 29) * assuan_sock_deinit: Socket wrappers. (line 18) -* assuan_sock_get_nonce: Socket wrappers. (line 40) +* assuan_sock_get_nonce: Socket wrappers. (line 70) * assuan_sock_init: Socket wrappers. (line 14) * assuan_sock_new: Socket wrappers. (line 25) +* assuan_sock_set_sockaddr_un: Socket wrappers. (line 44) * assuan_socket_connect: Client code. (line 56) * assuan_transact: Client code. (line 78) * assuan_write_line: Reading and Writing. (line 25) @@ -3128,38 +3159,38 @@ Tag Table: -Node: Top938 -Node: Introduction2004 -Node: Assuan4070 -Node: Implementation5148 -Node: Server responses6306 -Node: Client requests8232 -Node: Error codes11247 -Node: Preparation11586 -Node: Header12164 -Node: Building sources12952 -Node: Automake14861 -Node: Multi Threading16009 -Node: Generalities16971 -Node: Data Types17375 -Node: Initializing the library18478 -Ref: function assuan_set_gpg_err_source20978 -Node: Default Log Handler23292 -Node: Contexts25058 -Ref: function assuan_new25638 -Node: Reading and Writing35835 -Node: Client code39286 -Ref: function assuan_sendfd44265 -Ref: function assuan_receivefd44797 -Node: Server code45170 -Node: External I/O Loop57258 -Node: External I/O Loop Client59076 -Node: External I/O Loop Server62166 -Node: Utilities66750 -Ref: Utilities-Footnote-174820 -Node: Socket wrappers74884 -Node: Library Copying77537 -Node: Copying105707 -Node: Index143331 +Node: Top941 +Node: Introduction2007 +Node: Assuan4073 +Node: Implementation5151 +Node: Server responses6309 +Node: Client requests8235 +Node: Error codes11250 +Node: Preparation11589 +Node: Header12167 +Node: Building sources12955 +Node: Automake14864 +Node: Multi Threading16012 +Node: Generalities16974 +Node: Data Types17378 +Node: Initializing the library18481 +Ref: function assuan_set_gpg_err_source20981 +Node: Default Log Handler23295 +Node: Contexts25061 +Ref: function assuan_new25641 +Node: Reading and Writing35838 +Node: Client code39289 +Ref: function assuan_sendfd44268 +Ref: function assuan_receivefd44800 +Node: Server code45173 +Node: External I/O Loop57261 +Node: External I/O Loop Client59079 +Node: External I/O Loop Server62169 +Node: Utilities66753 +Ref: Utilities-Footnote-174823 +Node: Socket wrappers74887 +Node: Library Copying79060 +Node: Copying107230 +Node: Index144854 End Tag Table diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/doc/assuan.texi new/libassuan-2.2.0/doc/assuan.texi --- old/libassuan-2.1.3/doc/assuan.texi 2013-03-15 20:26:09.000000000 +0100 +++ new/libassuan-2.2.0/doc/assuan.texi 2014-11-28 16:22:40.000000000 +0100 @@ -1935,7 +1935,10 @@ Wrapper around connect. For Unix domain sockets under Windows this function also does a write immediately after the the connect to send the -nonce as read from the socket's file. +nonce as read from the socket's file. Under Unix this function check +whether the socket file is a redirection file and connects to the +redirected socket instead; see @code{assuan_sock_set_sockaddr_un} for +details on the redirection file format. @end deftypefun @@ -1948,6 +1951,38 @@ port number and a random nonce to this file. @end deftypefun +@deftypefun int assuan_sock_set_sockaddr_un ( @ + @w{const char *@var{fname}}, @ + @w{struct sockaddr *@var{addr}}, @ + @w{int *@var{r_redirected}}) + +This is a helper function to initialize the Unix socket domain address +structure @var{addr} and store the file name @var{fname} there. If +@var{r_redirected} is not NULL the function checks whether @var{fname} +already exists, is a regular file, and not a socket. In that case +@var{fname} is read to see whether this is a redirection to a socket +file. If that is the case 1 is stored at @var{r_redirected}. If the +file does not look like a redirection file 0 will be stored there and +@var{fname} will be used in the regular way. + +The format of a redirection file is + +@example +%Assuan% +socket=@var{name} +@end example + +With @var{name} being is the actual socket to use. No white spaces +are allowed, both lines must be terminated by a single linefeed, and +extra lines are not allowed. Environment variables are interpreted in +@var{name} if given in @code{$@{VAR@}} notation. No escape characters +are defined; if the string @code{$@{} shall be used in file name, an +environment variable with that content may be used. The length of the +redirection file is limited to 511 bytes which is more than sufficient +for any known implementation of Unix domain sockets. +@end deftypefun + + @deftypefun int assuan_sock_get_nonce ( @ @w{struct sockaddr *@var{addr}}, @ @w{int @var{addrlen}}, @ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/doc/stamp-vti new/libassuan-2.2.0/doc/stamp-vti --- old/libassuan-2.1.3/doc/stamp-vti 2014-11-07 18:06:06.000000000 +0100 +++ new/libassuan-2.2.0/doc/stamp-vti 2014-12-11 13:12:28.000000000 +0100 @@ -1,4 +1,4 @@ -@set UPDATED 15 March 2013 -@set UPDATED-MONTH March 2013 -@set EDITION 2.1.3 -@set VERSION 2.1.3 +@set UPDATED 28 November 2014 +@set UPDATED-MONTH November 2014 +@set EDITION 2.2.0 +@set VERSION 2.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/doc/version.texi new/libassuan-2.2.0/doc/version.texi --- old/libassuan-2.1.3/doc/version.texi 2014-11-07 18:06:06.000000000 +0100 +++ new/libassuan-2.2.0/doc/version.texi 2014-12-11 13:12:28.000000000 +0100 @@ -1,4 +1,4 @@ -@set UPDATED 15 March 2013 -@set UPDATED-MONTH March 2013 -@set EDITION 2.1.3 -@set VERSION 2.1.3 +@set UPDATED 28 November 2014 +@set UPDATED-MONTH November 2014 +@set EDITION 2.2.0 +@set VERSION 2.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/src/assuan-defs.h new/libassuan-2.2.0/src/assuan-defs.h --- old/libassuan-2.1.3/src/assuan-defs.h 2014-04-16 09:23:24.000000000 +0200 +++ new/libassuan-2.2.0/src/assuan-defs.h 2014-11-28 15:59:45.000000000 +0100 @@ -346,6 +346,8 @@ struct sockaddr *addr, int addrlen); int _assuan_sock_bind (assuan_context_t ctx, assuan_fd_t sockfd, struct sockaddr *addr, int addrlen); +int _assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr, + int *r_redirected); int _assuan_sock_get_nonce (assuan_context_t ctx, struct sockaddr *addr, int addrlen, assuan_sock_nonce_t *nonce); int _assuan_sock_check_nonce (assuan_context_t ctx, assuan_fd_t fd, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/src/assuan-socket.c new/libassuan-2.2.0/src/assuan-socket.c --- old/libassuan-2.1.3/src/assuan-socket.c 2013-03-15 20:26:09.000000000 +0100 +++ new/libassuan-2.2.0/src/assuan-socket.c 2014-11-28 21:28:11.000000000 +0100 @@ -69,6 +69,15 @@ #endif #endif +#ifndef ENAMETOOLONG +# define ENAMETOOLONG EINVAL +#endif + +#ifndef SUN_LEN +# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + + strlen ((ptr)->sun_path)) +#endif + #ifdef HAVE_W32_SYSTEM @@ -88,7 +97,7 @@ return NULL; nbytes = (size_t)(n+1) * sizeof(*result); - if (nbytes / sizeof(*result) != (n+1)) + if (nbytes / sizeof(*result) != (n+1)) { SetLastError (ERROR_INVALID_PARAMETER); return NULL; @@ -173,15 +182,15 @@ /* W32: Fill BUFFER with LENGTH bytes of random. Returns -1 on failure, 0 on success. Sets errno on failure. */ static int -get_nonce (char *buffer, size_t nbytes) +get_nonce (char *buffer, size_t nbytes) { HCRYPTPROV prov; int ret = -1; - if (!CryptAcquireContext (&prov, NULL, NULL, PROV_RSA_FULL, + if (!CryptAcquireContext (&prov, NULL, NULL, PROV_RSA_FULL, (CRYPT_VERIFYCONTEXT|CRYPT_SILENT)) ) gpg_err_set_errno (ENODEV); - else + else { if (!CryptGenRandom (prov, nbytes, (unsigned char *) buffer)) gpg_err_set_errno (ENODEV); @@ -235,9 +244,121 @@ #endif /*HAVE_W32_SYSTEM*/ +#ifndef HAVE_W32_SYSTEM +/* Find a redirected socket name for fname and return a malloced setup + filled sockaddr. If this does not work out NULL is returned and + ERRNO is set. If the file seems to be a redirect True is stored at + R_REDIRECT. Note that this function uses the standard malloc and + not the assuan wrapped one. The format of the file is: + + %Assuan% + socket=NAME + + where NAME is the actual socket to use. No white spaces are + allowed, both lines must be terminated by a single LF, extra lines + are not allowed. Environment variables are interpreted in NAME if + given in "${VAR} notation; no escape characters are defined, if + "${" shall be used verbatim, you need to use an environment + variable with that content. + + The use of an absolute NAME is strongly suggested. The length of + the file is limited to 511 bytes which is more than sufficient for + that common value of 107 for sun_path. */ +static struct sockaddr_un * +eval_redirection (const char *fname, int *r_redirect) +{ + FILE *fp; + char buffer[512], *name; + size_t n; + struct sockaddr_un *addr; + char *p, *pend; + const char *s; + + *r_redirect = 0; + + fp = fopen (fname, "rb"); + if (!fp) + return NULL; + n = fread (buffer, 1, sizeof buffer - 1, fp); + fclose (fp); + if (!n) + { + gpg_err_set_errno (ENOENT); + return NULL; + } + buffer[n] = 0; + + /* Check that it is a redirection file. We also check that the + first byte of the name is not a LF because that would lead to an + zero length name. */ + if (n < 17 || buffer[n-1] != '\n' + || memcmp (buffer, "%Assuan%\nsocket=", 16) + || buffer[16] == '\n') + { + gpg_err_set_errno (EINVAL); + return NULL; + } + buffer[n-1] = 0; + name = buffer + 16; + + *r_redirect = 1; + + addr = calloc (1, sizeof *addr); + if (!addr) + return NULL; + addr->sun_family = AF_LOCAL; + + n = 0; + for (p=name; *p; p++) + { + if (*p == '$' && p[1] == '{') + { + p += 2; + pend = strchr (p, '}'); + if (!pend) + { + free (addr); + gpg_err_set_errno (EINVAL); + return NULL; + } + *pend = 0; + if (*p && (s = getenv (p))) + { + for (; *s; s++) + { + if (n < sizeof addr->sun_path - 1) + addr->sun_path[n++] = *s; + else + { + free (addr); + gpg_err_set_errno (ENAMETOOLONG); + return NULL; + } + } + } + p = pend; + } + else if (*p == '\n') + break; /* Be nice and stop at the first LF. */ + else if (n < sizeof addr->sun_path - 1) + addr->sun_path[n++] = *p; + else + { + free (addr); + gpg_err_set_errno (ENAMETOOLONG); + return NULL; + } + } + + return addr; +} +#endif /*!HAVE_W32_SYSTEM*/ + + + /* Return a new socket. Note that under W32 we consider a socket the same as an System Handle; all functions using such a handle know - about this dual use and act accordingly. */ + about this dual use and act accordingly. */ assuan_fd_t _assuan_sock_new (assuan_context_t ctx, int domain, int type, int proto) { @@ -265,21 +386,21 @@ unsigned short port; char nonce[16]; int ret; - + unaddr = (struct sockaddr_un *)addr; if (read_port_and_nonce (unaddr->sun_path, &port, nonce)) return -1; - + myaddr.sin_family = AF_INET; - myaddr.sin_port = htons (port); + myaddr.sin_port = htons (port); myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - + /* Set return values. */ unaddr->sun_family = myaddr.sin_family; unaddr->sun_port = myaddr.sin_port; unaddr->sun_addr.s_addr = myaddr.sin_addr.s_addr; - - ret = _assuan_connect (ctx, HANDLE2SOCKET(sockfd), + + ret = _assuan_connect (ctx, HANDLE2SOCKET(sockfd), (struct sockaddr *)&myaddr, sizeof myaddr); if (!ret) { @@ -298,8 +419,40 @@ int res; res = _assuan_connect (ctx, HANDLE2SOCKET (sockfd), addr, addrlen); return res; - } + } #else +# if HAVE_STAT + if (addr->sa_family == AF_LOCAL || addr->sa_family == AF_UNIX) + { + struct sockaddr_un *unaddr; + struct stat statbuf; + int redirect, res; + + unaddr = (struct sockaddr_un *)addr; + if (!stat (unaddr->sun_path, &statbuf) + && !S_ISSOCK (statbuf.st_mode) + && S_ISREG (statbuf.st_mode)) + { + /* The given socket file is not a socket but a regular file. + We use the content of that file to redirect to another + socket file. This can be used to use sockets on file + systems which do not support sockets or if for example a + home directory is shared by several machines. */ + unaddr = eval_redirection (unaddr->sun_path, &redirect); + if (unaddr) + { + res = _assuan_connect (ctx, sockfd, (struct sockaddr *)unaddr, + SUN_LEN (unaddr)); + free (unaddr); + return res; + } + if (redirect) + return -1; + /* Continue using the standard connect. */ + } + + } +# endif /*HAVE_STAT*/ return _assuan_connect (ctx, sockfd, addr, addrlen); #endif } @@ -330,7 +483,7 @@ myaddr.sin_family = AF_INET; myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - filehd = MyCreateFile (unaddr->sun_path, + filehd = MyCreateFile (unaddr->sun_path, GENERIC_WRITE, FILE_SHARE_READ, NULL, @@ -346,7 +499,7 @@ rc = bind (HANDLE2SOCKET (sockfd), (struct sockaddr *)&myaddr, len); if (!rc) - rc = getsockname (HANDLE2SOCKET (sockfd), + rc = getsockname (HANDLE2SOCKET (sockfd), (struct sockaddr *)&myaddr, &len); if (rc) { @@ -360,7 +513,7 @@ len = strlen (tmpbuf); memcpy (tmpbuf+len, nonce,16); len += 16; - + if (!WriteFile (filehd, tmpbuf, len, &nwritten, NULL)) { CloseHandle (filehd); @@ -384,6 +537,69 @@ } +/* Setup the ADDR structure for a Unix domain socket with the socket + name FNAME. If this is a redirected socket and R_REDIRECTED is not + NULL, it will be setup for the real socket. Returns 0 on success + and stores 1 at R_REDIRECTED if it is a redirected socket. On + error -1 is returned and ERRNO will be set. */ +int +_assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr, + int *r_redirected) +{ + struct sockaddr_un *unaddr = (struct sockaddr_un *)addr; +#if !defined(HAVE_W32_SYSTEM) && defined(HAVE_STAT) + struct stat statbuf; +#endif + + if (r_redirected) + *r_redirected = 0; + +#if !defined(HAVE_W32_SYSTEM) && defined(HAVE_STAT) + if (r_redirected + && !stat (fname, &statbuf) + && !S_ISSOCK (statbuf.st_mode) + && S_ISREG (statbuf.st_mode)) + { + /* The given socket file is not a socket but a regular file. We + use the content of that file to redirect to another socket + file. This can be used to use sockets on file systems which + do not support sockets or if for example a home directory is + shared by several machines. */ + struct sockaddr_un *unaddr_new; + int redirect; + + unaddr_new = eval_redirection (fname, &redirect); + if (unaddr_new) + { + memcpy (unaddr, unaddr_new, sizeof *unaddr); + free (unaddr_new); + *r_redirected = 1; + return 0; + } + if (redirect) + { + *r_redirected = 1; + return -1; /* Error. */ + } + /* Fallback to standard setup. */ + } +#endif /*!HAVE_W32_SYSTEM && HAVE_STAT*/ + + if (strlen (fname)+1 >= sizeof unaddr->sun_path) + { + gpg_err_set_errno (ENAMETOOLONG); + return -1; + } + + memset (unaddr, 0, sizeof *unaddr); + unaddr->sun_family = AF_LOCAL; + strncpy (unaddr->sun_path, fname, sizeof unaddr->sun_path - 1); + unaddr->sun_path[sizeof unaddr->sun_path - 1] = 0; + + return 0; +} + + int _assuan_sock_get_nonce (assuan_context_t ctx, struct sockaddr *addr, int addrlen, assuan_sock_nonce_t *nonce) @@ -416,8 +632,8 @@ #endif return 0; } - - + + int _assuan_sock_check_nonce (assuan_context_t ctx, assuan_fd_t fd, assuan_sock_nonce_t *nonce) @@ -498,7 +714,7 @@ return 0; err = assuan_new (&sock_ctx); - + #ifdef HAVE_W32_SYSTEM if (! err) WSAStartup (0x202, &wsadat); @@ -521,7 +737,7 @@ assuan_release (sock_ctx); sock_ctx = NULL; } - + int assuan_sock_close (assuan_fd_t fd) @@ -529,7 +745,7 @@ return _assuan_close (sock_ctx, fd); } -assuan_fd_t +assuan_fd_t assuan_sock_new (int domain, int type, int proto) { return _assuan_sock_new (sock_ctx, domain, type, proto); @@ -548,9 +764,16 @@ } int -assuan_sock_get_nonce (struct sockaddr *addr, int addrlen, +assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr, + int *r_redirected) +{ + return _assuan_sock_set_sockaddr_un (fname, addr, r_redirected); +} + +int +assuan_sock_get_nonce (struct sockaddr *addr, int addrlen, assuan_sock_nonce_t *nonce) -{ +{ return _assuan_sock_get_nonce (sock_ctx, addr, addrlen, nonce); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/src/assuan.h.in new/libassuan-2.2.0/src/assuan.h.in --- old/libassuan-2.1.3/src/assuan.h.in 2014-08-17 12:49:40.000000000 +0200 +++ new/libassuan-2.2.0/src/assuan.h.in 2014-11-28 15:59:24.000000000 +0100 @@ -470,6 +470,8 @@ 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); +int assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr, + int *r_redirected); int assuan_sock_get_nonce (struct sockaddr *addr, int addrlen, assuan_sock_nonce_t *nonce); int assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/src/libassuan.def new/libassuan-2.2.0/src/libassuan.def --- old/libassuan-2.1.3/src/libassuan.def 2013-03-15 20:26:09.000000000 +0100 +++ new/libassuan-2.2.0/src/libassuan.def 2014-11-28 15:33:59.000000000 +0100 @@ -111,6 +111,7 @@ __assuan_sendmsg @90 __assuan_waitpid @91 assuan_check_version @92 + assuan_sock_set_sockaddr_un @93 ; END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libassuan-2.1.3/src/libassuan.vers new/libassuan-2.2.0/src/libassuan.vers --- old/libassuan-2.1.3/src/libassuan.vers 2013-03-15 20:26:09.000000000 +0100 +++ new/libassuan-2.2.0/src/libassuan.vers 2014-11-28 15:33:30.000000000 +0100 @@ -101,6 +101,7 @@ assuan_free; assuan_socket_connect_fd; assuan_check_version; + assuan_sock_set_sockaddr_un; __assuan_close; __assuan_pipe;
participants (1)
-
root@hilbert.suse.de