]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4651. [bug] Nsupdate could attempt to use a zeroed address on
authorMark Andrews <marka@isc.org>
Wed, 19 Jul 2017 05:34:44 +0000 (15:34 +1000)
committerMark Andrews <marka@isc.org>
Wed, 19 Jul 2017 05:36:41 +0000 (15:36 +1000)
                        server timeout. [RT #45417]

(cherry picked from commit 38edf586f9756a264e4b1f2a33fa6faa22a12557)

CHANGES
bin/tests/system/nsupdate/ans4/ans.pl [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index d69a6378e43d8c14a700c8a6a69cbad6c8929b36..4ab592c60f21dd34c1b62f1e1212b500e0b18bbd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4651.  [bug]           Nsupdate could attempt to use a zeroed address on
+                       server timeout. [RT #45417]
+
 4650.  [test]          Silence coverity warnings in tsig_test.c. [RT #45528]
 
 4649.  [bug]           The wrong zone was logged when a catalog zone is added.
diff --git a/bin/tests/system/nsupdate/ans4/ans.pl b/bin/tests/system/nsupdate/ans4/ans.pl
new file mode 100644 (file)
index 0000000..582c2c2
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2016  Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+use IO::Socket;
+use IO::File;
+use strict;
+
+# Ignore SIGPIPE so we won't fail if peer closes a TCP socket early
+local $SIG{PIPE} = 'IGNORE';
+
+# Flush logged output after every line
+local $| = 1;
+
+my $server_addr = "10.53.0.4";
+if (@ARGV > 0) {
+       $server_addr = @ARGV[0];
+}
+
+my $udpsock = IO::Socket::INET->new(LocalAddr => "$server_addr",
+   LocalPort => 5300, Proto => "udp", Reuse => 1) or die "$!";
+
+print "listening on $server_addr:5300.\n";
+
+my $pidf = new IO::File "ans.pid", "w" or die "cannot open pid file: $!";
+print $pidf "$$\n" or die "cannot write pid file: $!";
+$pidf->close or die "cannot close pid file: $!";;
+sub rmpid { unlink "ans.pid"; exit 1; };
+
+$SIG{INT} = \&rmpid;
+$SIG{TERM} = \&rmpid;
+
+# Main
+for (;;) {
+       my $rin;
+       my $rout;
+
+       $rin = '';
+       vec($rin, fileno($udpsock), 1) = 1;
+
+       select($rout = $rin, undef, undef, undef);
+
+       if (vec($rout, fileno($udpsock), 1)) {
+               printf "UDP request\n";
+               my $buf;
+               $udpsock->recv($buf, 512);
+       }
+}