Hello community,

here is the log from the commit of package nbd for openSUSE:Factory checked in 
at 2018-01-16 09:24:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nbd (Old)
 and      /work/SRC/openSUSE:Factory/.nbd.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nbd"

Tue Jan 16 09:24:21 2018 rev:45 rq:561881 version:3.16.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/nbd/nbd.changes  2017-11-30 12:36:59.468244119 
+0100
+++ /work/SRC/openSUSE:Factory/.nbd.new/nbd.changes     2018-01-16 
09:24:22.712204008 +0100
@@ -1,0 +2,11 @@
+Fri Jan  5 13:15:24 UTC 2018 - [email protected]
+
+- Update to version 1.16.2:
+  * Make the test suite less chatty
+  * Various build system improvements
+  * Fixes to the systemd unit to make it work again with recent
+    systemd
+  * Point to the nbd mailinglist, rather than to the maintainer's
+    personal email address, for bug reports.
+
+-------------------------------------------------------------------

Old:
----
  nbd-3.16.1.tar.xz

New:
----
  nbd-3.16.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nbd.spec ++++++
--- /var/tmp/diff_new_pack.mJYbTT/_old  2018-01-16 09:24:23.952145997 +0100
+++ /var/tmp/diff_new_pack.mJYbTT/_new  2018-01-16 09:24:23.960145623 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package nbd
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,17 +18,16 @@
 
 #Compat macro for new _fillupdir macro introduced in Nov 2017
 %if ! %{defined _fillupdir}
-  %define _fillupdir /var/adm/fillup-templates
+  %define _fillupdir %{_localstatedir}/adm/fillup-templates
 %endif
-
 Name:           nbd
-Version:        3.16.1
+Version:        3.16.2
 Release:        0
 Summary:        Network Block Device Server and Client Utilities
 License:        GPL-2.0+
 Group:          Productivity/Networking/Other
-Url:            http://nbd.sourceforge.net/
-Source0:        
http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.xz
+URL:            http://nbd.sourceforge.net/
+Source0:        
https://sourceforge.net/projects/nbd/files/nbd/%{version}/nbd-%{version}.tar.xz
 Source1:        %{name}-server.service
 Source3:        config.example
 Source4:        nbd-server.sysconfig
@@ -122,7 +121,6 @@
 %service_del_preun %{name}-server.service
 
 %files
-%defattr(-,root,root)
 %{_sbindir}/nbd-client
 %{_bindir}/nbd-server
 %{_bindir}/nbd-trdump

++++++ nbd-3.16.1.tar.xz -> nbd-3.16.2.tar.xz ++++++
++++ 2076 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/ChangeLog new/nbd-3.16.2/ChangeLog
--- old/nbd-3.16.1/ChangeLog    1970-01-01 01:00:00.000000000 +0100
+++ new/nbd-3.16.2/ChangeLog    2017-09-12 00:56:00.000000000 +0200
@@ -0,0 +1,119 @@
+commit e793db14c56cc31786d0c2d40e211c9c76336a98
+Author: Wouter Verhelst <[email protected]>
+Date:   Tue Sep 12 00:46:15 2017 +0200
+
+    Update list address to reflect the name that was actually assigned
+
+commit bc33392cbb989b20fdee11e4e7150ce3f31094df
+Author: Wouter Verhelst <[email protected]>
+Date:   Sat Sep 9 14:04:53 2017 +0200
+
+    Ignore the minimal (i.e., non-TLS-enabled) version of nbd-client
+
+commit 4dacee036571756891afe50a00aafe8d0553ee93
+Author: Wouter Verhelst <[email protected]>
+Date:   Sat Sep 9 14:01:25 2017 +0200
+
+    Don't forget to actually add the configure check
+    
+    Fixes: 866c2d5752901e8f47c86beb64fea05acf11a825
+
+commit 7d8b8869029356379c24780bab277117588e9fd3
+Author: Wouter Verhelst <[email protected]>
+Date:   Sat Sep 9 14:00:20 2017 +0200
+
+    Ensure that <sys/uio.h> is included when it's needed
+
+commit edbb5c36d7ef43322795d3cde7479901607f941c
+Author: Wouter Verhelst <[email protected]>
+Date:   Sat Sep 9 13:59:09 2017 +0200
+
+    Update bugreport address to point to mailinglist (at new address), rather 
than me
+
+commit 8b251d97e659a2509e7c666af17f01c021bb01d4
+Author: Wouter Verhelst <[email protected]>
+Date:   Sun Jul 16 12:06:31 2017 +0200
+
+    We can't do anything unless and until the network is up and running
+
+commit 74441dff9a5e151c5ea1abb1b4527414577238ef
+Author: Wouter Verhelst <[email protected]>
+Date:   Sun Jul 16 11:40:38 2017 +0200
+
+    Ensure we get shut down properly, too
+    
+    Now that we have DefaultDependencies=no, we don't have the default
+    Conflicts=shutdown.target anymore, which means we won't be stopped at
+    shutdown time.
+    
+    Add an explicit dependency for that.
+
+commit 2033647beec4d9e53d66abcd0a6a08876bb7ba41
+Author: Wouter Verhelst <[email protected]>
+Date:   Sun Jul 16 11:33:08 2017 +0200
+
+    Add dependencies for partitions, too
+    
+    If a device is partitioned, we need to have that depend on the device,
+    too.
+
+commit 4003dfec9b5aa097d5992be8ba09171f6f5948b6
+Author: Wouter Verhelst <[email protected]>
+Date:   Sun Jul 16 10:36:51 2017 +0200
+
+    Add DefaultDependencies=no to nbd@ systemd service
+    
+    This service is involved in early boot, so shouldn't have the default
+    dependencies...
+
+commit 3c399e802d21bd720a2d8b5ab3c0ea900df40e65
+Author: Wouter Verhelst <[email protected]>
+Date:   Sun Jul 16 10:35:07 2017 +0200
+
+    Remove contraction
+    
+    vim syntax highlighting gets confused about the extra apostrophe, so
+    rephrase this sentence so it isn't needed.
+
+commit 866c2d5752901e8f47c86beb64fea05acf11a825
+Author: Wouter Verhelst <[email protected]>
+Date:   Sun Jul 16 10:31:56 2017 +0200
+
+    Don't define _BSD_SOURCE unconditionally
+    
+    On older versions of glibc, _BSD_SOURCE was needed to get at the DT_*
+    macros. On glibc 2.19 and above, however, this is no longer needed; and
+    on FreeBSD it is actually detrimental since it removes a few symbols
+    which we do need.
+    
+    Add a configure.ac check for whether we need _BSD_SOURCE to be set in
+    order for the DT_* macros to be defined, and only set it in that case.
+
+commit ecad8c9034642992a80b4939ca7913e260ddc679
+Author: Wouter Verhelst <[email protected]>
+Date:   Tue Jun 20 23:12:57 2017 +0200
+
+    Destroy the diff file upon client disconnect
+    
+    When a client disconnects, we need to ensure that the diff file is gone.
+    Currently, we don't do that, because apparently we forgot.
+    
+    Fixes #52 on github.
+
+commit d5514c23c096a5cde1233ac4944f92f11620e6d6
+Author: Wouter Verhelst <[email protected]>
+Date:   Wed Jun 14 17:56:45 2017 +0200
+
+    Don't print anything on travis, at all...
+
+commit 8c887c565bec23530766dbc308a3d48418624067
+Author: Wouter Verhelst <[email protected]>
+Date:   Wed Jun 14 17:25:09 2017 +0200
+
+    Reduce output even further
+
+commit 0ffef9fafd25c95f0b25eee741ea264a486a6e64
+Author: Wouter Verhelst <[email protected]>
+Date:   Wed Jun 14 17:23:41 2017 +0200
+
+    Don't dist these symlinks
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/Makefile.am new/nbd-3.16.2/Makefile.am
--- old/nbd-3.16.1/Makefile.am  2017-05-26 20:25:57.000000000 +0200
+++ new/nbd-3.16.2/Makefile.am  2017-09-12 01:10:10.000000000 +0200
@@ -28,10 +28,10 @@
 if GNUTLS
 sbin_PROGRAMS += min-nbd-client
 min_nbd_client_SOURCES = $(client_srcs)
-min_nbd_client_CFLAGS = $(client_flags) -DNOTLS
+min_nbd_client_CFLAGS = $(client_flags) -DNOTLS -DPROG_NAME='"min-nbd-client"'
 min_nbd_client_LDADD = $(client_libs)
 nbd_client_SOURCES = $(client_srcs) crypto-gnutls.c crypto-gnutls.h buffer.c 
buffer.h
-nbd_client_CFLAGS = $(client_flags) @GnuTLS_CFLAGS@
+nbd_client_CFLAGS = $(client_flags) @GnuTLS_CFLAGS@ -DPROG_NAME='"nbd-client"'
 nbd_client_LDADD = $(client_libs) @GnuTLS_LIBS@
 else
 nbd_client_SOURCES = $(client_srcs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/config.h.in new/nbd-3.16.2/config.h.in
--- old/nbd-3.16.1/config.h.in  2017-05-28 10:03:21.000000000 +0200
+++ new/nbd-3.16.2/config.h.in  2017-09-12 01:15:51.000000000 +0200
@@ -142,6 +142,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
 /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
 #undef HAVE_SYS_WAIT_H
 
@@ -172,7 +175,10 @@
 /* Define to 1 if Large File Support should be enabled */
 #undef NBD_LFS
 
-/* Define if you don't want the nbd-server to fork() */
+/* Define to 1 if _BSD_SOURCE needs to be defined before certain inclusions */
+#undef NEED_BSD_SOURCE
+
+/* Define if you do not want the nbd-server to fork() */
 #undef NOFORK
 
 /* Name of package */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/configure.ac new/nbd-3.16.2/configure.ac
--- old/nbd-3.16.1/configure.ac 2017-05-26 20:25:57.000000000 +0200
+++ new/nbd-3.16.2/configure.ac 2017-09-12 00:40:36.000000000 +0200
@@ -3,7 +3,7 @@
 dnl (c) 2003-2006 Wouter Verhelst <[email protected]>
 AC_INIT([nbd],
   m4_esyscmd(support/genver.sh | tr -d '\n'),
-  [[email protected]],,
+  [[email protected]],,
   [http://nbd.sourceforge.net/])
 m4_define([serial_tests], [
   m4_esyscmd([automake --version |
@@ -78,7 +78,7 @@
     AC_MSG_ERROR([You requested both syslog logging and a debugging version of 
the server. Bad idea!])
   fi
   AC_DEFINE(DODBG,1,[Define if you want a debugging version of nbd-server 
(lots of copious output)])
-  AC_DEFINE(NOFORK,1,[Define if you don't want the nbd-server to fork()])
+  AC_DEFINE(NOFORK,1,[Define if you do not want the nbd-server to fork()])
 else
   AC_MSG_RESULT([no])
 fi
@@ -260,7 +260,7 @@
 AC_CHECK_HEADERS([sys/mount.h],,,
 [[#include <sys/param.h>
 ]])
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h 
sys/socket.h syslog.h linux/types.h sys/dirent.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/ioctl.h 
sys/socket.h syslog.h linux/types.h sys/dirent.h sys/uio.h])
 AM_PATH_GLIB_2_0(2.26.0, [HAVE_GLIB=yes], AC_MSG_ERROR([Missing glib]), 
gthread)
 
 my_save_cflags="$CFLAGS"
@@ -280,6 +280,16 @@
 )
 CFLAGS="$my_save_cflags"
 
+AC_MSG_CHECKING([whether _BSD_SOURCE needs to be defined for DT_* macros])
+AC_PREPROC_IFELSE(
+       [AC_LANG_PROGRAM([[#include <dirent.h>]],
+                        [[#ifndef DT_UNKNOWN
+#error nope
+#endif]])],
+       [AC_MSG_RESULT([no]); NEED_BSD_SOURCE=0],
+       [AC_MSG_RESULT([yes]); NEED_BSD_SOURCE=1])
+AC_DEFINE([NEED_BSD_SOURCE], $NEED_BSD_SOURCE, [Define to 1 if _BSD_SOURCE 
needs to be defined before certain inclusions])
+
 AC_HEADER_SYS_WAIT
 AC_TYPE_OFF_T
 AC_TYPE_PID_T
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/nbd-client.c new/nbd-3.16.2/nbd-client.c
--- old/nbd-3.16.1/nbd-client.c 2017-05-26 20:25:57.000000000 +0200
+++ new/nbd-3.16.2/nbd-client.c 2017-09-12 01:13:36.000000000 +0200
@@ -737,7 +737,7 @@
                vfprintf(stderr, tmp, ap);
                va_end(ap);
        } else {
-               fprintf(stderr, "nbd-client version %s\n", PACKAGE_VERSION);
+               fprintf(stderr, "%s version %s\n", PROG_NAME, PACKAGE_VERSION);
        }
        fprintf(stderr, "Usage: nbd-client -name|-N name host [port] 
nbd_device\n\t[-block-size|-b block size] [-timeout|-t timeout] [-swap|-s] 
[-sdp|-S]\n\t[-persist|-p] [-nofork|-n] [-systemd-mark|-m]\n");
        fprintf(stderr, "Or   : nbd-client -u (with same arguments as 
above)\n");
@@ -746,6 +746,7 @@
        fprintf(stderr, "Or   : nbd-client -c nbd_device\n");
        fprintf(stderr, "Or   : nbd-client -h|--help\n");
        fprintf(stderr, "Or   : nbd-client -l|--list host\n");
+       fprintf(stderr, "Or   : nbd-client -V|--version\n");
 #if HAVE_GNUTLS && !defined(NOTLS)
        fprintf(stderr, "All commands that connect to a host also 
take:\n\t[-F|-certfile certfile] [-K|-keyfile keyfile]\n\t[-A|-cacertfile 
cacertfile] [-H|-tlshostname hostname] [-x|-enable-tls]\n");
 #endif
@@ -754,6 +755,7 @@
        fprintf(stderr, "Note, that kernel 2.4.2 and older ones do not work 
correctly with\n");
        fprintf(stderr, "blocksizes other than 1024 without patches\n");
        fprintf(stderr, "Default value for port is 10809. Note that port must 
always be numeric\n");
+       fprintf(stderr, "Bug reports and general discussion should go to %s\n", 
PACKAGE_BUGREPORT);
 }
 
 void disconnect(char* device) {
@@ -819,6 +821,7 @@
                { "cacertfile", required_argument, NULL, 'A' },
                { "tlshostname", required_argument, NULL, 'H' },
                { "enable-tls", no_argument, NULL, 'x' },
+               { "version", no_argument, NULL, 'V' },
                { 0, 0, 0, 0 }, 
        };
        int i;
@@ -829,7 +832,7 @@
         tlssession_init();
 #endif
 
-       while((c=getopt_long_only(argc, argv, "-b:c:d:hlnN:pSst:uC:K:A:H:x", 
long_options, NULL))>=0) {
+       while((c=getopt_long_only(argc, argv, "-b:c:d:hlnN:pSst:uVC:K:A:H:x", 
long_options, NULL))>=0) {
                switch(c) {
                case 1:
                        // non-option argument
@@ -917,6 +920,9 @@
                case 'u':
                        b_unix = 1;
                        break;
+               case 'V':
+                       printf("This is %s, from %s\n", PROG_NAME, 
PACKAGE_STRING);
+                       return 0;
 #if HAVE_GNUTLS && !defined(NOTLS)
                case 'x':
                        tls = true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/nbd-server.c new/nbd-3.16.2/nbd-server.c
--- old/nbd-3.16.1/nbd-server.c 2017-05-26 20:25:57.000000000 +0200
+++ new/nbd-3.16.2/nbd-server.c 2017-09-12 01:04:53.000000000 +0200
@@ -60,7 +60,9 @@
 #include "lfs.h"
 #define _DEFAULT_SOURCE
 #define _XOPEN_SOURCE 500 /* to get pread/pwrite */
-#define _BSD_SOURCE /* to get DT_* macros */
+#if NEED_BSD_SOURCE
+#define _BSD_SOURCE /* to get DT_* macros on some platforms */
+#endif
 #define _DARWIN_C_SOURCE /* to get DT_* macros on OS X */
 
 #include <assert.h>
@@ -73,6 +75,9 @@
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
 #include <sys/param.h>
 #include <signal.h>
 #include <errno.h>
@@ -435,6 +440,9 @@
                close(client->transactionlogfd);
                client->transactionlogfd = -1;
        }
+       if(client->server->flags & F_COPYONWRITE) {
+               unlink(client->difffilename);
+       }
 }
 
 static inline void socket_closed_transmission(CLIENT* client) {
@@ -488,6 +496,7 @@
               "\t\taddress of the machine trying to connect\n" 
               "\tif ip is set, it contains the local IP address on which we're 
listening.\n\tif not, the server will listen on all local IP addresses\n");
        printf("Using configuration file %s\n", CFILE);
+       printf("For help, or when encountering bugs, please contact %s\n", 
PACKAGE_BUGREPORT);
 }
 
 /* Dumps a config file section of the given SERVER*, and exits. */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/systemd/[email protected] 
new/nbd-3.16.2/systemd/[email protected]
--- old/nbd-3.16.1/systemd/[email protected]  2017-04-14 16:42:06.000000000 
+0200
+++ new/nbd-3.16.2/systemd/[email protected]  2017-07-16 12:09:07.000000000 
+0200
@@ -10,9 +10,27 @@
 Documentation=man:nbd-client
 PartOf=nbd.service
 Before=dev-%i.device
+After=network-online.target
+Conflicts=shutdown.target
+DefaultDependencies=no
 [Service]
 Type=forking
 ExecStart=@sbindir@/nbd-client %i
 [Install]
 RequiredBy=dev-%i.device
+RequiredBy=dev-%ip1.device
+RequiredBy=dev-%ip2.device
+RequiredBy=dev-%ip3.device
+RequiredBy=dev-%ip4.device
+RequiredBy=dev-%ip5.device
+RequiredBy=dev-%ip6.device
+RequiredBy=dev-%ip7.device
+RequiredBy=dev-%ip8.device
+RequiredBy=dev-%ip9.device
+RequiredBy=dev-%ip10.device
+RequiredBy=dev-%ip11.device
+RequiredBy=dev-%ip12.device
+RequiredBy=dev-%ip13.device
+RequiredBy=dev-%ip14.device
+RequiredBy=dev-%ip15.device
 EOF
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/systemd/[email protected] 
new/nbd-3.16.2/systemd/[email protected]
--- old/nbd-3.16.1/systemd/[email protected]   2017-04-14 14:40:40.000000000 
+0200
+++ new/nbd-3.16.2/systemd/[email protected]   2017-07-16 12:07:23.000000000 
+0200
@@ -3,8 +3,26 @@
 Documentation=man:nbd-client
 PartOf=nbd.service
 Before=dev-%i.device
+After=network-online.target
+Conflicts=shutdown.target
+DefaultDependencies=no
 [Service]
 Type=forking
 ExecStart=@sbindir@/nbd-client %i
 [Install]
 RequiredBy=dev-%i.device
+RequiredBy=dev-%ip1.device
+RequiredBy=dev-%ip2.device
+RequiredBy=dev-%ip3.device
+RequiredBy=dev-%ip4.device
+RequiredBy=dev-%ip5.device
+RequiredBy=dev-%ip6.device
+RequiredBy=dev-%ip7.device
+RequiredBy=dev-%ip8.device
+RequiredBy=dev-%ip9.device
+RequiredBy=dev-%ip10.device
+RequiredBy=dev-%ip11.device
+RequiredBy=dev-%ip12.device
+RequiredBy=dev-%ip13.device
+RequiredBy=dev-%ip14.device
+RequiredBy=dev-%ip15.device
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/tests/run/Makefile.am new/nbd-3.16.2/tests/run/Makefile.am
--- old/nbd-3.16.1/tests/run/Makefile.am        2017-05-04 16:24:06.000000000 
+0200
+++ new/nbd-3.16.2/tests/run/Makefile.am        2017-07-16 12:07:23.000000000 
+0200
@@ -19,12 +19,13 @@
 crypto-gnutls.c:
        rm -f crypto-gnutls.c
        ln -s $(top_srcdir)/crypto-gnutls.c crypto-gnutls.c
-nbd_tester_client_SOURCES = nbd-tester-client.c cliserv.c
+nbd_tester_client_SOURCES = nbd-tester-client.c
+nodist_nbd_tester_client_SOURCES = cliserv.c
 nbd_tester_client_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
 nbd_tester_client_CPPFLAGS = -I$(top_srcdir)
 nbd_tester_client_LDADD = @GLIB_LIBS@
 if GNUTLS
-nbd_tester_client_SOURCES += buffer.c crypto-gnutls.c
+nodist_nbd_tester_client_SOURCES += buffer.c crypto-gnutls.c
 nbd_tester_client_CFLAGS += @GnuTLS_CFLAGS@
 nbd_tester_client_LDADD += @GnuTLS_LIBS@
 endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/tests/run/buffer.c new/nbd-3.16.2/tests/run/buffer.c
--- old/nbd-3.16.1/tests/run/buffer.c   2017-03-21 14:01:25.000000000 +0100
+++ new/nbd-3.16.2/tests/run/buffer.c   1970-01-01 01:00:00.000000000 +0100
@@ -1,225 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Copyright (c) 2016 Wrymouth Innovation Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#include <sys/types.h>
-
-#include "buffer.h"
-
-typedef struct buffer
-{
-  char *buf;
-  ssize_t size;
-  ssize_t hwm;
-  ssize_t ridx;
-  ssize_t widx;
-  int empty;
-} buffer_t;
-
-/* the buffer is organised internally as follows:
- *
- * * There are b->size bytes in the buffer.
- *
- * * Bytes are at offsets 0 to b->size-1
- * 
- * * b->ridx points to the first readable byte
- *
- * * b->widx points to the first empty space
- *
- * * b->ridx < b->widx indicates a non-wrapped buffer:
- *
- *     0       ridx     widx            size
- *     |       |        |               |
- *     V       V        V               V
- *     ........XXXXXXXXX................
- *
- * * b->ridx > b->widx indicates a wrapped buffer:
- *
- *     0       widx     ridx            size
- *     |       |        |               |
- *     V       V        V               V
- *     XXXXXXXX.........XXXXXXXXXXXXXXXX
- *
- * * b->ridx == b->widx indicates a FULL buffer:
- *
- * * b->ridx == b->widx indicates a wrapped buffer:
- *
- *     0       widx == ridx            size
- *     |       |                       |
- *     V       V                       V
- *     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- *
- * An empty buffer is indicated by empty=1
- *
- */
-
-buffer_t *
-bufNew (ssize_t size, ssize_t hwm)
-{
-  buffer_t *b = calloc (1, sizeof (buffer_t));
-  b->buf = calloc (1, size);
-  b->size = size;
-  b->hwm = hwm;
-  b->empty = 1;
-  return b;
-}
-
-
-void
-bufFree (buffer_t * b)
-{
-  free (b->buf);
-  free (b);
-}
-
-/* get a maximal span to read. Returns 0 if buffer
- * is empty
- */
-ssize_t
-bufGetReadSpan (buffer_t * b, void **addr)
-{
-  if (b->empty)
-    {
-      *addr = NULL;
-      return 0;
-    }
-  *addr = &(b->buf[b->ridx]);
-  ssize_t len = b->widx - b->ridx;
-  if (len <= 0)
-    len = b->size - b->ridx;
-  return len;
-}
-
-/* get a maximal span to write. Returns 0 id buffer is full
- */
-ssize_t
-bufGetWriteSpan (buffer_t * b, void **addr)
-{
-  if (b->empty)
-    {
-      *addr = b->buf;
-      b->ridx = 0;
-      b->widx = 0;
-      return b->size;
-    }
-  if (b->ridx == b->widx)
-    {
-      *addr = NULL;
-      return 0;
-    }
-  *addr = &(b->buf[b->widx]);
-  ssize_t len = b->ridx - b->widx;
-  if (len <= 0)
-    len = b->size - b->widx;
-  return len;
-}
-
-/* mark size bytes as read */
-void
-bufDoneRead (buffer_t * b, ssize_t size)
-{
-  while (!b->empty && (size > 0))
-    {
-      /* empty can't occur here, so equal pointers means full */
-      ssize_t len = b->widx - b->ridx;
-      if (len <= 0)
-       len = b->size - b->ridx;
-
-      /* len is the number of bytes in one read span */
-      if (len > size)
-       len = size;
-
-      b->ridx += len;
-      if (b->ridx >= b->size)
-       b->ridx = 0;
-
-      if (b->ridx == b->widx)
-       {
-         b->ridx = 0;
-         b->widx = 0;
-         b->empty = 1;
-       }
-
-      size -= len;
-    }
-}
-
-/* mark size bytes as written */
-void
-bufDoneWrite (buffer_t * b, ssize_t size)
-{
-  while ((b->empty || (b->ridx != b->widx)) && (size > 0))
-    {
-      /* full can't occur here, so equal pointers means empty */
-      ssize_t len = b->ridx - b->widx;
-      if (len <= 0)
-       len = b->size - b->widx;
-
-      /* len is the number of bytes in one write span */
-      if (len > size)
-       len = size;
-
-      b->widx += len;
-      if (b->widx >= b->size)
-       b->widx = 0;
-
-      /* it can't be empty as we've written at least one byte */
-      b->empty = 0;
-
-      size -= len;
-    }
-}
-
-int
-bufIsEmpty (buffer_t * b)
-{
-  return b->empty;
-}
-
-int
-bufIsFull (buffer_t * b)
-{
-  return !b->empty && (b->ridx == b->widx);
-}
-
-int
-bufIsOverHWM (buffer_t * b)
-{
-  return bufGetCount (b) > b->hwm;
-}
-
-ssize_t
-bufGetFree (buffer_t * b)
-{
-  return b->size - bufGetCount (b);
-}
-
-ssize_t
-bufGetCount (buffer_t * b)
-{
-  if (b->empty)
-    return 0;
-  return b->widx - b->ridx + ((b->ridx < b->widx) ? 0 : b->size);
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/tests/run/cliserv.c new/nbd-3.16.2/tests/run/cliserv.c
--- old/nbd-3.16.1/tests/run/cliserv.c  2017-05-26 20:25:57.000000000 +0200
+++ new/nbd-3.16.2/tests/run/cliserv.c  1970-01-01 01:00:00.000000000 +0100
@@ -1,158 +0,0 @@
-#include <config.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <cliserv.h>
-#include <nbd-debug.h>
-
-const u64 cliserv_magic = 0x00420281861253LL;
-const u64 opts_magic = 0x49484156454F5054LL;
-const u64 rep_magic = 0x3e889045565a9LL;
-
-/**
- * Set a socket to blocking or non-blocking
- *
- * @param fd The socket's FD
- * @param nb non-zero to set to non-blocking, else 0 to set to blocking
- * @return 0 - OK, -1 failed
- */
-int set_nonblocking(int fd, int nb) {
-       int sf = fcntl (fd, F_GETFL, 0);
-       if (sf == -1)
-               return -1;
-       return fcntl (fd, F_SETFL, nb ? (sf | O_NONBLOCK) : (sf & ~O_NONBLOCK));
-}
-
-
-void setmysockopt(int sock) {
-       int size = 1;
-#if 0
-       if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &size, sizeof(int)) < 0)
-                INFO("(no sockopt/1: %m)");
-#endif
-#ifdef IPPROTO_TCP
-       size = 1;
-       if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &size, sizeof(int)) < 0)
-                INFO("(no sockopt/2: %m)");
-#endif
-#if 0
-       size = 1024;
-       if (setsockopt(sock, IPPROTO_TCP, TCP_MAXSEG, &size, sizeof(int)) < 0)
-                INFO("(no sockopt/3: %m)");
-#endif
-}
-
-void err_nonfatal(const char *s) {
-       char s1[150], *s2;
-
-       strncpy(s1, s, sizeof(s1));
-       if ((s2 = strstr(s, "%m"))) {
-               strncpy(s1 + (s2 - s), strerror(errno), sizeof(s1) - (s2 - s));
-               s2 += 2;
-               strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1));
-       }
-#ifndef        sun
-       /* Solaris doesn't have %h in syslog */
-       else if ((s2 = strstr(s, "%h"))) {
-               strncpy(s1 + (s2 - s), hstrerror(h_errno), sizeof(s1) - (s2 - 
s));
-               s2 += 2;
-               strncpy(s1 + strlen(s1), s2, sizeof(s1) - strlen(s1));
-       }
-#endif
-
-       s1[sizeof(s1)-1] = '\0';
-#ifdef ISSERVER
-       syslog(LOG_ERR, "%s", s1);
-       syslog(LOG_ERR, "Exiting.");
-#endif
-       fprintf(stderr, "Error: %s\n", s1);
-}
-
-void err(const char *s) {
-       err_nonfatal(s);
-       fprintf(stderr, "Exiting.\n");
-       exit(EXIT_FAILURE);
-}
-
-void logging(const char* name) {
-#ifdef ISSERVER
-       openlog(name, LOG_PID, LOG_DAEMON);
-#endif
-       setvbuf(stdout, NULL, _IONBF, 0);
-       setvbuf(stderr, NULL, _IONBF, 0);
-}
-
-#ifndef ntohll
-#ifdef WORDS_BIGENDIAN
-uint64_t ntohll(uint64_t a) {
-       return a;
-}
-#else
-uint64_t ntohll(uint64_t a) {
-       u32 lo = a & 0xffffffff;
-       u32 hi = a >> 32U;
-       lo = ntohl(lo);
-       hi = ntohl(hi);
-       return ((uint64_t) lo) << 32U | hi;
-}
-#endif
-#endif
-
-/**
- * Read data from a file descriptor into a buffer
- *
- * @param f a file descriptor
- * @param buf a buffer
- * @param len the number of bytes to be read
- * @return 0 on completion, or -1 on failure
- **/
-int readit(int f, void *buf, size_t len) {
-       ssize_t res;
-       while (len > 0) {
-               DEBUG("*");
-               res = read(f, buf, len);
-               if (res > 0) {
-                       len -= res;
-                       buf += res;
-               } else if (res < 0) {
-                       if(errno != EAGAIN) {
-                               err_nonfatal("Read failed: %m");
-                               return -1;
-                       }
-               } else {
-                       return -1;
-               }
-       }
-       return 0;
-}
-
-/**
- * Write data from a buffer into a filedescriptor
- *
- * @param f a file descriptor
- * @param buf a buffer containing data
- * @param len the number of bytes to be written
- * @return 0 on success, or -1 if the socket was closed
- **/
-int writeit(int f, void *buf, size_t len) {
-       ssize_t res;
-       while (len > 0) {
-               DEBUG("+");
-               if ((res = write(f, buf, len)) <= 0) {
-                       switch(errno) {
-                               case EAGAIN:
-                                       break;
-                               default:
-                                       err_nonfatal("Send failed: %m");
-                                       return -1;
-                       }
-               }
-               len -= res;
-               buf += res;
-       }
-       return 0;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/tests/run/crypto-gnutls.c 
new/nbd-3.16.2/tests/run/crypto-gnutls.c
--- old/nbd-3.16.1/tests/run/crypto-gnutls.c    2017-03-21 14:01:32.000000000 
+0100
+++ new/nbd-3.16.2/tests/run/crypto-gnutls.c    1970-01-01 01:00:00.000000000 
+0100
@@ -1,627 +0,0 @@
-/*
-
-The MIT License (MIT)
-
-Copyright (c) 2016 Wrymouth Innovation Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#define _GNU_SOURCE
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <gnutls/gnutls.h>
-#include <gnutls/crypto.h>
-#include <gnutls/x509.h>
-#include <gnutls/abstract.h>
-
-#include "crypto-gnutls.h"
-#include "buffer.h"
-
-#define MAX_CERTS 10
-
-#define FALSE 0
-#define TRUE 1
-
-#define PRIORITY "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2"
-
-typedef struct tlssession
-{
-  gnutls_certificate_credentials_t creds;
-  gnutls_session_t session;
-  char *hostname;
-  int (*quitfn) (void *opaque);
-  int (*erroutfn) (void *opaque, const char *format, va_list ap);
-  int debug;
-  void *opaque;
-} tlssession_t;
-
-#define BUF_SIZE 65536
-#define BUF_HWM ((BUF_SIZE*3)/4)
-
-static int
-falsequit (void *opaque)
-{
-  return FALSE;
-}
-
-static int
-quit (tlssession_t * s)
-{
-  return s->quitfn (s->opaque);
-}
-
-
-static int
-stderrout (void *opaque, const char *format, va_list ap)
-{
-  return vfprintf (stderr, format, ap);
-}
-
-static int
-errout (tlssession_t * s, const char *format, ...)
-{
-  va_list ap;
-  int ret;
-  va_start (ap, format);
-  ret = s->erroutfn (s->opaque, format, ap);
-  va_end (ap);
-  return ret;
-}
-
-static int
-debugout (tlssession_t * s, const char *format, ...)
-{
-  va_list ap;
-  int ret = 0;
-  va_start (ap, format);
-  if (s->debug)
-    ret = s->erroutfn (s->opaque, format, ap);
-  va_end (ap);
-  return ret;
-}
-
-static int
-socksetnonblock (int fd, int nb)
-{
-  int sf = fcntl (fd, F_GETFL, 0);
-  if (sf == -1)
-    return -1;
-  return fcntl (fd, F_SETFL, nb ? (sf | O_NONBLOCK) : (sf & ~O_NONBLOCK));
-}
-
-/* From (public domain) example file in GNUTLS
- *
- * This function will try to verify the peer's certificate, and
- * also check if the hostname matches, and the activation, expiration dates.
- */
-static int
-verify_certificate_callback (gnutls_session_t session)
-{
-  unsigned int status;
-  const gnutls_datum_t *cert_list;
-  unsigned int cert_list_size;
-  int ret;
-  gnutls_x509_crt_t cert;
-  tlssession_t *s;
-
-  /* read session pointer */
-  s = (tlssession_t *) gnutls_session_get_ptr (session);
-
-  /* This verification function uses the trusted CAs in the credentials
-   * structure. So you must have installed one or more CA certificates.
-   */
-  ret = gnutls_certificate_verify_peers2 (session, &status);
-  if (ret < 0)
-    {
-      debugout (s, "Could not verfify peer certificate due to an error\n");
-      return GNUTLS_E_CERTIFICATE_ERROR;
-    }
-
-  if (status & GNUTLS_CERT_INVALID)
-    debugout (s, "The certificate is not trusted.\n");
-
-  if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
-    debugout (s, "The certificate hasn't got a known issuer.\n");
-
-  if (status & GNUTLS_CERT_REVOKED)
-    debugout (s, "The certificate has been revoked.\n");
-
-  if (status & GNUTLS_CERT_EXPIRED)
-    debugout (s, "The certificate has expired\n");
-
-  if (status & GNUTLS_CERT_NOT_ACTIVATED)
-    debugout (s, "The certificate is not yet activated\n");
-
-  if (status)
-    return GNUTLS_E_CERTIFICATE_ERROR;
-
-  if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509)
-    return GNUTLS_E_CERTIFICATE_ERROR;
-
-  if (gnutls_x509_crt_init (&cert) < 0)
-    {
-      debugout (s, "error in initialization\n");
-      return GNUTLS_E_CERTIFICATE_ERROR;
-    }
-
-  cert_list = gnutls_certificate_get_peers (session, &cert_list_size);
-  if (cert_list == NULL)
-    {
-      debugout (s, "No certificate was found!\n");
-      return GNUTLS_E_CERTIFICATE_ERROR;
-    }
-
-  /* check only the first certificate - seems to be what curl does */
-  if (gnutls_x509_crt_import (cert, &cert_list[0], GNUTLS_X509_FMT_DER) < 0)
-    {
-      debugout (s, "error parsing certificate\n");
-      return GNUTLS_E_CERTIFICATE_ERROR;
-    }
-
-  if (s->hostname && *s->hostname)
-    {
-      if (!gnutls_x509_crt_check_hostname (cert, s->hostname))
-       {
-         debugout (s,
-                   "The certificate's owner does not match hostname '%s'\n",
-                   s->hostname);
-         return GNUTLS_E_CERTIFICATE_ERROR;
-       }
-    }
-
-  gnutls_x509_crt_deinit (cert);
-
-  debugout (s, "Peer passed certificate verification\n");
-
-  /* notify gnutls to continue handshake normally */
-  return 0;
-}
-
-tlssession_t *
-tlssession_new (int isserver,
-               char *keyfile, char *certfile, char *cacertfile,
-               char *hostname, int insecure, int debug,
-               int (*quitfn) (void *opaque),
-               int (*erroutfn) (void *opaque, const char *format,
-                                va_list ap), void *opaque)
-{
-  int ret;
-  tlssession_t *s = calloc (1, sizeof (tlssession_t));
-
-  if (quitfn)
-    s->quitfn = quitfn;
-  else
-    s->quitfn = falsequit;
-
-  if (erroutfn)
-    s->erroutfn = erroutfn;
-  else
-    s->erroutfn = stderrout;
-
-  if (hostname)
-    s->hostname = strdup (hostname);
-
-  s->debug = debug;
-
-  if (gnutls_certificate_allocate_credentials (&s->creds) < 0)
-    {
-      errout (s, "Certificate allocation memory error\n");
-      goto error;
-    }
-
-  if (cacertfile != NULL)
-    {
-      ret =
-       gnutls_certificate_set_x509_trust_file (s->creds, cacertfile,
-                                               GNUTLS_X509_FMT_PEM);
-      if (ret < 0)
-       {
-         errout (s, "Error setting the x509 trust file: %s\n",
-                 gnutls_strerror (ret));
-         goto error;
-       }
-
-      if (!insecure)
-       {
-         gnutls_certificate_set_verify_function (s->creds,
-                                                 verify_certificate_callback);
-         gnutls_certificate_set_verify_flags (s->creds,
-                                              
GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);
-       }
-    }
-
-  if (keyfile && !certfile)
-    certfile = keyfile;
-
-  if (certfile != NULL && keyfile != NULL)
-    {
-      ret =
-       gnutls_certificate_set_x509_key_file (s->creds, certfile, keyfile,
-                                             GNUTLS_X509_FMT_PEM);
-
-      if (ret < 0)
-       {
-         errout (s,
-                 "Error loading certificate or key file (%s, %s): %s\n",
-                 certfile, keyfile, gnutls_strerror (ret));
-         goto error;
-       }
-    }
-
-  if (isserver)
-    {
-      ret = gnutls_init (&s->session, GNUTLS_SERVER);
-    }
-  else
-    {
-      ret = gnutls_init (&s->session, GNUTLS_CLIENT);
-    }
-  if (ret < 0)
-    {
-      errout (s, "Cannot initialize GNUTLS session: %s\n",
-             gnutls_strerror (ret));
-      goto error;
-    }
-
-  gnutls_session_set_ptr (s->session, (void *) s);
-
-  ret = gnutls_set_default_priority (s->session);
-  if (ret < 0)
-    {
-      errout (s, "Cannot set default GNUTLS session priority: %s\n",
-             gnutls_strerror (ret));
-      goto error;
-    }
-
-  const char *errpos = NULL;
-  ret = gnutls_priority_set_direct (s->session, PRIORITY, &errpos);
-  if (ret < 0)
-    {
-      errout (s, "Cannot set GNUTLS session priority: %s\n",
-             gnutls_strerror (ret));
-      goto error;
-    }
-
-  gnutls_session_set_ptr (s->session, (void *) s);
-
-  ret = gnutls_credentials_set (s->session, GNUTLS_CRD_CERTIFICATE, s->creds);
-  if (ret < 0)
-    {
-      errout (s, "Cannot set session GNUTL credentials: %s\n",
-             gnutls_strerror (ret));
-      goto error;
-    }
-
-  if (isserver)
-    {
-      /* requests but does not check a client certificate */
-      gnutls_certificate_server_set_request (s->session, GNUTLS_CERT_REQUEST);
-    }
-
-
-  return s;
-
-error:
-  if (s->session)
-    gnutls_deinit (s->session);
-  free (s);
-  return NULL;
-}
-
-void
-tlssession_close (tlssession_t * s)
-{
-  if (s->session)
-    gnutls_deinit (s->session);
-  free (s->hostname);
-  free (s);
-}
-
-int
-tlssession_init ()
-{
-  return gnutls_global_init ();
-}
-
-
-int
-tlssession_mainloop (int cryptfd, int plainfd, tlssession_t * s)
-{
-  fd_set readfds;
-  fd_set writefds;
-  int maxfd;
-  int tls_wr_interrupted = 0;
-  int plainEOF = FALSE;
-  int cryptEOF = FALSE;
-  int ret;
-
-  buffer_t *plainToCrypt = bufNew (BUF_SIZE, BUF_HWM);
-  buffer_t *cryptToPlain = bufNew (BUF_SIZE, BUF_HWM);
-
-  if (socksetnonblock (cryptfd, 0) < 0)
-    {
-      errout (s, "Could not turn on blocking: %m");
-      goto error;
-    }
-
-  /* set it up to work with our FD */
-  gnutls_transport_set_ptr (s->session,
-                           (gnutls_transport_ptr_t) (intptr_t) cryptfd);
-
-
-  /* Now do the handshake */
-  ret = gnutls_handshake (s->session);
-  if (ret < 0)
-    {
-      errout (s, "TLS handshake failed: %s\n", gnutls_strerror (ret));
-      goto error;
-    }
-
-  if (socksetnonblock (cryptfd, 1) < 0)
-    {
-      errout (s, "Could not turn on non-blocking on crypt FD: %m");
-      goto error;
-    }
-
-  if (socksetnonblock (plainfd, 1) < 0)
-    {
-      errout (s, "Could not turn on non-blocking on plain FD: %m");
-      goto error;
-    }
-
-  maxfd = (plainfd > cryptfd) ? plainfd + 1 : cryptfd + 1;
-
-  while ((!plainEOF || !cryptEOF) && !quit (s))
-    {
-      struct timeval timeout;
-      int result;
-      int selecterrno;
-      int wait = TRUE;
-
-      FD_ZERO (&readfds);
-      FD_ZERO (&writefds);
-
-      size_t buffered = gnutls_record_check_pending (s->session);
-      if (buffered)
-       wait = FALSE;           /* do not wait for select to return if we have 
buffered data */
-
-      if (plainEOF)
-       {
-         /* plain text end has closed, but me may still have
-          * data yet to write to the crypt end */
-         if (bufIsEmpty (plainToCrypt) && !tls_wr_interrupted)
-           {
-             cryptEOF = TRUE;
-             break;
-           }
-       }
-      else
-       {
-         if (!bufIsEmpty (cryptToPlain))
-           FD_SET (plainfd, &writefds);
-         if (!bufIsOverHWM (plainToCrypt))
-           FD_SET (plainfd, &readfds);
-       }
-
-      if (cryptEOF)
-       {
-         /* crypt end has closed, but me way still have data to
-          * write from the crypt buffer */
-         if (bufIsEmpty (cryptToPlain) && !buffered)
-           {
-             plainEOF = TRUE;
-             break;
-           }
-       }
-      else
-       {
-         if (!bufIsEmpty (plainToCrypt) || tls_wr_interrupted)
-           FD_SET (cryptfd, &writefds);
-         if (!bufIsOverHWM (cryptToPlain))
-           FD_SET (cryptfd, &readfds);
-       }
-
-      /* Repeat select whilst EINTR happens */
-      do
-       {
-         timeout.tv_sec = wait ? 1 : 0;
-         timeout.tv_usec = 0;
-         result = select (maxfd, &readfds, &writefds, NULL, &timeout);
-
-         selecterrno = errno;
-       }
-      while ((result == -1) && (selecterrno == EINTR) && !quit (s));
-      if (quit (s))
-       break;
-
-      if (FD_ISSET (plainfd, &readfds))
-       {
-         /* we can read at least one byte */
-         void *addr = NULL;
-         /* get a span of characters to write to the
-          * buffer. As the empty portion may wrap the end of the
-          * circular buffer this might not be all we could read.
-          */
-         ssize_t len = bufGetWriteSpan (plainToCrypt, &addr);
-         if (len > 0)
-           {
-             ssize_t ret;
-             do
-               {
-                 ret = read (plainfd, addr, (size_t) len);
-               }
-             while ((ret < 0) && (errno == EINTR) && !quit (s));
-             if (quit (s))
-               break;
-             if (ret < 0)
-               {
-                 errout (s, "Error on read from plain socket: %m\n");
-                 goto error;
-               }
-             if (ret == 0)
-               {
-                 plainEOF = TRUE;
-               }
-             else
-               {
-                 bufDoneWrite (plainToCrypt, ret);     /* mark ret bytes as 
written to the buffer */
-               }
-           }
-       }
-
-      if (FD_ISSET (plainfd, &writefds))
-       {
-         /* we can write at least one byte */
-         void *addr = NULL;
-         /* get a span of characters to read from the buffer
-          * as the full portion may wrap the end of the circular buffer
-          * this might not be all we have to write.
-          */
-         ssize_t len = bufGetReadSpan (cryptToPlain, &addr);
-         if (len > 0)
-           {
-             ssize_t ret;
-             do
-               {
-                 ret = write (plainfd, addr, (size_t) len);
-               }
-             while ((ret < 0) && (errno == EINTR) && !quit (s));
-             if (quit (s))
-               break;
-             if (ret < 0)
-               {
-                 errout (s, "Error on write to plain socket: %m\n");
-                 goto error;
-               }
-             bufDoneRead (cryptToPlain, ret);  /* mark ret bytes as read from 
the buffer */
-           }
-       }
-
-      if (FD_ISSET (cryptfd, &readfds) || buffered)
-       {
-         /* we can read at least one byte */
-         void *addr = NULL;
-         /* get a span of characters to write to the
-          * buffer. As the empty portion may wrap the end of the
-          * circular buffer this might not be all we could read.
-          */
-         ssize_t len = bufGetWriteSpan (cryptToPlain, &addr);
-         if (len > 0)
-           {
-             ssize_t ret;
-             do
-               {
-                 ret = gnutls_record_recv (s->session, addr, (size_t) len);
-               }
-             while (ret == GNUTLS_E_INTERRUPTED && !quit (s));
-             /* do not loop on GNUTLS_E_AGAIN - this means we'd block so we'd 
loop for
-              * ever
-              */
-             if (quit (s))
-               break;
-             if (ret < 0 && ret != GNUTLS_E_AGAIN)
-               {
-                 errout (s, "Error on read from crypt socket: %s\n",
-                         gnutls_strerror (ret));
-                 goto error;
-               }
-             if (ret == 0)
-               {
-                 cryptEOF = TRUE;
-               }
-             else
-               {
-                 bufDoneWrite (cryptToPlain, ret);     /* mark ret bytes as 
written to the buffer */
-               }
-           }
-       }
-
-      if (FD_ISSET (cryptfd, &writefds))
-       {
-         /* we can write at least one byte */
-         void *addr = NULL;
-         /* get a span of characters to read from the buffer
-          * as the full portion may wrap the end of the circular buffer
-          * this might not be all we have to write.
-          */
-         ssize_t len = bufGetReadSpan (plainToCrypt, &addr);
-         if (len > 0)
-           {
-             ssize_t ret;
-             do
-               {
-                 if (tls_wr_interrupted)
-                   {
-                     ret = gnutls_record_send (s->session, NULL, 0);
-                   }
-                 else
-                   {
-                     ret = gnutls_record_send (s->session, addr, len);
-                   }
-               }
-             while (ret == GNUTLS_E_INTERRUPTED && !quit (s));
-             if (quit (s))
-               break;
-             if (ret == GNUTLS_E_AGAIN)
-               {
-                 /* we need to call this again with NULL parameters
-                  * as it blocked
-                  */
-                 tls_wr_interrupted = TRUE;
-               }
-             else if (ret < 0)
-               {
-                 errout (s, "Error on write to crypto socket: %s\n",
-                         gnutls_strerror (ret));
-                 goto error;
-               }
-             else
-               {
-                 bufDoneRead (plainToCrypt, ret);      /* mark ret bytes as 
read from the buffer */
-               }
-           }
-       }
-    }
-
-  ret = 0;
-  goto freereturn;
-
-error:
-  ret = -1;
-
-freereturn:
-  gnutls_bye (s->session, GNUTLS_SHUT_RDWR);
-  shutdown (plainfd, SHUT_RDWR);
-  bufFree (plainToCrypt);
-  bufFree (cryptToPlain);
-  return ret;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/nbd-3.16.1/tests/run/nbd-tester-client.c 
new/nbd-3.16.2/tests/run/nbd-tester-client.c
--- old/nbd-3.16.1/tests/run/nbd-tester-client.c        2017-05-26 
20:25:57.000000000 +0200
+++ new/nbd-3.16.2/tests/run/nbd-tester-client.c        2017-07-16 
12:07:23.000000000 +0200
@@ -914,6 +914,7 @@
        int serverflags = 0;
        signed int do_write = TRUE;
        pid_t mypid = getpid();
+       char *print = getenv("NBD_TEST_SILENT");
 
        if (!(testflags & TEST_WRITE))
                testflags &= ~TEST_FLUSH;
@@ -946,7 +947,6 @@
                         strerror(errno));
                goto err_open;
        }
-       int printer = 0;
        for (i = 0; i + 1024 <= size; i += 1024) {
                if (do_write) {
                        int sendfua = (testflags & TEST_FLUSH)
@@ -1032,7 +1032,7 @@
                        retval = -1;
                        goto err_open;
                }
-               if (!(printer++ % 10)) {
+               if(print == NULL) {
                        printf("%d: Requests: %d  \r", (int)mypid, requests);
                }
        }
@@ -1051,7 +1051,7 @@
                                                 1024, i);
                        --requests;
                }
-               if (!(printer++ % 10)) {
+               if(print == NULL) {
                        printf("%d: Requests: %d  \r", (int)mypid, requests);
                }
        } while (requests);
@@ -1184,6 +1184,7 @@
        uint64_t seq = 1;
        uint64_t processed = 0;
        uint64_t printer = 0;
+       char *do_print = getenv("NBD_TEST_SILENT");
        uint64_t xfer = 0;
        int readtransactionfile = 1;
        int blocked = 0;
@@ -1628,7 +1629,7 @@
                        free(prc);
                }
 
-               if (!(printer++ % 5000)
+               if (do_print == NULL && !(printer++ % 5000)
                    || !(readtransactionfile || txqueue.numitems
                         || inflight.numitems))
                        printf


Reply via email to