Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
1e4a52e
vfs: scaffold the virtual-filesystem layer
tridge Jun 21, 2026
366bbf6
vfs: move the dirstack path-walk primitives into vfs/dirstack.c
tridge Jun 21, 2026
e1b4784
vfs: move the secure path resolver into vfs/secure_open.c
tridge Jun 21, 2026
b5d30f9
vfs: move the operator-path ownership walk into vfs/owner_walk.c
tridge Jun 21, 2026
a5f52ee
vfs: move the held-dirfd cache into vfs/dircache.c
tridge Jun 21, 2026
db6c5ac
vfs: tidy comments and drop unused externs after the core move
tridge Jun 21, 2026
a76ef87
vfs: fold the dirfd cache statics into struct vfs
tridge Jun 21, 2026
540245f
vfs: fold curr_dir/curr_dir_len into struct vfs
tridge Jun 21, 2026
48250ed
vfs: fold operator_path_resolve into struct vfs
tridge Jun 21, 2026
ad5c09a
vfs: move the stat family into vfs/stat.c
tridge Jun 21, 2026
02ea67a
vfs: move the rename family into vfs/rename.c
tridge Jun 21, 2026
7f03474
vfs: move the unlink/rmdir family into vfs/unlink.c
tridge Jun 21, 2026
e84b935
vfs: move the open family into vfs/open.c
tridge Jun 21, 2026
07dd81b
vfs: move the chmod family into vfs/chmod.c
tridge Jun 21, 2026
e76b927
vfs: move the symlink/readlink family into vfs/symlink.c
tridge Jun 21, 2026
c6e8648
vfs: move the link family into vfs/link.c
tridge Jun 21, 2026
26236b1
vfs: move the mkdir/mkstemp family into vfs/mkdir.c
tridge Jun 21, 2026
546e04b
vfs: move the lchown family into vfs/chown.c
tridge Jun 21, 2026
951489d
vfs: move the mknod family into vfs/mknod.c
tridge Jun 21, 2026
7f2ebc5
vfs: move the times family into vfs/times.c
tridge Jun 21, 2026
2341b7b
vfs: move the file-data ops into vfs/fileio.c
tridge Jun 21, 2026
7c15f78
vfs: restore platform includes in vfs/chmod.c
tridge Jun 21, 2026
94fa51b
vfs: remove the now-empty syscall.c
tridge Jun 21, 2026
b441787
vfs: document the layer contract in vfs/vfs.h
tridge Jun 21, 2026
068c086
vfs: snapshot the daemon module root into struct vfs
tridge Jun 21, 2026
230d25b
vfs: thread the operator context into abspath_excluded_by_module
tridge Jun 21, 2026
e34177b
vfs: unify the mkdir family into vfs_mkdir(dirfd, path, mode, flags)
tridge Jun 21, 2026
31c3b8f
vfs: unify the mknod family into vfs_mknod(dirfd, path, mode, dev, fl…
tridge Jun 21, 2026
6e30517
vfs: unify the symlink family into vfs_symlink(lnk, dirfd, path, flags)
tridge Jun 21, 2026
056a9fe
vfs: move make_path into the VFS compound layer as vfs_make_path
tridge Jun 21, 2026
1695148
vfs: move copy_file + robust_unlink/rename into the VFS compound layer
tridge Jun 21, 2026
cbe4ae7
gitignore: ignore the vfs test binaries
tridge Jun 21, 2026
ae81947
vfs: flag vfs_open_at + thread vfs_flags through copy_file's dest open
tridge Jun 21, 2026
e12eb04
vfs: unify the unlink/rmdir family + flag robust_unlink
tridge Jun 21, 2026
d037014
vfs: flag vfs_rename_at + retire three operator-path blocks
tridge Jun 21, 2026
c89283a
vfs: fix stale comment in unlink_and_reopen (robust_unlink now flagged)
tridge Jun 21, 2026
5c97ad3
vfs: flag vfs_open_owner_walk + secure_basis_open; retire two more bl…
tridge Jun 21, 2026
4a0f20f
vfs: flag vfs_link_at + thread hard_link_one; retire the hard-link block
tridge Jun 22, 2026
871d197
vfs: thread the operator flag through stat/lstat + x_stat/x_lstat
tridge Jun 22, 2026
b226005
vfs: delete the operator_path_resolve global
tridge Jun 22, 2026
f436561
vfs: fix the !SUPPORT_XATTRS x_stat/x_lstat macros for the vfs_flags arg
tridge Jun 22, 2026
1214c4a
vfs: unify stat/lstat, chmod, lchown into dirfd+flags form
tridge Jun 22, 2026
b61342e
vfs: docs pass for the unified dirfd+flags API
tridge Jun 22, 2026
af68dac
vfs: update the !SUPPORT_XATTRS x_stat/x_lstat macros for the unified…
tridge Jun 22, 2026
18e30dd
vfs: codex review fixes for the unified stat/chmod/lchown
tridge Jun 22, 2026
e0f2f52
vfs: adapt the merged-in base changes to the VFS layer
tridge Jun 22, 2026
fbfa40f
vfs: port 37dbb263's operator-path mknod FIFO/socket fallback
tridge Jun 24, 2026
4099664
vfs: round-3 operator-path reconciliation (snap to merge oracle)
tridge Jun 27, 2026
139c305
delete: confine the backup-tree unlink via the operator ownership walk
tridge Jun 27, 2026
6212236
vfs: split two-path ops to per-operand policy flags (rename/link)
tridge Jun 27, 2026
955115c
testsuite: per-operand policy regression for vfs_rename_at (PR #30)
tridge Jun 27, 2026
eab19ec
rsync: never path-resolve a confined receiver's xattr/ACL write (copy…
tridge Jun 27, 2026
5210c5f
vfs: review fixes
tridge Jun 28, 2026
531f941
vfs: add STRICT_CONFINEMENT build-time confinement assertion
tridge Jun 28, 2026
fc23ad7
rsync,generator: assert the xattr/ACL pin invariant under STRICT_CONF…
tridge Jun 28, 2026
1a8c81d
github: run the ASan suite under --enable-strict-confinement
tridge Jun 28, 2026
331188a
acls: use vfs_relpath_active in the Solaris ACL branch
tridge Jun 29, 2026
4c142f6
vfs: adapt the merged-in base changes to the VFS layer
tridge Jul 19, 2026
ea03fe0
vfs: fix the no-AT_FDCWD fallback in vfs__symlink_secure
tridge Jul 19, 2026
01e0de3
testsuite: keep daemon test ports out of the 13000+ bloatware range
tridge Jul 19, 2026
518c09f
gitignore: ignore the remaining test-helper binaries
tridge Jul 19, 2026
39c6c31
vfs: adapt the merged-in base changes to the VFS layer
tridge Jul 20, 2026
359baac
vfs: fail loud in the held-fd lstat no-AT_SYMLINK_NOFOLLOW arm; make …
tridge Jul 20, 2026
97d7cfc
vfs: adapt the merged-in base changes to the VFS layer
tridge Jul 24, 2026
fca1d10
vfs: adapt the merged-in base changes to the VFS layer
tridge Aug 2, 2026
730e619
vfs: give set_file_attrs' path-based chmod/chown the operator policy
tridge Aug 2, 2026
893e88a
testsuite: cover the backup-dir ownership set under a parent swap
tridge Aug 2, 2026
1030929
vfs: adapt the merged-in base changes to the VFS layer
tridge Aug 3, 2026
2358081
fleettest: mac2-hfs runs the backup-dir ownership race too
tridge Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/asan-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
CC=clang \
CFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer -g -O1 -DNDEBUG" \
LDFLAGS="-fsanitize=address,undefined" \
./configure --with-rrsync --disable-md2man
./configure --with-rrsync --disable-md2man --enable-strict-confinement
- name: make
# check-progs builds rsync plus the test helper programs (tls, trimslash,
# t_unsafe, ...) that runtests.py requires; plain "make" builds only rsync
Expand Down
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ aclocal.m4
/testrun
/trimslash
/t_unsafe
/wildtest
/getfsdev
/simdtest
/t_acl
/t_chmod_secure
/t_clean_fname
/t_rename_secure
/t_secure_relpath
/t_symlink_secure
/t_hashtable_overflow
/t_iwildmatch
/t_rename_secure
/t_clean_fname
/t_safe_arg
/simdtest
/wildtest
/getfsdev
/t_safe_arg_main
/t_secure_relpath
/t_symlink_secure
/rounding.h
/doc/rsync.pdf
/doc/rsync.ps
Expand Down
63 changes: 44 additions & 19 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ CXXFLAGS=@CXXFLAGS@
EXEEXT=@EXEEXT@
LDFLAGS=@LDFLAGS@
LIBOBJDIR=lib/
AR=@AR@
ARFLAGS=cr
RANLIB=@RANLIB@

INSTALLCMD=@INSTALL@
INSTALLMAN=@INSTALL@
Expand All @@ -38,23 +41,24 @@ GENFILES=configure.sh aclocal.m4 config.h.in rsync.1 rsync.1.html \
rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html \
@GEN_RRSYNC@
HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
lib/pool_alloc.h lib/mdigest.h lib/md-defines.h
lib/pool_alloc.h lib/mdigest.h lib/md-defines.h vfs/vfs.h
LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o lib/acl.o @LIBOBJS@
zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
OBJS1_NO_MAIN=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
util1.o util2.o checksum.o match.o syscall.o log.o backup.o delete.o
util1.o util2.o checksum.o match.o log.o backup.o delete.o
OBJS1=$(OBJS1_NO_MAIN) main.o
OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
OBJS3=progress.o pipe.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_ASM@
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
popt_OBJS= popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o popt/poptint.o
OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
VFS_OBJ=vfs/vfs.o vfs/dirstack.o vfs/secure_open.o vfs/owner_walk.o vfs/dircache.o vfs/stat.o vfs/rename.o vfs/unlink.o vfs/open.o vfs/chmod.o vfs/symlink.o vfs/link.o vfs/mkdir.o vfs/chown.o vfs/mknod.o vfs/times.o vfs/fileio.o vfs/make_path.o vfs/copy_file.o vfs/robust.o
OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@ libvfs.a

TLS_OBJ = tls.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
TLS_OBJ = tls.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@ libvfs.a

# Programs we must have to run the test cases
CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
Expand All @@ -67,7 +71,7 @@ CHECK_SYMLINKS = testsuite/chown-fake_test.py testsuite/devices-fake_test.py \
# Objects for CHECK_PROGS to clean
CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o t_chmod_secure.o t_rename_secure.o t_symlink_secure.o t_secure_relpath.o t_acl.o t_hashtable_overflow.o t_iwildmatch.o t_clean_fname.o t_safe_arg.o trimslash.o wildtest.o
# Compile-only feature-shape checks.
CHECK_COMPILE_OBJS=syscall-no-at-fdcwd.o
CHECK_COMPILE_OBJS=vfs-no-at-fdcwd.o

# note that the -I. is needed to handle config.h when using VPATH
.c.o:
Expand All @@ -80,9 +84,20 @@ CHECK_COMPILE_OBJS=syscall-no-at-fdcwd.o
all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_RRSYNC@ @MAKE_MAN@
.PHONY: all

syscall-no-at-fdcwd.o: syscall.c $(HEADERS)
$(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) \
-DRSYNC_TEST_NO_AT_FDCWD -c $(srcdir)/syscall.c -o $@
# Compile-check the pre-*at() portability tier. syscall.c's *at wrappers were
# split into vfs/, so compile every vfs source with the AT_FDCWD primitives
# undefined (via vfs/vfs_internal.h's RSYNC_TEST_NO_AT_FDCWD block) and confirm
# the fallback arms still build. A shell loop keeps this portable (BSD/Solaris
# make have no pattern rules); the last object compiled is left as the target.
# $(VFS_OBJ:.o=.c) is POSIX suffix substitution, portable across makes.
vfs-no-at-fdcwd.o: $(VFS_OBJ:.o=.c) $(HEADERS) vfs/vfs.h vfs/vfs_internal.h
@rm -f $@ $@.tmp
@for f in $(VFS_OBJ:.o=.c); do \
echo " no-AT_FDCWD compile-check: $$f"; \
$(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) \
-DRSYNC_TEST_NO_AT_FDCWD -c $(srcdir)/$$f -o $@.tmp || exit 1; \
done
@mv $@.tmp $@

.PHONY: install
install: all
Expand Down Expand Up @@ -141,7 +156,17 @@ rrsync: support/rrsync

$(OBJS): $(HEADERS)
$(CHECK_OBJS): $(HEADERS)
$(VFS_OBJ): $(HEADERS)
$(VFS_OBJ): vfs/vfs_internal.h
tls.o xattrs.o: lib/sysxattrs.h

# The VFS layer is bundled into a static archive linked last on every target so
# that moving a filesystem family between files never breaks a test harness link
# (the linker pulls only the members each program references).
libvfs.a: $(VFS_OBJ)
rm -f $@
$(AR) $(ARFLAGS) $@ $(VFS_OBJ)
$(RANLIB) $@
usage.o: version.h latest-year.h help-rsync.h help-rsyncd.h git-version.h default-cvsignore.h
loadparm.o: default-dont-compress.h daemon-parm.h

Expand Down Expand Up @@ -202,23 +227,23 @@ getgroups$(EXEEXT): getgroups.o
getfsdev$(EXEEXT): getfsdev.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)

TRIMSLASH_OBJ = trimslash.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o
TRIMSLASH_OBJ = trimslash.o util2.o t_stub.o lib/compat.o lib/snprintf.o libvfs.a
trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)

T_UNSAFE_OBJ = t_unsafe.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
T_UNSAFE_OBJ = t_unsafe.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o libvfs.a
t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)

T_HASHTABLE_OVERFLOW_OBJ = t_hashtable_overflow.o hashtable.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
T_HASHTABLE_OVERFLOW_OBJ = t_hashtable_overflow.o hashtable.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o libvfs.a
t_hashtable_overflow$(EXEEXT): $(T_HASHTABLE_OVERFLOW_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_HASHTABLE_OVERFLOW_OBJ) $(LIBS)

T_IWILDMATCH_OBJ = t_iwildmatch.o lib/wildmatch.o
t_iwildmatch$(EXEEXT): $(T_IWILDMATCH_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_IWILDMATCH_OBJ) $(LIBS)

T_CLEAN_FNAME_OBJ = t_clean_fname.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
T_CLEAN_FNAME_OBJ = t_clean_fname.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o libvfs.a
t_clean_fname$(EXEEXT): $(T_CLEAN_FNAME_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_CLEAN_FNAME_OBJ) $(LIBS)

Expand All @@ -231,23 +256,23 @@ t_clean_fname$(EXEEXT): $(T_CLEAN_FNAME_OBJ)
# GNU-make-only; BSD and Solaris make expand it to nothing.
t_safe_arg_main.o: main.c $(HEADERS)
$(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -Dmain=rsync_unused_main -c $(srcdir)/main.c -o t_safe_arg_main.o
T_SAFE_ARG_OBJ = t_safe_arg.o t_safe_arg_main.o $(OBJS1_NO_MAIN) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
T_SAFE_ARG_OBJ = t_safe_arg.o t_safe_arg_main.o $(OBJS1_NO_MAIN) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@ libvfs.a
t_safe_arg$(EXEEXT): $(T_SAFE_ARG_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_SAFE_ARG_OBJ) $(LIBS)

T_CHMOD_SECURE_OBJ = t_chmod_secure.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
T_CHMOD_SECURE_OBJ = t_chmod_secure.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o libvfs.a
t_chmod_secure$(EXEEXT): $(T_CHMOD_SECURE_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_CHMOD_SECURE_OBJ) $(LIBS)

T_RENAME_SECURE_OBJ = t_rename_secure.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
T_RENAME_SECURE_OBJ = t_rename_secure.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o libvfs.a
t_rename_secure$(EXEEXT): $(T_RENAME_SECURE_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_RENAME_SECURE_OBJ) $(LIBS)

T_SYMLINK_SECURE_OBJ = t_symlink_secure.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
T_SYMLINK_SECURE_OBJ = t_symlink_secure.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o libvfs.a
t_symlink_secure$(EXEEXT): $(T_SYMLINK_SECURE_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_SYMLINK_SECURE_OBJ) $(LIBS)

T_SECURE_RELPATH_OBJ = t_secure_relpath.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
T_SECURE_RELPATH_OBJ = t_secure_relpath.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o libvfs.a
t_secure_relpath$(EXEEXT): $(T_SECURE_RELPATH_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_SECURE_RELPATH_OBJ) $(LIBS)

Expand Down Expand Up @@ -348,10 +373,10 @@ rrsync.1: support/rrsync.1.md md-convert Makefile

.PHONY: clean
clean: cleantests
rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS) @MAKE_RRSYNC@ \
rm -f *~ $(OBJS) $(VFS_OBJ) libvfs.a $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_COMPILE_OBJS) $(CHECK_COMPILE_OBJS:.o=.o.tmp) $(CHECK_SYMLINKS) @MAKE_RRSYNC@ \
git-version.h rounding rounding.h *.old rsync*.1 rsync*.5 @MAKE_RRSYNC_1@ \
*.html daemon-parm.h help-*.h default-*.h proto.h proto.h-tstamp
rm -f *.gcno *.gcda lib/*.gcno lib/*.gcda zlib/*.gcno zlib/*.gcda popt/*.gcno popt/*.gcda
rm -f *.gcno *.gcda lib/*.gcno lib/*.gcda zlib/*.gcno zlib/*.gcda popt/*.gcno popt/*.gcda vfs/*.gcno vfs/*.gcda
rm -rf coverage coverage-tcp coverage-all coverage-fallback

.PHONY: cleantests
Expand Down
4 changes: 2 additions & 2 deletions acls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ static int set_rsync_acl(int fd, int dirfd, const char *leaf, const char *fname,
* the legacy path fallback (op_pin am_root != 0 rule). */
if (fd >= 0)
rc = sys_acl_delete_def_fd(fd);
else if (secure_relpath_active() && am_root) {
else if (vfs_relpath_active() && am_root) {
errno = ELOOP;
rc = -1;
} else
Expand Down Expand Up @@ -1334,7 +1334,7 @@ static int set_rsync_acl(int fd, int dirfd, const char *leaf, const char *fname,
sxp->st.st_mode = cur_mode;
return 0;
}
if (secure_relpath_active() && am_root) {
if (vfs_relpath_active() && am_root) {
/* Real root always can open its own freshly-staged reg/dir/fifo leaf,
* so a missing held fd on a confined receiver means the leaf was raced
* to a symlink; sys_acl_set_file() follows the leaf, so refuse rather
Expand Down
10 changes: 5 additions & 5 deletions authenticate.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static const char *check_secret(int module, const char *user, const char *group,
if (!fname || !*fname)
return "no secrets file";
{
int fd = open_no_attacker_symlinks(fname, O_RDONLY, 0);
int fd = vfs_open_owner_walk(fname, O_RDONLY, 0, 0);
if (fd < 0)
return "no secrets file";
fh = fdopen(fd, "r");
Expand All @@ -166,7 +166,7 @@ static const char *check_secret(int module, const char *user, const char *group,
}
}

if (do_fstat(fileno(fh), &st) == -1) {
if (vfs_fstat(fileno(fh), &st) == -1) {
rsyserr(FLOG, errno, "fstat(%s)", fname);
ok = 0;
} else if (lp_strict_modes(module)) {
Expand Down Expand Up @@ -239,10 +239,10 @@ static const char *getpassf(const char *filename)

/* --password-file=PATH client open. Its first line is sent as the
* auth response, so a planted symlink leaks the target's content
* (e.g. shadow hashes) to a malicious daemon; the do_stat()
* (e.g. shadow hashes) to a malicious daemon; the vfs_stat()
* other-access check runs on the target mode and passes 0640
* root:shadow. Refuse symlinks not owned by uid 0 or our euid. */
if ((fd = open_no_attacker_symlinks(filename, O_RDONLY, 0)) < 0) {
if ((fd = vfs_open_owner_walk(filename, O_RDONLY, 0, 0)) < 0) {
rsyserr(FERROR, errno, "could not open password file %s", filename);
exit_cleanup(RERR_SYNTAX);
}
Expand All @@ -252,7 +252,7 @@ static const char *getpassf(const char *filename)
* path between open and check can't make the owner/mode test
* validate a different inode than the one we read the password
* from. */
if (do_fstat(fd, &st) == -1) {
if (vfs_fstat(fd, &st) == -1) {
rsyserr(FERROR, errno, "fstat(%s)", filename);
exit_cleanup(RERR_SYNTAX);
}
Expand Down
Loading
Loading