aboutsummaryrefslogtreecommitdiff
path: root/bin/setfacl/setfacl.c
Commit message (Collapse)AuthorAgeFilesLines
* fts_read: Handle error from a NULL return better.Bryan Drewery2020-12-081-1/+3
| | | | | | | | | | | | | | | | | | | | This is addressing cases such as fts_read(3) encountering an [EIO] from fchdir(2) when FTS_NOCHDIR is not set. That would otherwise be seen as a successful traversal in some of these cases while silently discarding expected work. As noted in r264201, fts_read() does not set errno to 0 on a successful EOF so it needs to be set before calling it. Otherwise we might see a random error from one of the iterations. gzip is ignoring most errors and could be improved separately. Reviewed by: vangyzen Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27184 Notes: svn path=/head/; revision=368467
* Don't set NFSv4 ACL inheritance flags on non-directories.Mark Johnston2018-10-261-13/+68
| | | | | | | | | | | | | | | | | They only make sense in the context of directory ACLs, and attempting to set them on regular files results in errors, causing a recursive setfacl invocation to abort. This is derived from patches by Shawn Webb <shawn.webb@hardenedbsd.org> and Mitchell Horne <mhorne063@gmail.com>. PR: 155163 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15061 Notes: svn path=/head/; revision=339793
* Don't print pathconf() errors if the target file doesn't exist.Mark Johnston2018-10-261-2/+2
| | | | | | | | | | | The subsequent acl_get_file(3) call will simply echo the same error. PR: 229930 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=339781
* Avoid leaking memory in error paths.Mark Johnston2018-10-261-10/+11
| | | | | | | | | CID: 1390906 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=339780
* setfacl: style and break main() into manageable piecesEd Maste2018-04-271-216/+233
| | | | | | | | | | Submitted by: Mitchell Horne MFC with: r332396 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15060 Notes: svn path=/head/; revision=333065
* setfacl: add recursive functionalityEd Maste2018-04-101-81/+129
| | | | | | | | | | | | | | | | | | | | | Add a -R option to setfacl to operate recursively on directories, along with the accompanying flags -H, -L, and -P (whose behaviour mimics chmod). A patch was submitted with PR 155163, but this is a new implementation based on comments raised in the Phabricator review for that patch (review D9096). PR: 155163 Submitted by: Mitchell Horne <mhorne063@gmail.com> Reviewed by: jilles MFC after: 2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14934 Notes: svn path=/head/; revision=332396
* Fix warnings found by -Wmising-variable-declarations.Ed Schouten2012-10-191-0/+29
| | | | | | | | | | | | | | This self-written compiler warning, which is hopefully going to be committed into LLVM sources soon, warns about potentially missing `static' keywords, similar to -Wmissing-prototypes. - bin/pax: Move external declaration of chdname and s_mask into extern.h. - bin/setfacl: Move setfacl.c-specific stuff out of setfacl.h. - sbin/mount_fusefs: Remove char *progname; use getprogname(). - others: add `static' where possible. Notes: svn path=/head/; revision=241720
* Make "setfacl -bd" an alias for "setfacl -k". Previously it would crashEdward Tomasz Napierala2012-09-041-0/+11
| | | | | | | | | | on assert. PR: bin/165807 MFC after: 1 month Notes: svn path=/head/; revision=240084
* Make setfacl(1) behave properly in situations like "setfacl -kd".Edward Tomasz Napierala2012-09-041-0/+15
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=240083
* Increase carried_error if we skip a file due to an error. This ensuresJaakko Heinonen2011-01-031-0/+4
| | | | | | | | | | | | that setfacl(1) exits with proper exit status on failure. PR: bin/149780 Submitted by: Ævar Arnfjörð Bjarmason (original version) Reviewed by: trasz MFC after: 3 weeks Notes: svn path=/head/; revision=216922
* Switch to our preferred license text.Joel Dahl2010-03-071-8/+8
| | | | | | | Approved by: jedgar Notes: svn path=/head/; revision=204819
* Add NFSv4 support to setfacl(1).Edward Tomasz Napierala2009-09-071-73/+118
| | | | | | | Reviewed by: rwatson Notes: svn path=/head/; revision=196936
* Fix double free in setfacl(1). Description from the author:Edward Tomasz Napierala2008-09-061-4/+6
| | | | | | | | | | | | | | | | | Initially, 'acl' (an 'acl_t *') is allocated, and its ACCESS_ACL and DEFAULT_ACL fields are passed to the 'libc' ACL routines for subsequent allocation. If the '-m' option (merge existing ACL with a new one) is specified, then 'set_acl_mask()' will be called and passed one of the two ACLs. This function, in turn, replaces this given ACL structure by another, freshly allocated. However, the pointer in the 'acl' variable in the caller is not updated. The caller then proceeds to free the ACL, incurring in a double free condition. Submitted by: Pedro Martelletto <pedro at ambientworks.net> Approved by: rwatson (mentor) Notes: svn path=/head/; revision=182813
* Implement the -h flag (set an ACL on a symbolic link).Kirk McKusick2007-02-261-4/+14
| | | | | | | | | | Before this fix the -h flag was ignored (i.e. setfacl always set the ACL on the file pointed to by the symbolic link even when the -h flag requested that the ACL be set on the symbolic link itself). Notes: svn path=/head/; revision=167000
* Copy filename read from the stdin into the private buffer. Otherwise,Konstantin Belousov2006-06-091-1/+5
| | | | | | | | | | | | next read filename overwrite previous one, resulting in acl being applied only to the last name in the list. Submitted by: Oleg Lomaka <oleg.lomaka at gmail com> MFC after: 1 week Approved by: kan (mentor) Notes: svn path=/head/; revision=159463
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-091-2/+2
| | | | Notes: svn path=/head/; revision=141578
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-101-1/+1
| | | | Notes: svn path=/head/; revision=139969
* -v no longer a valid argument to setfacl(1) -- remove from usage().Robert Watson2003-08-071-1/+1
| | | | | | | | PR: 55318 Submitted by: Grzegorz Czaplinski <G.Czaplinski@prioris.mini.pw.edu.pl> Notes: svn path=/head/; revision=118602
* When reporting an error internalizing an ACL string, print out theRobert Watson2003-07-181-2/+2
| | | | | | | | | | | ACL that generated the error, rather than the function, which is more user-friendly. Obtained from: TrustedBSD Project Product of: France Notes: svn path=/head/; revision=117734
* Add "-h" arguments to getfacl and setfacl, which behave in a mannerRobert Watson2002-12-301-5/+16
| | | | | | | | | | similar to "-h" on chown, chmod, etc, causing the operation to occur on a final symlink in the provided path, rather than its target. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=108450
* Consistently use FBSDIDDavid E. O'Brien2002-06-301-2/+3
| | | | Notes: svn path=/head/; revision=99110
* Add defines for access and default ACLs (ACCESS_ACL/DEFAULT_ACL)Chris D. Faulhaber2001-12-031-9/+9
| | | | | | | | | to enhance readability. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=87259
* style(9) cleanups mostly consisting of:Chris D. Faulhaber2001-12-031-20/+18
| | | | | | | | | | | | o explicitly check return values and variables against a value o return x; -> return (x); o fix inconsistent sysexits usage by nuking it (partially suggested by bde) Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=87254
* Silence WARNS=2 and BDECFLAGS on alpha and i386Kris Kennaway2001-05-201-1/+1
| | | | | | | MFC After: 1 week Notes: svn path=/head/; revision=76881
* o Separate acl_t into internal and external representations asChris D. Faulhaber2001-04-241-13/+13
| | | | | | | | | | | | | | required by POSIX.1e. This maintains the current 'struct acl' in the kernel while providing the generic external acl_t interface required to complete the ACL editing library. o Add the acl_get_entry() function. o Convert the existing ACL utilities, getfacl and setfacl, to fully make use of the ACL editing library. Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=75928
* o POSIX.2c Userland tool support for POSIX.1e ACLs -- getfacl retrieves ACLsRobert Watson2001-03-191-0/+254
from files and directories, and setfacl sets ACLs on files and directories. Submitted by: jedgar Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=74465