]> git.ipfire.org Git - thirdparty/rsync.git/log
thirdparty/rsync.git
2 weeks agodefence-in-depth: bound wire-supplied counts and lengths
Andrew Tridgell [Wed, 31 Dec 2025 01:56:54 +0000 (12:56 +1100)] 
defence-in-depth: bound wire-supplied counts and lengths

Multiple receiver-side fields read from the wire were trusted
without upper-bound checks. A hostile peer could either request
extreme allocations (DoS via --max-alloc) or, on platforms where
read_varint returned a negative value, push ~SIZE_MAX through the
size_t conversion to wrap downstream length checks.

Introduce read_int_bounded(), read_varint_bounded() and
read_varint_size() in io.c so wire-derived integer ranges are
checked at the read site rather than scattered across each
caller, with RERR_PROTOCOL on out-of-range input.

Apply the bounded primitives to:
  - sum->count (checksum count -- previously could overflow
    (size_t)count * xfer_sum_len on 32-bit with raised max-alloc)
  - xattrs: count, name_len, datum_len, plus rel_pos overflow
    detect to stop chain wrapping the num accumulator
  - acls: ida-entry count
  - flist: file mode S_IFMT validation, modtime_nsec range check
  - delete-stat counters in main: per-summand cap so the total
    can't overflow a signed 32-bit accumulator

Reporters include Joshua Rogers (checksum-count overflow finding).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoclientserver: fix hostname ACL bypass when using daemon chroot
Andrew Tridgell [Wed, 31 Dec 2025 02:50:35 +0000 (13:50 +1100)] 
clientserver: fix hostname ACL bypass when using daemon chroot

On an rsync daemon configured with "daemon chroot", the reverse-DNS
lookup of the connecting client was performed *after* the chroot
had been entered. If the chroot did not contain the files glibc
needs for resolution (/etc/resolv.conf, /etc/nsswitch.conf,
/etc/hosts, NSS service modules), the lookup failed and
client_name() returned "UNKNOWN". Hostname-based deny rules
("hosts deny = *.evil.example") therefore could not match, and
an attacker controlling their PTR record could connect from a
hostname the administrator had intended to deny. IP-based ACLs
were unaffected.

Do the reverse DNS lookup before chroot/setuid; client_name()
caches its result, so the post-chroot call uses the cached value
and hostname-based ACLs work even when DNS is unavailable
post-chroot.

Adds testsuite/daemon-chroot-acl.test as end-to-end regression
coverage. The test sets up an empty chroot directory, configures
"hosts deny = <localhost-resolved-name>" with daemon chroot, and
asserts the connection is refused with @ERROR access denied.
Uses unshare --user --map-root-user for non-root CAP_SYS_CHROOT;
skips cleanly on non-Linux or when user namespaces aren't
available.

Reporter: Joshua Rogers (MegaManSec).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoreceiver: add parent_ndx<0 guard, mirroring 797e17f
Andrew Tridgell [Tue, 5 May 2026 06:48:16 +0000 (16:48 +1000)] 
receiver: add parent_ndx<0 guard, mirroring 797e17f

Commit 797e17f ("fixed an invalid access to files array") added a
parent_ndx < 0 guard to send_files() in sender.c, but the visually-
identical block in recv_files() in receiver.c was not updated. A
malicious rsync:// server can therefore drive any connecting client
into the same out-of-bounds dir_flist->files[-1] read followed by a
file_struct dereference in f_name() one line later.

Reach: protocol-30+ default (inc_recurse) makes flist.c:2745 set
parent_ndx = -1 on the first received flist when the sender omits a
leading "." entry; rsync.c flist_for_ndx() does not reject ndx == 0
in that state because the range check evaluates 0 < 0 = false; and
read_ndx_and_attrs() only validates ndx with the ITEM_TRANSFER bit
set, so iflags=ITEM_IS_NEW (or any other non-transfer iflag word)
bypasses the check.

Apply the same guard receiver-side. Confirmed: the same PoC (a
minimal Python rsyncd that handshakes with CF_INC_RECURSE, sends a
no-leading-"." flist, and emits ndx=0 with ITEM_IS_NEW) crashes
unpatched 3.4.2 with SEGV_MAPERR si_addr=0x4101a-class in the
receiver child; with this guard it exits cleanly with code 2
(RERR_PROTOCOL).

The attack surface delta over the sender variant is large:
the original was malicious-client -> daemon, this is
malicious-server -> any rsync client doing a normal rsync://
or remote-shell pull.

Reported by Pratham Gupta (alchemy1729).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agotestsuite: cover 'refuse options = compress' for the daemon
Andrew Tridgell [Fri, 1 May 2026 00:56:17 +0000 (10:56 +1000)] 
testsuite: cover 'refuse options = compress' for the daemon

Add a daemon-refuse-compress test that builds a module configured with
'refuse options = compress' and asserts that:
  1. an attempted -z transfer to that module fails with an error
     mentioning --compress, and
  2. the same transfer without -z still succeeds.

This pins down the documented way to disable all compression on a
daemon, which previously had no automated coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agotoken: harden compressed-token decoding against integer overflow
Andrew Tridgell [Wed, 29 Apr 2026 01:10:59 +0000 (11:10 +1000)] 
token: harden compressed-token decoding against integer overflow

The receiver's three compressed-token decoders --
recv_deflated_token (zlib), recv_zstd_token, and
recv_compressed_token (lz4) -- accumulated rx_token (a 32-bit
signed counter) without overflow checking. A malicious sender
could craft a compressed-token stream that walked rx_token past
INT32_MAX, with careful manipulation leaking process memory
contents to the wire (environment variables, passwords, heap
pointers, library pointers -- significantly weakening ASLR
and facilitating further exploitation).

Cap rx_token at MAX_TOKEN_INDEX = 0x7ffffffe. Fold the
bookkeeping into recv_compressed_token_num() and
recv_compressed_token_run() shared by all three decoders. Reject
negative or out-of-range token values explicitly. Also cap the
simple_recv_token literal-block length at the source: any
wire-supplied length > CHUNK_SIZE is ill-formed (the matching
simple_send_token never writes a chunk larger than CHUNK_SIZE),
so reject before looping on attacker-controlled bytes.

Reach: an authenticated daemon connection with compression
enabled (the default for protocols >= 30 when both peers
advertise it). Disabling compression on the daemon
("refuse options = compress" in rsyncd.conf) is the available
workaround.

Reporter: Omar Elsayed (seks99x).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoci(cygwin): mark all symlink-race regression tests as expected-skipped
Andrew Tridgell [Tue, 5 May 2026 21:44:47 +0000 (07:44 +1000)] 
ci(cygwin): mark all symlink-race regression tests as expected-skipped

Cygwin lacks RESOLVE_BENEATH-equivalent kernel support and the
per-component O_NOFOLLOW fallback also can't be exercised meaningfully
under the cygwin runner's filesystem semantics, so every test that
asserts the secure_relative_open / do_*_at machinery actually blocks
the attack would skip. Make those skips expected in the workflow's
RSYNC_EXPECT_SKIPPED list:

  - chdir-symlink-race
  - chmod-symlink-race
  - bare-do-open-symlink-race
  - sender-flist-symlink-leak
  - daemon-chroot-acl

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agotestsuite: end-to-end regression test for chdir-symlink-race
Andrew Tridgell [Tue, 5 May 2026 04:34:50 +0000 (14:34 +1000)] 
testsuite: end-to-end regression test for chdir-symlink-race

testsuite/chdir-symlink-race.test runs an actual rsync daemon
(via RSYNC_CONNECT_PROG to avoid the network) configured with
"use chroot = no", plants a symlink at module/subdir -> ../outside,
and runs four flavours of attacker-shaped transfer (single-file
poc_chmod, -r push into the symlinked subdir with --size-only and
without, -r push into the module root). All four must leave the
outside-the-module sentinel file's mode AND content unchanged.

Portability:
  - file_mode() helper falls back to BSD stat -f %Lp when GNU
    stat -c %a is unavailable (macOS, FreeBSD).
  - Pre-saved pristine copy + cmp(1) replaces sha1sum, which
    differs across platforms (sha1sum / shasum / sha1).

Tests are kept running as root in the user-namespace re-exec
wrapper used by symlink-race tests so the daemon's setuid path
doesn't drop into the test user's identity (which on Linux
would mean the chmod-escape code path can't trigger because
the test user doesn't have CAP_FOWNER over the outside file).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoutil1+syscall: secure copy_file source/dest opens; bare-path defence-in-depth
Andrew Tridgell [Tue, 5 May 2026 23:45:30 +0000 (09:45 +1000)] 
util1+syscall: secure copy_file source/dest opens; bare-path defence-in-depth

Three related codex audit findings:

  Finding 3a: copy_file()'s source open in util1.c used
  do_open_nofollow(), which only rejects a final-component
  symlink. A parent-component symlink (e.g. --copy-dest=cd where
  cd -> /outside) follows freely and reads outside the module.
  Route through secure_relative_open() with O_NOFOLLOW.

  Finding 3b: generator.c's in-place backup-file create still
  used a bare do_open with O_CREAT, leaving a tiny but reachable
  parent-symlink window between the secure unlink (already
  through do_unlink_at) and the create. Add do_open_at() that
  goes through a secure parent dirfd, and route the call site
  through it.

  Finding 3c: copy_file()'s destination open in
  unlink_and_reopen() had the same bare-do_open pattern; route
  through do_open_at as well.

Adds testsuite/copy-dest-source-symlink.test and
testsuite/bare-do-open-symlink-race.test as regression coverage
for both attack shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agosyscall: add symlink-race-safe do_*_at() wrappers and harden secure_relative_open
Andrew Tridgell [Tue, 5 May 2026 05:02:48 +0000 (15:02 +1000)] 
syscall: add symlink-race-safe do_*_at() wrappers and harden secure_relative_open

Add the rest of the path-based syscall wrappers and migrate every
receiver-side caller:
  - do_lchown_at, do_rename_at, do_mkdir_at, do_symlink_at,
    do_mknod_at, do_link_at, do_unlink_at, do_rmdir_at,
    do_utimensat_at, do_stat_at, do_lstat_at

Same shape as do_chmod_at: open each parent under
secure_relative_open(), call the *at() variant against the dirfd,
fall through to the bare path-based syscall in non-daemon /
chrooted / absolute-path / no-parent cases. macOS's
setattrlist-based set_times tier is also routed through the
utimensat_at path on daemon-no-chroot.

Hardenings to secure_relative_open() itself:
  - confine basedir resolution under the same kernel mechanism
    used for relpath (basedirs from --copy-dest / --link-dest are
    sender-controllable in daemon mode)
  - reject any '..' component (bare '..', 'foo/..', 'subdir/..')
    so the per-component O_NOFOLLOW fallback can't escape
  - return the dirfd we built up from the per-component fallback
    when the caller passed O_DIRECTORY (otherwise every do_*_at
    failed with EINVAL on platforms without RESOLVE_BENEATH)

Adds testsuite/alt-dest-symlink-race.test and
testsuite/secure-relpath-validation.test (with t_secure_relpath
helper) as regression coverage for the new hardenings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoutil1: secure change_dir() against symlink-race chdir-escape
Andrew Tridgell [Tue, 5 May 2026 04:34:33 +0000 (14:34 +1000)] 
util1: secure change_dir() against symlink-race chdir-escape

The receiver's chdir(2) into a destination subdirectory followed
attacker-planted symlinks at every path component. Once CWD
escaped the module, every subsequent path-relative syscall (open,
chmod, lchown, ...) inherited the escape -- defeating
secure_relative_open's RESOLVE_BENEATH anchor against AT_FDCWD,
since the anchor itself was now outside the module.

Route change_dir's relative target through secure_relative_open()
and fchdir() to the resulting dirfd in am_daemon && !am_chrooted
mode, so the chdir step itself can no longer follow a parent-
symlink. Same treatment applied to the CD_SKIP_CHDIR /
set_path_only path so it also can't follow attacker symlinks
during path tracking.

Adds testsuite/sender-flist-symlink-leak.test covering the
sender-side flist resolution variant of the same primitive.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agosyscall+receiver: secure receiver-side do_chmod against symlink-race TOCTOU
Andrew Tridgell [Mon, 4 May 2026 11:53:14 +0000 (21:53 +1000)] 
syscall+receiver: secure receiver-side do_chmod against symlink-race TOCTOU

CVE-2026-29518's fix routed the receiver's open() through
secure_relative_open(), but every other path-based syscall the
receiver runs on sender-controllable paths is vulnerable to the
same TOCTOU primitive. This commit closes the chmod variant.

Add do_chmod_at() that opens the parent of fname under
secure_relative_open() and uses fchmodat() against the resulting
dirfd. Gate the secure path on am_daemon && !am_chrooted (the same
gate use_secure_symlinks already uses for the receiver basis-file
open), so non-daemon callers and chrooted daemons keep the original
do_chmod() fast path.

Migrate the receiver-side do_chmod() call sites in delete.c,
generator.c, rsync.c, and xattrs.c.

Adds testsuite/chmod-symlink-race.test (with t_chmod_secure helper)
as regression coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agosender: fix read-path TOCTOU by opening from module root (CVE-2026-29518)
Andrew Tridgell [Sat, 28 Feb 2026 22:28:40 +0000 (09:28 +1100)] 
sender: fix read-path TOCTOU by opening from module root (CVE-2026-29518)

The sender's file open was vulnerable to the same TOCTOU symlink
race as the receiver-side basis-file open. change_pathname() calls
chdir() into subdirectories, which follows symlinks; an attacker
could race to swap a directory for a symlink between the chdir and
the file open, allowing reads of privileged files through the
daemon.

Reconstruct the full relative path (F_PATHNAME + fname) and open
via secure_relative_open() from the trusted module_dir, which
walks each path component without following symlinks. This is
independent of CWD, so the chdir race is neutralised.

CVE-2026-29518.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 weeks agosyscall+clientserver: am_chrooted and use_secure_symlinks for daemon-no-chroot (CVE...
Andrew Tridgell [Tue, 30 Dec 2025 23:01:23 +0000 (10:01 +1100)] 
syscall+clientserver: am_chrooted and use_secure_symlinks for daemon-no-chroot (CVE-2026-29518)

CVE-2026-29518: an rsync daemon configured with "use chroot = no"
is exposed to a TOCTOU race on parent path components. A local
attacker with write access to a module can replace a parent
directory component with a symlink between the receiver's check
and its open(), redirecting reads (basis-file disclosure) and
writes (file overwrite) outside the module. Under elevated daemon
privilege this allows privilege escalation. Default
"use chroot = yes" is not exposed.

Add secure_relative_open() in syscall.c. It walks the parent
components under RESOLVE_BENEATH (Linux 5.6+) /
O_RESOLVE_BENEATH (FreeBSD 13+, macOS 15+) / per-component
O_NOFOLLOW elsewhere, anchored at a trusted dirfd, so a parent-
symlink swap is rejected by the kernel. Route the receiver's
basis-file open in receiver.c through it when use_secure_symlinks
is set in clientserver.c rsync_module().

Reporters: Nullx3D (Batuhan SANCAK); Damien Neil; Michael Stapelberg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoci(almalinux-8): use python39 module for runtests.py
Andrew Tridgell [Wed, 6 May 2026 19:34:54 +0000 (05:34 +1000)] 
ci(almalinux-8): use python39 module for runtests.py

The default python3 on AlmaLinux 8 is 3.6, but runtests.py uses
subprocess.run(capture_output=...) and check_output(text=...) which
were introduced in 3.7. Install the python39 module stream and point
/usr/bin/python3 at it via alternatives so the existing shebang
resolves correctly.

Reproduced as: TypeError: __init__() got an unexpected keyword
argument 'capture_output' at runtests.py line 75.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 weeks agoci: add Ubuntu 22.04 and AlmaLinux 8 workflows for backporting
Andrew Tridgell [Wed, 6 May 2026 19:27:45 +0000 (05:27 +1000)] 
ci: add Ubuntu 22.04 and AlmaLinux 8 workflows for backporting

The intent is to validate that future security fixes still build and
test cleanly on the oldest still-supported LTS releases of the two
mainstream Linux families, so backports can be developed against the
same CI surface as the trunk:

  - ubuntu-22.04: oldest GitHub Actions runner image still available
    (20.04 was retired in April 2025). Mirrors the existing
    ubuntu-build.yml step list.
  - almalinux-8: RHEL 8 rebuild, full support until 2029. Runs in an
    almalinux:8 container on ubuntu-latest because GHA has no native
    runner for the Fedora/RHEL family. Pulls libzstd/xxhash/lz4 dev
    headers from PowerTools + EPEL; commonmark via pip for the man
    page generator.

Both jobs follow the same paths-ignore convention as the other
workflows so a workflow-only change to one file won't fan out across
the whole CI matrix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agotestsuite: run protected-regular test as non-root using unshare
Andrew Tridgell [Wed, 22 Apr 2026 02:36:50 +0000 (12:36 +1000)] 
testsuite: run protected-regular test as non-root using unshare

Use unshare with user namespace UID mapping to run the
protected-regular test without real root privileges. Falls back
to skipping if unshare or uidmap is not available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 weeks agoStart 3.4.3dev going.
Andrew Tridgell [Wed, 29 Apr 2026 23:34:22 +0000 (09:34 +1000)] 
Start 3.4.3dev going.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agoci: add symlink-dirlink-basis to Cygwin's expected-skipped list
Andrew Tridgell [Wed, 29 Apr 2026 23:22:58 +0000 (09:22 +1000)] 
ci: add symlink-dirlink-basis to Cygwin's expected-skipped list

The test correctly skips on Cygwin (which lacks RESOLVE_BENEATH), but
the workflow's RSYNC_EXPECT_SKIPPED list still treats any change in
the skipped set as a CI failure. Add the new test name so the
skipped/got comparison matches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agotestsuite: skip symlink-dirlink-basis on platforms without RESOLVE_BENEATH
Andrew Tridgell [Wed, 29 Apr 2026 23:00:09 +0000 (09:00 +1000)] 
testsuite: skip symlink-dirlink-basis on platforms without RESOLVE_BENEATH

secure_relative_open() has a kernel-enforced "stay below dirfd" path
on Linux 5.6+ (openat2 RESOLVE_BENEATH) and FreeBSD 13+ (openat
O_RESOLVE_BENEATH). On Solaris, OpenBSD, NetBSD, and Cygwin the code
falls back to the per-component O_NOFOLLOW walk, which by design
rejects every directory symlink in the path -- the very case this
test exercises. Mark the test skipped there rather than have it
fail with a known regression that's tracked separately.

macOS is intentionally not in the skip list: although it does not
have O_RESOLVE_BENEATH either, the test passes there in practice;
investigation of the underlying reason is left as follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agosyscall: also use O_RESOLVE_BENEATH on FreeBSD and MacOS
Andrew Tridgell [Wed, 29 Apr 2026 22:44:11 +0000 (08:44 +1000)] 
syscall: also use O_RESOLVE_BENEATH on FreeBSD and MacOS

FreeBSD and MacOS have O_RESOLVE_BENEATH as an openat() flag with the same
"must not escape dirfd" semantics as Linux's RESOLVE_BENEATH. The
kernel rejects ".." escapes, absolute symlinks, and symlinks whose
target lies outside dirfd, while still following symlinks that
resolve within it -- the same trade-off that fixes issue #715 on
Linux.

Add a parallel BSD path in secure_relative_open(), gated on
declared. Unlike Linux, BSD doesn't have the header/runtime split
where the symbol can exist without kernel support, so no runtime
fallback is needed: if the flag compiles in, the kernel honours it.

OpenBSD and NetBSD have no equivalent kernel primitive and continue
to use the existing per-component O_NOFOLLOW walk; issue #715
remains visible on those platforms (a userland resolver or
unveil(2)-based fence would be follow-up work).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agosyscall: use openat2(RESOLVE_BENEATH) on Linux for secure_relative_open
Andrew Tridgell [Wed, 29 Apr 2026 22:39:22 +0000 (08:39 +1000)] 
syscall: use openat2(RESOLVE_BENEATH) on Linux for secure_relative_open

The CVE fix in commit c35e283 made secure_relative_open() walk every
component of relpath with O_NOFOLLOW. That blocks every symlink in the
path, which is stricter than the threat model required: legitimate
directory symlinks within the destination tree (e.g. when using -K /
--copy-dirlinks) are also rejected, breaking delta transfers with
"failed verification -- update discarded".  See issue #715.

On Linux 5.6+, openat2(RESOLVE_BENEATH | RESOLVE_NO_MAGICLINKS) gives
us exactly what we want: the kernel rejects any resolution that would
escape the starting directory (via "..", absolute paths, or symlinks
pointing outside dirfd) while still following symlinks that resolve
within it. /proc magic-links are blocked too.

Use openat2 first; fall back to the existing per-component O_NOFOLLOW
walk on ENOSYS (kernel < 5.6). The lexical "../" checks at the head
of the function are kept as defense in depth. The Linux gate is
plain #ifdef __linux__: the runtime ENOSYS fallback covers the only
case that actually matters (header present + old kernel), and any
Linux build environment without linux/openat2.h will fail with a
clear "no such file" error rather than silently disabling the
protection.

Verified manually that openat2(RESOLVE_BENEATH) blocks all four
escape patterns (absolute symlink, ../ symlink, lexical .., absolute
path) while allowing direct and within-tree symlinks. The new
testsuite/symlink-dirlink-basis.test (taken from PR #864 by Samuel
Henrique) exercises the issue #715 regression and passes; full
make check passes 47/47.

Test: testsuite/symlink-dirlink-basis.test (8 scenarios)
Fixes: https://github.com/RsyncProject/rsync/issues/715
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agotestsuite/xattrs: ignore SUNWattr_* in the Solaris xls helper
Andrew Tridgell [Wed, 29 Apr 2026 22:18:01 +0000 (08:18 +1000)] 
testsuite/xattrs: ignore SUNWattr_* in the Solaris xls helper

The Solaris xls() function listed every entry in the file's xattr
directory, which on Solaris includes OS-managed SUNWattr_ro and
SUNWattr_rw pseudo-attributes. SUNWattr_rw embeds the file creation
time, so its bytes naturally differ between the source and destination
files, making the xattrs and xattrs-hlink tests fail with diffs that
have nothing to do with rsync.

Rsync's own listxattr wrapper already filters these out
(lib/sysxattrs.c), so the right fix is to filter them in the test
display too. Other platforms are unaffected because each has its own
xls() branch in the case statement.

With the test now actually passing on Solaris, drop the CI hack that
overwrote testsuite/xattrs.test with a skip stub.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agoci: add OpenBSD and NetBSD build jobs, run 'make check' on the BSDs
Andrew Tridgell [Wed, 29 Apr 2026 22:02:26 +0000 (08:02 +1000)] 
ci: add OpenBSD and NetBSD build jobs, run 'make check' on the BSDs

Mirror the existing FreeBSD workflow for OpenBSD and NetBSD using
vmactions/openbsd-vm and vmactions/netbsd-vm so we get cross-BSD
coverage on push, PR, and the nightly schedule.

Also extend the FreeBSD and Solaris workflows to actually exercise the
test suite by running 'make check' after the build. The Linux, macOS,
and Cygwin jobs already did this.

The Solaris xattrs and xattrs-hlink tests are removed before 'make
check' because the Solaris SUNWattr_ro / SUNWattr_rw system attributes
leak into the test diff; that's a real rsync-on-Solaris issue to follow
up on, but skip the tests for now so the suite goes green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agoruntests.py: error early when test helper programs are missing
Andrew Tridgell [Wed, 29 Apr 2026 01:35:47 +0000 (11:35 +1000)] 
runtests.py: error early when test helper programs are missing

When invoked directly (rather than via 'make check'), runtests.py
previously left the user with a wall of confusing "not found" errors
from inside individual test scripts if the CHECK_PROGS helpers had not
been built. Detect this up front and point the user at the make
target that builds them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 weeks agopackaging: remove old release system
Andrew Tridgell [Tue, 28 Apr 2026 04:53:29 +0000 (14:53 +1000)] 
packaging: remove old release system

3 weeks agoPreparing for release of 3.4.2 [buildall] v3.4.2
Andrew Tridgell [Tue, 28 Apr 2026 04:29:48 +0000 (14:29 +1000)] 
Preparing for release of 3.4.2 [buildall]

3 weeks agopackaging: new release script
Andrew Tridgell [Tue, 28 Apr 2026 04:27:41 +0000 (14:27 +1000)] 
packaging: new release script

3 weeks agoupdate NEWS.md ready for 3.4.2
Andrew Tridgell [Wed, 22 Apr 2026 04:33:43 +0000 (14:33 +1000)] 
update NEWS.md ready for 3.4.2

3 weeks agopackaging: remove support for rsync-patches
Andrew Tridgell [Tue, 28 Apr 2026 02:54:31 +0000 (12:54 +1000)] 
packaging: remove support for rsync-patches

4 weeks agoDo not clean DISPLAY unconditionally
Michal Ruprich [Mon, 8 Sep 2025 07:49:22 +0000 (09:49 +0200)] 
Do not clean DISPLAY unconditionally

4 weeks agocall tzset() before chroot to cache timezone data
Andrew Tridgell [Wed, 22 Apr 2026 02:53:13 +0000 (12:53 +1000)] 
call tzset() before chroot to cache timezone data

localtime/localtime_r need /etc/localtime for timezone info.
After chroot this file is inaccessible, causing log timestamps
to fall back to UTC. Calling tzset() before chroot ensures the
timezone data is cached by glibc for subsequent calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 weeks agoUsing a correct time in log file
Michal Ruprich [Fri, 31 Jan 2025 13:35:18 +0000 (14:35 +0100)] 
Using a correct time in log file

4 weeks agorsyncd.conf: document the temp dir parameter
Andrew Tridgell [Wed, 22 Apr 2026 02:14:29 +0000 (12:14 +1000)] 
rsyncd.conf: document the temp dir parameter

The temp dir parameter was functional but undocumented in the man page.

Fixes: https://github.com/RsyncProject/rsync/issues/820
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 weeks agoruntests.py: preserve test-execution order in skipped list
Andrew Tridgell [Wed, 22 Apr 2026 02:21:48 +0000 (12:21 +1000)] 
runtests.py: preserve test-execution order in skipped list

The sorted() call reordered skipped test names alphabetically,
causing CI expected-skipped mismatches (e.g. acls,acls-default
instead of acls-default,acls). Sort by original test order instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 weeks agoruntests.py: add -j/--parallel option for parallel test execution
Andrew Tridgell [Wed, 22 Apr 2026 02:07:31 +0000 (12:07 +1000)] 
runtests.py: add -j/--parallel option for parallel test execution

Add parallel test execution using concurrent.futures. With -j8 the
test suite completes in ~4s vs ~29s sequential (~7x speedup).

Also fix two issues that caused failures under parallel execution:
- rsync_ls_lR now prunes testtmp/ so parallel tests don't see each
  other's temp files when scanning the source tree
- clean-fname-underflow.test now uses $scratchdir instead of /tmp

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 weeks agoreplace runtests.sh with runtests.py
Andrew Tridgell [Wed, 22 Apr 2026 01:45:24 +0000 (11:45 +1000)] 
replace runtests.sh with runtests.py

Rewrite the test runner in Python with proper command-line options
including --valgrind which directs valgrind output to per-process
log files so it doesn't interfere with test output comparisons.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 weeks agoFix glibc-2.43 constness warnings
Holger Hoffstätte [Sun, 5 Apr 2026 22:44:02 +0000 (00:44 +0200)] 
Fix glibc-2.43 constness warnings

Glibc 2.43 added C23 const-preserving overloads to various string functions,
which change the return type depending on the constness of the argument(s).
Currently this leads to warnings from calls to strtok() or strchr().
Fix this by properly declaring the respective variable types.

Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
4 weeks agozero all new memory from allocations
Andrew Tridgell [Wed, 22 Apr 2026 00:59:11 +0000 (10:59 +1000)] 
zero all new memory from allocations

Change my_alloc() to use calloc instead of malloc so all fresh
allocations return zeroed memory. Also zero the expanded portion
in expand_item_list() after realloc, since it knows both old and
new sizes. This gives more predictable behaviour in case of bugs
where uninitialised or stale memory is accidentally accessed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 weeks agoxattrs: fixed count in qsort
Andrew Tridgell [Tue, 21 Apr 2026 23:57:45 +0000 (09:57 +1000)] 
xattrs: fixed count in qsort

this fixes the count passed to the sort of the xattr list. This issue
was reported here:

https://www.openwall.com/lists/oss-security/2026/04/16/2

the bug is not exploitable due to the fork-per-connection design of
rsync, the attack is the equivalent of the user closing the socket
themselves.

5 weeks agofix signed integer overflow in proxy protocol v2 header parsing
Andrew Tridgell [Thu, 16 Apr 2026 00:50:49 +0000 (10:50 +1000)] 
fix signed integer overflow in proxy protocol v2 header parsing

The len field in the proxy v2 header was declared as signed char,
allowing a negative size to bypass the validation check and cause
a stack buffer overflow when passed to read_buf() as size_t.

This bug was reported by John Walker from ZeroPath, many thanks for
the clear report!

With the current code this bug does not represent a security issue as
it only results in the exit of the forked process that is specific to
the attached client, so it is equivalent to the client closing the
socket, so no CVE for this, but it is good to fix it to prevent a
future issue.

5 weeks agozlib: convert K&R function definitions to ANSI style
Andrew Tridgell [Thu, 16 Apr 2026 03:40:59 +0000 (13:40 +1000)] 
zlib: convert K&R function definitions to ANSI style

The bundled zlib 1.2.8 used K&R-style function definitions which are
rejected by clang 16+ as hard errors. Convert all 90 functions across
9 files to ANSI-style prototypes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 months agoCI: add simd-checksum to expected-skipped on macOS and Cygwin
Andrew Tridgell [Sun, 1 Mar 2026 22:35:09 +0000 (09:35 +1100)] 
CI: add simd-checksum to expected-skipped on macOS and Cygwin

The new simd-checksum test is skipped on platforms where SIMD
instructions are unavailable (macOS ARM, Cygwin). Add it to the
RSYNC_EXPECT_SKIPPED lists so CI doesn't fail on the mismatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 months agofix uninitialized mul_one in AVX2 checksum and add SIMD checksum test
Andrew Tridgell [Sat, 28 Feb 2026 21:42:04 +0000 (08:42 +1100)] 
fix uninitialized mul_one in AVX2 checksum and add SIMD checksum test

The AVX2 get_checksum1_avx2_64() read mul_one before initializing it,
which is undefined behavior. Replace the cmpeq/abs trick with
_mm256_set1_epi8(1) to match the SSSE3 and SSE2 versions.

Add a TEST_SIMD_CHECKSUM1 test mode that verifies all SIMD paths
(SSE2, SSSE3, AVX2, and the full dispatch chain) produce identical
results to the C reference, across multiple buffer sizes with both
aligned and unaligned buffers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 months agoacl: fixed ACL ID mapping for non-root
Andrew Tridgell [Mon, 19 Jan 2026 00:14:40 +0000 (11:14 +1100)] 
acl: fixed ACL ID mapping for non-root

closes issue #618

4 months agoCI: fixed MacOS test
Andrew Tridgell [Tue, 30 Dec 2025 23:45:36 +0000 (10:45 +1100)] 
CI: fixed MacOS test

fixed multiple MacOS issues

4 months agoreject negative token values in compressed stream receivers
Andrew Tridgell [Tue, 30 Dec 2025 07:49:34 +0000 (18:49 +1100)] 
reject negative token values in compressed stream receivers

Validate that token numbers read from compressed streams are
non-negative. A negative token value would cause the return value
of recv_*_token() to become positive, which callers interpret as
literal data length, but no data pointer is set on this code path.

While this only causes the receiver to crash (which is process-isolated
and only affects the attacker's own connection), it's still undefined
behavior.

Reported-by: Will Sergeant <wlsergeant@gmail.com>
4 months agoutil: fixed issue in clean_fname()
Andrew Tridgell [Sat, 23 Aug 2025 09:14:59 +0000 (19:14 +1000)] 
util: fixed issue in clean_fname()

fixes buffer underflow (not exploitable) in clean_fname

4 months agotestsuite: added clean-fname-underflow test
Andrew Tridgell [Sat, 23 Aug 2025 08:29:06 +0000 (18:29 +1000)] 
testsuite: added clean-fname-underflow test

4 months agofix uninitialized buf1 in get_checksum2() MD4 path
Andrew Tridgell [Tue, 30 Dec 2025 05:21:41 +0000 (16:21 +1100)] 
fix uninitialized buf1 in get_checksum2() MD4 path

The static buf1 pointer was only allocated when len > len1, but on
first call with len == 0, this condition is false (0 > 0), leaving
buf1 NULL when passed to memcpy().

Fixes #673

4 months agorsync: Add missing `dirs` long option
Nebojša Cvetković [Tue, 25 Nov 2025 13:30:46 +0000 (13:30 +0000)] 
rsync: Add missing `dirs` long option

8 months agofixed an invalid access to files array
Andrew Tridgell [Sat, 23 Aug 2025 07:26:53 +0000 (17:26 +1000)] 
fixed an invalid access to files array

this was found by Calum Hutton from Rapid7. It is a real bug, but
analysis shows it can't be leverged into an exploit. Worth fixing
though.

Many thanks to Calum and Rapid7 for finding and reporting this

8 months agooptions.c: Fix segv if poptGetContext returns NULL
Ronnie Sahlberg [Thu, 30 Jan 2025 03:27:38 +0000 (13:27 +1000)] 
options.c: Fix segv if poptGetContext returns NULL

If poptGetContext returns NULL, perhaps due to OOM,
a NULL pointer is passed into poptReadDefaultConfig()
which in turns SEGVs when trying to dereference it.

This was found using https://github.com/sahlberg/malloc-fail-tester.git
$ ./test_malloc_failure.sh rsync -Pav crash crosh

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
8 months agosyscall: fix a Y2038 bug by replacing Int32x32To64 with multiplication
Silent [Mon, 13 Jan 2025 14:01:06 +0000 (15:01 +0100)] 
syscall: fix a Y2038 bug by replacing Int32x32To64 with multiplication

Int32x32To64 macro internally truncates the arguments to int32,
while time_t is 64-bit on most/all modern platforms.
Therefore, usage of this macro creates a Year 2038 bug.

8 months agoIgnore `directory has vanished` errors.
Jeremy Norris [Wed, 12 Mar 2025 15:09:57 +0000 (10:09 -0500)] 
Ignore `directory has vanished` errors.

8 months agomake lots of global variables `const`
Max Kellermann [Tue, 25 Mar 2025 14:13:43 +0000 (15:13 +0100)] 
make lots of global variables `const`

This way, they can live in `.rodata` and the compiler is allowed to do
certain optimizations.

8 months agoFix handling of objects with many xattrs on FreeBSD
Peter Eriksson [Tue, 13 May 2025 12:01:01 +0000 (14:01 +0200)] 
Fix handling of objects with many xattrs on FreeBSD

8 months agochore: gitignore MacOS debug symbols
Rahul Mehta [Thu, 22 May 2025 07:47:36 +0000 (03:47 -0400)] 
chore: gitignore MacOS debug symbols

8 months agoAllow `ls(1)` to fail in test setup
Emily [Tue, 5 Aug 2025 14:55:24 +0000 (15:55 +0100)] 
Allow `ls(1)` to fail in test setup

This can happen when the tests are unable to `stat(2)` some files in
`/etc`, `/bin`, or `/`, due to Unix permissions or other sandboxing. We
still guard against serious errors, which use exit code 2.

8 months agofixed remove multiple leading slashes
fbuescher [Wed, 11 Jun 2025 07:27:59 +0000 (09:27 +0200)] 
fixed remove multiple leading slashes

8 months agobool is a keyword in C23
Michal Ruprich [Fri, 17 Jan 2025 11:37:57 +0000 (12:37 +0100)] 
bool is a keyword in C23

8 months agoconfigure.ac: check for xattr support both in libc and in -lattr
Eli Schwartz [Tue, 22 Apr 2025 20:17:55 +0000 (16:17 -0400)] 
configure.ac: check for xattr support both in libc and in -lattr

In 2015, the attr/xattr.h header was fully removed from upstream attr.

In 2020, rsync started preferring the standard header, if it exists:
https://github.com/RsyncProject/rsync/pull/22

But the fix was incomplete. We still looked for the getxattr function in
-lattr, and used it if -lattr exists. This was the case even if the
system libc was sufficient to provide the needed functions. Result:
overlinking to -lattr, if it happened to be installed for any other
reason.

```
checking whether to support extended attributes... Using Linux xattrs
checking for getxattr in -lattr... yes
```

Instead, use a different autoconf macro that first checks if the
function is available for use without any libraries (e.g. it is in
libc).

Result:

```
checking whether to support extended attributes... Using Linux xattrs
checking for library containing getxattr... none required
```

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
8 months agofeat: add compress threads to man page
Ethan Halsall [Sat, 24 Dec 2022 23:43:09 +0000 (17:43 -0600)] 
feat: add compress threads to man page

8 months agofeat: validate compress threads option
Ethan Halsall [Sat, 24 Dec 2022 23:42:47 +0000 (17:42 -0600)] 
feat: validate compress threads option

8 months agofeat: add threads to zstd compression
Ethan Halsall [Fri, 23 Dec 2022 22:22:44 +0000 (16:22 -0600)] 
feat: add threads to zstd compression

8 months agoFix flaky hardlinks test
Arnaud Rebillout [Thu, 6 Mar 2025 03:54:05 +0000 (10:54 +0700)] 
Fix flaky hardlinks test

The test was added in dc34990, it turns out that it's flaky. It failed
once on the Debian build infra, cf. [1].

The problem is that the command `rsync -aH '$fromdir/sym' '$todir'`
updates the mod time of `$todir`, so there might be a diff between the
output of `rsync_ls_lR $fromdir` and `rsync_ls_lR $todir`, if ever rsync
runs 1 second (or more) after the directories were created.

To clarify: it's easy to make the test fails 100% of the times with this
change:

```
 makepath "$fromdir/sym" "$todir"
+sleep 5
 checkit "$RSYNC -aH '$fromdir/sym' '$todir'" "$fromdir" "$todir"
```

With the fix proposed here, we don't use `checkit` anymore, instead we
just run the rsync command, then a simple `diff` to compare the two
directories. This is exactly what the other `-H` test just above does.

In case there's some doubts, `diff` fails if `sym` is missing:

```
$ mkdir -p foo/sym bar
$ diff foo bar || echo KO!
Only in foo: sym
KO!
```

I tested that, after this commit, the test still catches the `-H`
regression in rsync 3.4.0.

Fixes: https://github.com/RsyncProject/rsync/issues/735
[1]: https://buildd.debian.org/status/fetch.php?pkg=rsync&arch=ppc64el&ver=3.4.1%2Bds1-1&stamp=1741147156&raw=0

8 months agoFix --open-noatime option not working on files
Krzysztof Płocharz [Mon, 27 Jan 2025 16:20:47 +0000 (17:20 +0100)] 
Fix --open-noatime option not working on files

atime of source files could sometimes be overwritten
even though --open-noatime option was used.

To fix that, optional O_NOATIME flag was added
to do_open_nofollow which is also used to open regular
files since fix:
  "fixed symlink race condition in sender"
Previously optional O_NOATIME flag was only in do_open.

8 months agoMake the build reproducible
Chris Lamb [Tue, 12 Aug 2025 19:23:59 +0000 (20:23 +0100)] 
Make the build reproducible

From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093201:
Whilst working on the Reproducible Builds effort [0], we noticed that
rsync could not be built reproducibly.

This is because the date in the manual page can vary depending on
whether there is a .git directory and the modification time of version.h
and Mafile, which might get modified when patching via quilt.

A patch is attached that makes this use SOURCE_DATE_EPOCH, which
will always be reliable.

15 months agoTest on ubuntu-latest.
Wayne Davison [Tue, 11 Feb 2025 21:37:12 +0000 (13:37 -0800)] 
Test on ubuntu-latest.

16 months agopopt: remove obsolete findme.c & findme.h
Alan Coopersmith [Wed, 15 Jan 2025 21:17:38 +0000 (13:17 -0800)] 
popt: remove obsolete findme.c & findme.h

popt 1.14 merged these into popt.c but the import into rsync
missed removing them.

Fixes: https://github.com/RsyncProject/rsync/issues/710
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
16 months agoUpdate MAINTAINER_TZ_OFFSET on release.
Wayne Davison [Thu, 16 Jan 2025 07:24:26 +0000 (23:24 -0800)] 
Update MAINTAINER_TZ_OFFSET on release.

This also fixes a string with \s that wasn't a r'...' string.

16 months agoFix python deprecation warning.
Wayne Davison [Thu, 16 Jan 2025 06:36:29 +0000 (22:36 -0800)] 
Fix python deprecation warning.

16 months agoDon't edit copyright year values anymore.
Wayne Davison [Thu, 16 Jan 2025 06:29:17 +0000 (22:29 -0800)] 
Don't edit copyright year values anymore.

16 months agoImprove interior dashes in long options.
Wayne Davison [Thu, 16 Jan 2025 06:19:33 +0000 (22:19 -0800)] 
Improve interior dashes in long options.

Improve the backslash-adding code in md-convert to affect dashes in the
interior of long options.  Perhaps fixes #686.

16 months agoStart 3.4.2dev going.
Wayne Davison [Thu, 16 Jan 2025 06:01:42 +0000 (22:01 -0800)] 
Start 3.4.2dev going.

16 months agofixed build error on ia64 NonStop
Andrew Tridgell [Wed, 15 Jan 2025 21:17:30 +0000 (08:17 +1100)] 
fixed build error on ia64 NonStop

it treats missing prototype as an error, not warning

16 months agoPreparing for release of 3.4.1 [buildall] v3.4.1
Andrew Tridgell [Wed, 15 Jan 2025 20:49:23 +0000 (07:49 +1100)] 
Preparing for release of 3.4.1 [buildall]

16 months agoupdate NEWS.md for 3.4.1
Andrew Tridgell [Wed, 15 Jan 2025 20:37:28 +0000 (07:37 +1100)] 
update NEWS.md for 3.4.1

16 months agopopt: remove dependency on alloca
Andrew Tridgell [Wed, 15 Jan 2025 20:09:12 +0000 (07:09 +1100)] 
popt: remove dependency on alloca

16 months agoFix build on ancient glibc without openat(AT_FDCWD
Natanael Copa [Wed, 15 Jan 2025 14:59:17 +0000 (15:59 +0100)] 
Fix build on ancient glibc without openat(AT_FDCWD

Fixes: https://github.com/RsyncProject/rsync/issues/701
16 months agoTest send a single directory with -H enabled
Rodrigo OSORIO [Wed, 15 Jan 2025 09:32:48 +0000 (10:32 +0100)] 
Test send a single directory with -H enabled

Ensure this still working after 3.4.0 breakage

https://github.com/RsyncProject/rsync/issues/702

16 months agoFix use-after-free in generator
Natanael Copa [Wed, 15 Jan 2025 14:48:04 +0000 (15:48 +0100)] 
Fix use-after-free in generator

full_fname() will free the return value in the next call so we need to
duplicate it before passing it to rsyserr.

Fixes: https://github.com/RsyncProject/rsync/issues/704
16 months agoFix FLAG_GOT_DIR_FLIST collission with FLAG_HLINKED
Natanael Copa [Wed, 15 Jan 2025 14:10:24 +0000 (15:10 +0100)] 
Fix FLAG_GOT_DIR_FLIST collission with FLAG_HLINKED

fixes commit 688f5c379a43 (Refuse a duplicate dirlist.)

Fixes: https://github.com/RsyncProject/rsync/issues/702
Fixes: https://github.com/RsyncProject/rsync/issues/697
16 months agoupdate maintainer address
Andrew Tridgell [Tue, 14 Jan 2025 21:20:12 +0000 (08:20 +1100)] 
update maintainer address

use rsync.project@gmail.com

16 months agoForce rsync group when uploading files.
Wayne Davison [Tue, 14 Jan 2025 21:09:33 +0000 (13:09 -0800)] 
Force rsync group when uploading files.

16 months agoPreparing for release of 3.4.0 [buildall] v3.4.0
Andrew Tridgell [Tue, 14 Jan 2025 18:53:23 +0000 (05:53 +1100)] 
Preparing for release of 3.4.0 [buildall]

16 months agopackaging: adjust release script
Andrew Tridgell [Tue, 14 Jan 2025 18:50:22 +0000 (05:50 +1100)] 
packaging: adjust release script

remove auto-edit of NEWS.md

16 months agoNEWS: update protocol version table
Andrew Tridgell [Tue, 14 Jan 2025 18:41:07 +0000 (05:41 +1100)] 
NEWS: update protocol version table

16 months agoupdate NEWS for 3.4.0
Andrew Tridgell [Tue, 17 Dec 2024 22:20:33 +0000 (09:20 +1100)] 
update NEWS for 3.4.0

16 months agochange version to 3.4.0
Andrew Tridgell [Tue, 17 Dec 2024 22:08:24 +0000 (09:08 +1100)] 
change version to 3.4.0

16 months agoraise protocol version to 32
Andrew Tridgell [Tue, 10 Dec 2024 02:34:01 +0000 (13:34 +1100)] 
raise protocol version to 32

make it easier to spot unpatched servers

16 months agofixed symlink race condition in sender
Andrew Tridgell [Tue, 17 Dec 2024 21:59:42 +0000 (08:59 +1100)] 
fixed symlink race condition in sender

when we open a file that we don't expect to be a symlink use
O_NOFOLLOW to prevent a race condition where an attacker could change
a file between being a normal file and a symlink

16 months agomake --safe-links stricter
Andrew Tridgell [Sat, 23 Nov 2024 04:15:53 +0000 (15:15 +1100)] 
make --safe-links stricter

when --safe-links is used also reject links where a '../' component is
included in the destination as other than the leading part of the
filename

16 months agorange check dir_ndx before use
Andrew Tridgell [Tue, 26 Nov 2024 05:12:45 +0000 (16:12 +1100)] 
range check dir_ndx before use

16 months agoRefuse a duplicate dirlist.
Wayne Davison [Thu, 14 Nov 2024 23:46:50 +0000 (15:46 -0800)] 
Refuse a duplicate dirlist.

16 months agodisallow ../ elements in relpath for secure_relative_open
Andrew Tridgell [Mon, 25 Nov 2024 22:16:31 +0000 (09:16 +1100)] 
disallow ../ elements in relpath for secure_relative_open

16 months agoreceiver: use secure_relative_open() for basis file
Andrew Tridgell [Sat, 23 Nov 2024 01:28:13 +0000 (12:28 +1100)] 
receiver: use secure_relative_open() for basis file

this prevents attacks where the basis file is manipulated by a
malicious sender to gain information about files outside the
destination tree

16 months agoadded secure_relative_open()
Andrew Tridgell [Sat, 23 Nov 2024 01:26:10 +0000 (12:26 +1100)] 
added secure_relative_open()

this is an open that enforces no symlink following for all path
components in a relative path

16 months agorefuse fuzzy options when fuzzy not selected
Andrew Tridgell [Sat, 23 Nov 2024 00:08:03 +0000 (11:08 +1100)] 
refuse fuzzy options when fuzzy not selected

this prevents a malicious server providing a file to compare to when
the user has not given the fuzzy option

16 months agoprevent information leak off the stack
Andrew Tridgell [Wed, 13 Nov 2024 22:57:08 +0000 (09:57 +1100)] 
prevent information leak off the stack

prevent leak of uninitialised stack data in hash_search

17 months agohlink: Fix function pointer cast in qsort()
Charalampos Mitrodimas [Wed, 20 Nov 2024 12:55:50 +0000 (14:55 +0200)] 
hlink: Fix function pointer cast in qsort()

Replace unsafe generic function pointer cast with proper type cast for
qsort() comparison function. This fixes a potential type mismatch
warning without changing the behavior.

Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>