Sync from SUSE:SLFO:Main rsync revision 5aae52720cdc30fbf47309e420825c93

This commit is contained in:
Adrian Schröter 2024-05-04 00:10:06 +02:00
commit 0154da6139
18 changed files with 1809 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

11
logrotate.rsync Normal file
View File

@ -0,0 +1,11 @@
/var/log/rsyncd.log {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
copytruncate
}

BIN
rsync-3.2.7.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

6
rsync-3.2.7.tar.gz.asc Normal file
View File

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQQASMiwJtTJbw5YnC9shZ+xS5aoxQUCY1HvAwAKCRBshZ+xS5ao
xZFiAKC3MJgYOMf5VfpfAbld/+ydZRznMQCgkF/yaDJvKMNOslSRNuMZ/eXZ84g=
=Q+uI
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,48 @@
From 1f83963f59960150e8c46112daa8411324c1f209 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Fri, 18 Aug 2023 08:26:20 +0200
Subject: [PATCH] exclude: fix crashes with fortified strlcpy()
Fortified (-D_FORTIFY_SOURCE=2 for gcc) builds make strlcpy() crash when
its third parameter (size) is larger than the buffer:
$ rsync -FFXHav '--filter=merge global-rsync-filter' Align-37-43/ xxx
sending incremental file list
*** buffer overflow detected ***: terminated
It's in the exclude code in setup_merge_file():
strlcpy(y, save, MAXPATHLEN);
Note the 'y' pointer was incremented, so it no longer points to memory
with MAXPATHLEN "owned" bytes.
Fix it by remembering the number of copied bytes into the 'save' buffer
and use that instead of MAXPATHLEN which is clearly incorrect.
Fixes #511.
---
exclude.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/exclude.c b/exclude.c
index ffe55b167..1a5de3b9e 100644
--- a/exclude.c
+++ b/exclude.c
@@ -720,7 +720,8 @@ static BOOL setup_merge_file(int mergelist_num, filter_rule *ex,
parent_dirscan = True;
while (*y) {
char save[MAXPATHLEN];
- strlcpy(save, y, MAXPATHLEN);
+ /* copylen is strlen(y) which is < MAXPATHLEN. +1 for \0 */
+ size_t copylen = strlcpy(save, y, MAXPATHLEN) + 1;
*y = '\0';
dirbuf_len = y - dirbuf;
strlcpy(x, ex->pattern, MAXPATHLEN - (x - buf));
@@ -734,7 +735,7 @@ static BOOL setup_merge_file(int mergelist_num, filter_rule *ex,
lp->head = NULL;
}
lp->tail = NULL;
- strlcpy(y, save, MAXPATHLEN);
+ strlcpy(y, save, copylen);
while ((*x++ = *y++) != '/') {}
}
parent_dirscan = False;

13
rsync-no-libattr.patch Normal file
View File

@ -0,0 +1,13 @@
Index: rsync-3.2.2/configure.ac
===================================================================
--- rsync-3.2.2.orig/configure.ac
+++ rsync-3.2.2/configure.ac
@@ -1309,7 +1309,7 @@ else
AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs (or equivalent)])
AC_DEFINE(SUPPORT_XATTRS, 1)
AC_DEFINE(NO_SYMLINK_USER_XATTRS, 1, [True if symlinks do not support user xattrs])
- AC_CHECK_LIB(attr,getxattr)
+ AC_SEARCH_LIBS([getxattr], [attr])
;;
darwin*)
AC_MSG_RESULT(Using OS X xattrs)

BIN
rsync-patches-3.2.7.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQQASMiwJtTJbw5YnC9shZ+xS5aoxQUCY1HvAwAKCRBshZ+xS5ao
xR3uAJ46yBJwj44DSq5YGtnUJKhLHUJLjwCfbcdunUI6bpF6Yp4IGgPUSxHIsoI=
=+RP4
-----END PGP SIGNATURE-----

1257
rsync.changes Normal file

File diff suppressed because it is too large Load Diff

32
rsync.keyring Normal file
View File

@ -0,0 +1,32 @@
pub 1024D/4B96A8C5 2003-12-19
uid Wayne Davison <wayned@users.sourceforge.net>
uid Wayne Davison <wayned@samba.org>
sub 1024g/29C67D63 2003-12-19
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.9 (GNU/Linux)
mQGiBD/ja2cRBACZqtQ/VnuWd2TA/T4nFitXPOF//7uterTWZVMDBrSE3tJdW1lv
90z2g2RJKktJTC3yjs82IH6wWvvFsHDPGXQRuoBr0dPYHBaVhKX85uewigHiE2M1
1Ub8Vv1c/JDGAh1cNmCAWazghV+emamrWJWq0f0hz5eqq4LCcPwo4riUVwCg9W37
YAR8Z4NHa6FWjrEKjl2NIMUD/iXJnp6qJFMK9Fs+2dWyL1m/mRb0h+I/cqgpkUvo
gRhL95Jttg2QQtXJWCsB3hA/L/2Iu2bV8iS1aRlZQsAWogA3/m56ROs8cIyN4ouj
1dpPoG7sKGA8BTvXxuSF9l6ngx7208iX+xiQCDeGfBtBFBy70iJxTFGzp2mP3IiP
pwWtB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ec file for package rsync
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} >= 1550
%bcond_without xxhash
%else
%bcond_with xxhash
%endif
%if 0%{?suse_version} < 1550
%bcond_without gcc11
%else
%bcond_with gcc11
%endif
%if 0%{?suse_version} < 1600
%bcond_without slp
%else
%bcond_with slp
%endif
Name: rsync
Version: 3.2.7
Release: 0
Summary: Versatile tool for fast incremental file transfer
License: GPL-3.0-or-later
Group: Productivity/Networking/Other
URL: https://rsync.samba.org/
Source: https://rsync.samba.org/ftp/rsync/src/rsync-%{version}.tar.gz
Source1: https://rsync.samba.org/ftp/rsync/src/rsync-patches-%{version}.tar.gz
Source2: logrotate.rsync
Source3: rsyncd.socket
Source4: rsyncd.rc
Source5: rsyncd.conf
Source6: rsyncd.secrets
Source8: rsyncd.service
Source9: rsyncd@.service
Source10: https://rsync.samba.org/ftp/rsync/src/rsync-%{version}.tar.gz.asc
Source11: https://rsync.samba.org/ftp/rsync/src/rsync-patches-%{version}.tar.gz.asc
Source12: %{name}.keyring
Source13: rsyncd
Patch0: rsync-no-libattr.patch
Patch1: rsync-fortified-strlcpy-fix.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: c++_compiler
BuildRequires: libacl-devel
BuildRequires: liblz4-devel
BuildRequires: libzstd-devel
BuildRequires: pkgconfig
BuildRequires: popt-devel
BuildRequires: systemd-rpm-macros
BuildRequires: zlib-devel
%if %{with xxhash}
BuildRequires: pkgconfig(libxxhash) >= 0.8.0
%endif
%if %{with gcc11}
BuildRequires: gcc11-c++
%endif
%if %{with slp}
BuildRequires: openslp-devel
%endif
BuildRequires: pkgconfig(openssl)
Requires(post): grep
Requires(post): sed
Recommends: logrotate
%description
Rsync is a fast and extraordinarily versatile file copying tool. It can copy
locally, to/from another host over any remote shell, or to/from a remote rsync
daemon. It offers a large number of options that control every aspect of its
behavior and permit very flexible specification of the set of files to be
copied. It is famous for its delta-transfer algorithm, which reduces the amount
of data sent over the network by sending only the differences between the
source files and the existing files in the destination. Rsync is widely used
for backups and mirroring and as an improved copy command for everyday use.
%prep
%setup -q -b 1
rm -f zlib/*.h zlib/*.c
%if %{with slp}
patch -p1 < patches/slp.diff
%endif
%autopatch -p1
%build
autoreconf -fiv
%if %{with gcc11}
export CC=gcc-11
export CXX=g++-11
%endif
export CFLAGS="%{optflags} -fPIC -DPIC -fPIE"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-Wl,-z,relro,-z,now -fPIE -pie"
%configure \
--with-included-popt=no \
--with-included-zlib=no \
--disable-debug \
%if !%{with xxhash}
--disable-xxhash\
%endif
%ifarch x86_64
--enable-simd \
%endif
%if %{with slp}
--enable-slp \
%endif
--enable-acl-support \
--enable-xattr-support
%make_build reconfigure
%make_build
%check
%make_build check
chmod -x support/*
%install
%make_install
rm -f %{buildroot}%{_sbindir}/rsyncd
install -d %{buildroot}%{_sysconfdir}/init.d
install -d %{buildroot}%{_sysconfdir}/xinetd.d
install -d %{buildroot}%{_sbindir}
install -m 755 %{SOURCE13} %{buildroot}%{_sbindir}/rsyncd
install -m 755 support/rsyncstats %{buildroot}%{_bindir}
%if 0%{?suse_version} > 1500
install -d %{buildroot}%{_distconfdir}/logrotate.d
install -m 644 %{SOURCE2} %{buildroot}%{_distconfdir}/logrotate.d/rsync
%else
install -d %{buildroot}%{_sysconfdir}/logrotate.d
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/rsync
%endif
install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/rsyncd.conf
install -m 600 %{SOURCE6} %{buildroot}%{_sysconfdir}/rsyncd.secrets
install -D -m 0644 %{SOURCE9} %{buildroot}%{_unitdir}/rsyncd@.service
install -D -m 0644 %{SOURCE8} %{buildroot}%{_unitdir}/rsyncd.service
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/rsyncd.socket
ln -sf service %{buildroot}%{_sbindir}/rcrsyncd
%pre
%service_add_pre rsyncd.service
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/rsync ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
%if 0%{?suse_version} > 1500
%posttrans
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/rsync ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
%preun
%service_del_preun rsyncd.service
%post
%service_add_post rsyncd.service
%postun
%service_del_postun rsyncd.service
%files
%license COPYING
%doc NEWS.md README.md tech_report.tex support/
%{_unitdir}/rsyncd@.service
%{_unitdir}/rsyncd.service
%{_unitdir}/rsyncd.socket
%config(noreplace) %{_sysconfdir}/rsyncd.conf
%config(noreplace) %{_sysconfdir}/rsyncd.secrets
%if 0%{?suse_version} > 1500
%{_distconfdir}/logrotate.d/rsync
%else
%config(noreplace) %{_sysconfdir}/logrotate.d/rsync
%endif
%{_sbindir}/rcrsyncd
%{_sbindir}/rsyncd
%{_bindir}/rsyncstats
%{_bindir}/rsync
%{_bindir}/rsync-ssl
%{_mandir}/man1/rsync.1%{?ext_man}
%{_mandir}/man1/rsync-ssl.1%{?ext_man}
%{_mandir}/man5/rsyncd.conf.5%{?ext_man}
%changelog

6
rsyncd Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# We need this wrapper instead of a plain symlink to be able to set
# a different SELinux label on this
exec -a rsyncd /usr/bin/rsync "$@"

16
rsyncd.conf Normal file
View File

@ -0,0 +1,16 @@
gid = users
read only = true
use chroot = true
transfer logging = true
log format = %h %o %f %l %b
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
hosts allow = trusted.hosts
slp refresh = 300
use slp = false
#[Example]
# path = /home/Example
# comment = An Example
# auth users = user
# secrets file = /etc/rsyncd.secrets

137
rsyncd.rc Normal file
View File

@ -0,0 +1,137 @@
#! /bin/sh
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
# Copyright (c) 2002 SuSE Linux AG
#
# Author: Kurt Garloff <feedback@suse.de>
#
# init.d/rsyncd
#
# and symbolic its link
#
# /sbin/rcrsyncd
#
# System startup script for the rsync daemon
#
### BEGIN INIT INFO
# Provides: rsync
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: slpd
# Should-Stop: slpd
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the rsync server daemon
# Short-Description: Start the rsync server daemon
### END INIT INFO
RSYNCD_BIN=/usr/sbin/rsyncd
test -x $RSYNCD_BIN || exit 5
RSYNCD_PID=/var/run/rsyncd.pid
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting rsync daemon"
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
# NOTE: startproc return 0, even if service is
# already running to match LSB spec.
startproc -p $RSYNCD_PID -t 1 $RSYNCD_BIN --daemon
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down rsync daemon"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -p $RSYNCD_PID $RSYNCD_BIN
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart.
echo "Reload service rsync"
"$0" restart
rc_status -v
;;
reload)
# rsyncd does not catch SIGHUP
echo -n "Reload service rsync"
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for rsync daemon: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc -p $RSYNCD_PID $RSYNCD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac
rc_exit

1
rsyncd.secrets Normal file
View File

@ -0,0 +1 @@
# user:passwd

22
rsyncd.service Normal file
View File

@ -0,0 +1,22 @@
[Unit]
Description=Start the rsync server daemon
After=network.target
ConditionPathExists=/etc/rsyncd.conf
[Service]
ExecStart=/usr/sbin/rsyncd --daemon --no-detach
IOSchedulingClass=idle
CPUSchedulingPolicy=batch
PrivateTmp=true
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectHostname=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions
[Install]
WantedBy=multi-user.target

10
rsyncd.socket Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Rsync Server Socket
Conflicts=rsyncd.service
[Socket]
ListenStream=873
Accept=yes
[Install]
WantedBy=sockets.target

11
rsyncd@.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Start the rsync server daemon
After=network.target
ConditionPathExists=/etc/rsyncd.conf
[Service]
ExecStart=/usr/sbin/rsyncd --daemon --no-detach
IOSchedulingClass=idle
CPUSchedulingPolicy=batch
PrivateTmp=true
StandardInput=socket