From 6917caa9115d9870bc2fcf8e9c0d1a57579f8490 Mon Sep 17 00:00:00 2001 From: Benjamin Lefoul Date: Oct 18 2016 06:59:00 +0000 Subject: Some IPv6 support (BZ 1385630) --- diff --git a/BackupPC-3.3.1-IPv6-support.patch b/BackupPC-3.3.1-IPv6-support.patch new file mode 100644 index 0000000..7576879 --- /dev/null +++ b/BackupPC-3.3.1-IPv6-support.patch @@ -0,0 +1,171 @@ +Index: configure.pl +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/configure.pl,v +retrieving revision 1.51 +diff -u -w -r1.51 configure.pl +--- configure.pl 12 Jan 2015 00:56:40 -0000 1.51 ++++ configure.pl 17 Oct 2016 10:42:05 -0000 +@@ -253,6 +253,7 @@ + nmblookup => "NmbLookupPath", + rsync => "RsyncClientPath", + ping => "PingPath", ++ 'ping6/ping' => "PingPath6", + df => "DfPath", + 'ssh/ssh2' => "SshPath", + sendmail => "SendmailPath", +Index: bin/BackupPC_dump +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/bin/BackupPC_dump,v +retrieving revision 1.51 +diff -u -w -r1.51 BackupPC_dump +--- bin/BackupPC_dump 12 Jan 2015 00:56:40 -0000 1.51 ++++ bin/BackupPC_dump 17 Oct 2016 10:42:05 -0000 +@@ -493,7 +493,7 @@ + } else { + $host = $client; + } +- if ( !defined(gethostbyname($host)) ) { ++ if ( !defined($bpc->resolve($host)) ) { + # + # Ok, NS doesn't know about it. Maybe it is a NetBios name + # instead. +Index: bin/BackupPC_restore +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/bin/BackupPC_restore,v +retrieving revision 1.36 +diff -u -w -r1.36 BackupPC_restore +--- bin/BackupPC_restore 12 Jan 2015 00:56:40 -0000 1.36 ++++ bin/BackupPC_restore 17 Oct 2016 10:42:05 -0000 +@@ -167,7 +167,7 @@ + # Find its IP address + # + if ( $hostIP !~ /\d+\.\d+\.\d+\.\d+/ ) { +- if ( !defined(gethostbyname($host)) ) { ++ if ( !defined($bpc->resolve($host)) ) { + # + # Ok, NS doesn't know about it. Maybe it is a NetBios name + # instead. +Index: conf/config.pl +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/conf/config.pl,v +retrieving revision 1.58 +diff -u -w -r1.58 config.pl +--- conf/config.pl 12 Jan 2015 00:56:40 -0000 1.58 ++++ conf/config.pl 17 Oct 2016 10:42:06 -0000 +@@ -1652,9 +1652,24 @@ + $Conf{PingPath} = ''; + + # ++# Like PingPath, but for IPv6. Security caution: normal users ++# should not be allowed to write to this file or directory. ++# In some environments, this is something like '/usr/bin/ping6'. ++# In modern environments, the regular ping command can handle both ++# IPv4 and IPv6. In the latter case, just set it to $Conf{PingPath} ++# ++# If you want to disable ping checking for IPv6 hosts, set this to ++# some program that exits with 0 status, eg: ++# ++# $Conf{PingPath6} = '/bin/echo'; ++# ++$Conf{PingPath6} = ''; ++ ++# + # Ping command. The following variables are substituted at run-time: + # +-# $pingPath path to ping ($Conf{PingPath}) ++# $pingPath path to ping ($Conf{PingPath} or $Conf{PingPath6}) ++# depending on the address type of $host. + # $host host name + # + # Wade Brown reports that on solaris 2.6 and 2.7 ping -s returns the wrong +Index: lib/BackupPC/Config.pm +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/Config.pm,v +retrieving revision 1.3 +diff -u -w -r1.3 Config.pm +--- lib/BackupPC/Config.pm 2 Aug 2003 08:01:43 -0000 1.3 ++++ lib/BackupPC/Config.pm 17 Oct 2016 10:42:06 -0000 +@@ -269,6 +269,9 @@ + PingPath => {struct => 'SCALAR', + type => 'STRING', }, + ++ PingPath6 => {struct => 'SCALAR', ++ type => 'STRING', }, ++ + PingArgs => {struct => 'SCALAR', + type => 'STRING', }, + +Index: lib/BackupPC/Lib.pm +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/Lib.pm,v +retrieving revision 1.53 +diff -u -w -r1.53 Lib.pm +--- lib/BackupPC/Lib.pm 12 Jan 2015 00:56:41 -0000 1.53 ++++ lib/BackupPC/Lib.pm 17 Oct 2016 10:42:06 -0000 +@@ -982,7 +982,7 @@ + } + + my $args = { +- pingPath => $bpc->{Conf}{PingPath}, ++ pingPath => $bpc->getPingPathByAddressType( $host ), + host => $host, + }; + $pingCmd = $bpc->cmdVarSubstitute($bpc->{Conf}{PingCmd}, $args); +@@ -1543,4 +1543,27 @@ + return $glob; + } + ++# ++# Attempts to resolve a hostname. ++# Return 4 if it resolves to an IPv4 address, 6 if it resolves to an IPv6 ++# address or undef if it can not be resolved. ++# ++sub resolve ++{ ++ my ( $bpc, $host ) = @_; ++ my ( $err, @addrs ) = Socket::getaddrinfo($host); ++ return undef if ( $err ); ++ return (($addrs[0])->{'family'} == Socket::AF_INET6) ? 6 : 4; ++} ++ ++# ++# Return pingPath depending on address type of target. ++# ++sub getPingPathByAddressType ++{ ++ my ( $bpc, $host ) = @_; ++ my $at = $bpc->resolve( $host ) || 4; ++ return ($at == 6) ? $bpc->{Conf}{PingPath6} : $bpc->{Conf}{PingPath}; ++} ++ + 1; +Index: lib/BackupPC/CGI/EditConfig.pm +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/CGI/EditConfig.pm,v +retrieving revision 1.29 +diff -u -w -r1.29 EditConfig.pm +--- lib/BackupPC/CGI/EditConfig.pm 12 Jan 2015 00:56:41 -0000 1.29 ++++ lib/BackupPC/CGI/EditConfig.pm 17 Oct 2016 10:42:06 -0000 +@@ -86,6 +86,7 @@ + {name => "SshPath"}, + {name => "NmbLookupPath"}, + {name => "PingPath"}, ++ {name => "PingPath6"}, + {name => "DfPath"}, + {name => "SplitPath"}, + {name => "ParPath"}, +Index: lib/BackupPC/Config/Meta.pm +=================================================================== +RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/Config/Meta.pm,v +retrieving revision 1.28 +diff -u -w -r1.28 Meta.pm +--- lib/BackupPC/Config/Meta.pm 12 Jan 2015 00:56:41 -0000 1.28 ++++ lib/BackupPC/Config/Meta.pm 17 Oct 2016 10:42:06 -0000 +@@ -85,6 +85,7 @@ + SshPath => {type => "execPath", undefIfEmpty => 1}, + NmbLookupPath => {type => "execPath", undefIfEmpty => 1}, + PingPath => {type => "execPath", undefIfEmpty => 1}, ++ PingPath6 => {type => "execPath", undefIfEmpty => 1}, + DfPath => {type => "execPath", undefIfEmpty => 1}, + DfCmd => "string", + SplitPath => {type => "execPath", undefIfEmpty => 1}, diff --git a/BackupPC.spec b/BackupPC.spec index c29b7a7..51eceee 100644 --- a/BackupPC.spec +++ b/BackupPC.spec @@ -15,7 +15,7 @@ Name: BackupPC Version: 3.3.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: High-performance backup system Group: Applications/System License: GPLv2+ @@ -27,6 +27,7 @@ Patch1: BackupPC-3.2.1-rundir.patch Patch2: BackupPC-3.2.1-piddir.patch Patch3: BackupPC-3.3.0-fix-shadow-access.patch Patch4: BackupPC-3.3.1-perl_defined_at_deprecation.patch +Patch5: BackupPC-3.3.1-IPv6-support.patch Source1: BackupPC.htaccess Source2: BackupPC.logrotate Source3: BackupPC-README.fedora @@ -95,6 +96,7 @@ configurable and easy to install and maintain. %patch2 -p1 -b .piddir %patch3 -p1 -b .shadow-access %patch4 -p1 -b .oldperl +%patch5 -p0 -b .ipv6support sed -i "s|\"backuppc\"|\"$LOGNAME\"|g" configure.pl for f in ChangeLog doc/BackupPC.pod doc/BackupPC.html; do @@ -371,6 +373,9 @@ fi %endif %changelog +* Tue Oct 18 2016 Benjamin Lefoul - 3.3.1-6 +- Some IPv6 support (BZ 1385630) + * Fri Jul 15 2016 Benjamin Lefoul - 3.3.1-5 - Deprecation of defined(@array) in perl