aboutsummaryrefslogtreecommitdiff
path: root/bin/chflags/tests
Commit message (Collapse)AuthorAgeFilesLines
* chflags: use Capsicum capability modeJitendra Bhati24 hours1-0/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Run the file-hierarchy traversal inside Capsicum capability mode using the fts_openat(3) API. This confines chflags to the directory hierarchies named on the command line, so a malicious or buggy tree cannot redirect it at files elsewhere via a crafted symbolic link. Because AT_FDCWD is rejected in capability mode, a directory descriptor for the parent directory of every argument with an absolute path or a path containing ".." is opened once before cap_enter(). Once every descriptor is open, cap_enter() is called and the traversal acts through fd-relative operations: chflagsat(fts_parent->fts_dirfd, fts_name). With -L chflags follows symbolic links, which may point outside the named hierarchy; chflag now rejects such accesses. The new --dereference-links-unsafely option disables the sandbox to restore the historical behavior for the rare callers that rely on it. But if the symbolic was link was named directly on the command line, chflags will still follow it (unless -h was given). Add functional tests covering relative, absolute, "..", recursive and mixed path arguments, and the symlink handling in both the default and --dereference-links-unsafely modes; they skip on filesystems that do not support the uchg flag. Sponsored by: Google LLC (GSoC 2026) Reviewed by: asomers Relnotes: yes (for the -L behavior change) Pull Request: https://github.com/freebsd/freebsd-src/pull/2375
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-163-3/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+11
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Add basic tests for chflags, mkdir, rcp, and rmdirAlan Somers2017-09-072-0/+68
Add basic command line parsing test coverage for these utilities. The tests were automatically generated based on their man pages. These tests can be expanded by hand for more thorough coverage. The aim is to generate very basic amount of test coverage for all the utilities in the base system. Submitted by: shivansh Reviewed by: asomers, brooks MFC after: 3 weeks Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D12036 Notes: svn path=/head/; revision=323275