]> gitweb.michael.orlitzky.com - apply-default-acl.git/log
apply-default-acl.git
6 years agorun-tests.sh: add two tests to ensure a no-op without default ACLs.
Michael Orlitzky [Fri, 2 Mar 2018 00:25:31 +0000 (19:25 -0500)]
run-tests.sh: add two tests to ensure a no-op without default ACLs.

6 years agorun-tests.sh: add a test for the "Not a directory" error message.
Michael Orlitzky [Fri, 2 Mar 2018 00:21:16 +0000 (19:21 -0500)]
run-tests.sh: add a test for the "Not a directory" error message.

6 years agorun-tests.sh: whitespace cleanup.
Michael Orlitzky [Fri, 2 Mar 2018 00:16:05 +0000 (19:16 -0500)]
run-tests.sh: whitespace cleanup.

6 years agosrc/libadacl.c: rewrite acl_set_entry() as acl_update_entry().
Michael Orlitzky [Thu, 1 Mar 2018 23:51:58 +0000 (18:51 -0500)]
src/libadacl.c: rewrite acl_set_entry() as acl_update_entry().

It turns out we only need to update existing entries in our ACLs, to
mask the execute permissions. Since we never need to create new
entries, the name "acl_set_entry" was not quite right. The
new-entry-creation code has been removed from the bottom half of the
function, and it has been renamed to "acl_update_entry".

6 years agoEliminate the wipe_acls() function that is apparently not needed.
Michael Orlitzky [Thu, 1 Mar 2018 23:38:59 +0000 (18:38 -0500)]
Eliminate the wipe_acls() function that is apparently not needed.

6 years agosrc/libadacl.c: remove redundant empty pathname checks from safe_open().
Michael Orlitzky [Thu, 1 Mar 2018 23:20:09 +0000 (18:20 -0500)]
src/libadacl.c: remove redundant empty pathname checks from safe_open().

6 years agosrc/libadacl.c: kill a pointless "else if" after an "if" that returns.
Michael Orlitzky [Thu, 1 Mar 2018 23:19:24 +0000 (18:19 -0500)]
src/libadacl.c: kill a pointless "else if" after an "if" that returns.

6 years agoapply_default_acl_ex: don't loop through the ACL unless we're masking exec.
Michael Orlitzky [Thu, 1 Mar 2018 22:25:05 +0000 (17:25 -0500)]
apply_default_acl_ex: don't loop through the ACL unless we're masking exec.

6 years agoImprove the error message for most types of inaccessible paths.
Michael Orlitzky [Thu, 1 Mar 2018 22:15:07 +0000 (17:15 -0500)]
Improve the error message for most types of inaccessible paths.

6 years agoBail out of apply_default_acl_ex() early if the parent has no default ACL.
Michael Orlitzky [Thu, 1 Mar 2018 21:20:15 +0000 (16:20 -0500)]
Bail out of apply_default_acl_ex() early if the parent has no default ACL.

6 years agosrc/libadacl.c: don't try to close file descriptor zero.
Michael Orlitzky [Thu, 1 Mar 2018 21:12:41 +0000 (16:12 -0500)]
src/libadacl.c: don't try to close file descriptor zero.

6 years agoconfigure.ac: bump to version 0.1.5. v0.1.5
Michael Orlitzky [Thu, 1 Mar 2018 13:31:52 +0000 (08:31 -0500)]
configure.ac: bump to version 0.1.5.

6 years agoReplace all tabs with spaces. We're not animals.
Michael Orlitzky [Thu, 1 Mar 2018 13:24:38 +0000 (08:24 -0500)]
Replace all tabs with spaces. We're not animals.

6 years agoEliminate the last bit of pathname usage.
Michael Orlitzky [Wed, 28 Feb 2018 22:33:17 +0000 (17:33 -0500)]
Eliminate the last bit of pathname usage.

A lot of work has been done recently to make apply-default-acl safe
from symlink and hardlink attacks. A big part of that work was the
recent switch to using file descriptors instead of pathnames; but,
pathnames still lingered in a few places due to a shortcoming in
libacl. Through the use of a new function, acl_copy_xattr(), I've
finally eliminated those last few bits.

The apply_default_acl_ex() function now uses path names only as
arguments to safe_open(), which hopefully is safe. Afterwards, the
file descriptors obtained from safe_open() are used. Thus the hard and
symlink attacks should finally be fixed, modulo a tiny race condition
between safe_open() and fstat() that has no known solution.

These changes rely on the Linux xattr implementation and kill our
portability, but I don't think we ever had any to begin with.

6 years agosrc/libadacl.c: fix a function name inside perror output.
Michael Orlitzky [Wed, 28 Feb 2018 22:23:41 +0000 (17:23 -0500)]
src/libadacl.c: fix a function name inside perror output.

6 years agolibadacl.c: remove unused acl_get_permset() call in acl_set_entry().
Michael Orlitzky [Wed, 28 Feb 2018 22:17:59 +0000 (17:17 -0500)]
libadacl.c: remove unused acl_get_permset() call in acl_set_entry().

6 years agoconfigure.ac: bump to version 0.1.4. v0.1.4
Michael Orlitzky [Wed, 28 Feb 2018 15:07:26 +0000 (10:07 -0500)]
configure.ac: bump to version 0.1.4.

6 years agoconfigure.ac: check for the O_PATH flag in fcntl.h.
Michael Orlitzky [Wed, 28 Feb 2018 15:06:59 +0000 (10:06 -0500)]
configure.ac: check for the O_PATH flag in fcntl.h.

6 years agosrc/libadacl.c: mention the O_PATH flag in a comment.
Michael Orlitzky [Wed, 28 Feb 2018 15:06:39 +0000 (10:06 -0500)]
src/libadacl.c: mention the O_PATH flag in a comment.

6 years agoconfigure.ac: check for the O_DIRECTORY flag in fcntl.h.
Michael Orlitzky [Wed, 28 Feb 2018 14:56:59 +0000 (09:56 -0500)]
configure.ac: check for the O_DIRECTORY flag in fcntl.h.

6 years agolibadacl.c: use O_PATH in safe_open() for added safety.
Michael Orlitzky [Wed, 28 Feb 2018 14:55:25 +0000 (09:55 -0500)]
libadacl.c: use O_PATH in safe_open() for added safety.

6 years agoconfigure.ac: bump to version 0.1.3. v0.1.3
Michael Orlitzky [Tue, 27 Feb 2018 23:02:59 +0000 (18:02 -0500)]
configure.ac: bump to version 0.1.3.

6 years agoAdd various NULL pointer checks for good measure.
Michael Orlitzky [Tue, 27 Feb 2018 23:02:21 +0000 (18:02 -0500)]
Add various NULL pointer checks for good measure.

6 years agosafe_open_ex: remove redundant (pathname == NULL) check.
Michael Orlitzky [Tue, 27 Feb 2018 19:21:11 +0000 (14:21 -0500)]
safe_open_ex: remove redundant (pathname == NULL) check.

6 years agosafe_open_ex: add a comment about why O_PATH doesn't work.
Michael Orlitzky [Tue, 27 Feb 2018 19:20:33 +0000 (14:20 -0500)]
safe_open_ex: add a comment about why O_PATH doesn't work.

6 years agorun-tests.sh: add more tests for exit codes.
Michael Orlitzky [Tue, 27 Feb 2018 18:48:18 +0000 (13:48 -0500)]
run-tests.sh: add more tests for exit codes.

6 years agosrc/apply-default-acl.c: update the CLI to match documented exit codes.
Michael Orlitzky [Tue, 27 Feb 2018 18:38:23 +0000 (13:38 -0500)]
src/apply-default-acl.c: update the CLI to match documented exit codes.

6 years agoman/apply-default-acl.1: add a note about the --recursive exit codes.
Michael Orlitzky [Tue, 27 Feb 2018 18:22:51 +0000 (13:22 -0500)]
man/apply-default-acl.1: add a note about the --recursive exit codes.

6 years agorun-tests.sh: add two tests for regular file and symlink exit codes.
Michael Orlitzky [Tue, 27 Feb 2018 18:00:06 +0000 (13:00 -0500)]
run-tests.sh: add two tests for regular file and symlink exit codes.

6 years agoman/apply-default-acl.1: document the way exit codes are SUPPOSED to work.
Michael Orlitzky [Tue, 27 Feb 2018 17:59:14 +0000 (12:59 -0500)]
man/apply-default-acl.1: document the way exit codes are SUPPOSED to work.

6 years agodoc/man/apply-default-acl.1: remove superfluous line breaks.
Michael Orlitzky [Tue, 27 Feb 2018 14:52:40 +0000 (09:52 -0500)]
doc/man/apply-default-acl.1: remove superfluous line breaks.

6 years agoconfigure.ac: bump to version 0.1.2. v0.1.2
Michael Orlitzky [Tue, 27 Feb 2018 00:17:02 +0000 (19:17 -0500)]
configure.ac: bump to version 0.1.2.

6 years agosrc/libadacl.h: add missing includes for "bool" and "struct stat" types.
Michael Orlitzky [Tue, 27 Feb 2018 00:08:38 +0000 (19:08 -0500)]
src/libadacl.h: add missing includes for "bool" and "struct stat" types.

6 years agoconfigure.ac: use xz for distfiles.
Michael Orlitzky [Mon, 26 Feb 2018 22:41:42 +0000 (17:41 -0500)]
configure.ac: use xz for distfiles.

6 years agoconfigure.ac: bump to version 0.1.1. v0.1.1
Michael Orlitzky [Mon, 26 Feb 2018 22:38:05 +0000 (17:38 -0500)]
configure.ac: bump to version 0.1.1.

6 years agolibadacl: add error checking when we open() the filesystem root.
Michael Orlitzky [Mon, 26 Feb 2018 22:36:24 +0000 (17:36 -0500)]
libadacl: add error checking when we open() the filesystem root.

6 years agoconfigure.ac: bump to version 0.1.0. v0.1.0
Michael Orlitzky [Mon, 26 Feb 2018 20:00:47 +0000 (15:00 -0500)]
configure.ac: bump to version 0.1.0.

6 years agoconfigure.ac: remove pointless comment at the top of the file.
Michael Orlitzky [Mon, 26 Feb 2018 20:00:18 +0000 (15:00 -0500)]
configure.ac: remove pointless comment at the top of the file.

6 years agoconfigure.ac: add checks for openat() and O_NOFOLLOW.
Michael Orlitzky [Mon, 26 Feb 2018 19:56:00 +0000 (14:56 -0500)]
configure.ac: add checks for openat() and O_NOFOLLOW.

6 years agoconfigure.ac: add limits.h to the AC_CHECK_HEADERS list.
Michael Orlitzky [Mon, 26 Feb 2018 19:28:17 +0000 (14:28 -0500)]
configure.ac: add limits.h to the AC_CHECK_HEADERS list.

6 years agoAdd missing "flags" parameter documentation to the safe_open() functions.
Michael Orlitzky [Mon, 26 Feb 2018 18:56:36 +0000 (13:56 -0500)]
Add missing "flags" parameter documentation to the safe_open() functions.

6 years agoUpgrade our Doxyfile automatically with doxygen -u.
Michael Orlitzky [Mon, 26 Feb 2018 18:53:46 +0000 (13:53 -0500)]
Upgrade our Doxyfile automatically with doxygen -u.

6 years agoMove a few constants out of the libadacl.h header to where they are used.
Michael Orlitzky [Mon, 26 Feb 2018 18:52:27 +0000 (13:52 -0500)]
Move a few constants out of the libadacl.h header to where they are used.

6 years agolibadacl: update failure return value docs for apply_default_acl().
Michael Orlitzky [Mon, 26 Feb 2018 18:30:20 +0000 (13:30 -0500)]
libadacl: update failure return value docs for apply_default_acl().

6 years agoRename apply_default_acl() to apply_default_acl_ex() and add a wrapper.
Michael Orlitzky [Mon, 26 Feb 2018 18:27:18 +0000 (13:27 -0500)]
Rename apply_default_acl() to apply_default_acl_ex() and add a wrapper.

The old apply_default_acl() function has a weird second argument that
will usually be NULL for other users of the library. Instead of making
them deal with that design choice, the old apply_default_acl()
function was renamed t apply_default_acl_ex(), and a new
apply_default_acl() was added with no second argument to wrap the
former.

6 years agolibadacl: improve safe_open() error message when given bad args.
Michael Orlitzky [Mon, 26 Feb 2018 18:13:56 +0000 (13:13 -0500)]
libadacl: improve safe_open() error message when given bad args.

6 years agoClean up a few "include" statements, and document them.
Michael Orlitzky [Mon, 26 Feb 2018 14:59:48 +0000 (09:59 -0500)]
Clean up a few "include" statements, and document them.

6 years agoSplit most functions off into a separate shared library.
Michael Orlitzky [Mon, 26 Feb 2018 14:40:18 +0000 (09:40 -0500)]
Split most functions off into a separate shared library.

6 years agoUpdate the man page to say that symlinks are ignored in all path components.
Michael Orlitzky [Mon, 26 Feb 2018 13:41:16 +0000 (08:41 -0500)]
Update the man page to say that symlinks are ignored in all path components.

6 years agoAdd documentation for the safe_open() and safe_open_ex() functions.
Michael Orlitzky [Mon, 26 Feb 2018 13:38:14 +0000 (08:38 -0500)]
Add documentation for the safe_open() and safe_open_ex() functions.

6 years agoDefine a few more error constants to make the code more readable.
Michael Orlitzky [Mon, 26 Feb 2018 13:27:13 +0000 (08:27 -0500)]
Define a few more error constants to make the code more readable.

6 years agoDon't output anything in safe_open_ex when we ignore a symlink.
Michael Orlitzky [Mon, 26 Feb 2018 12:50:18 +0000 (07:50 -0500)]
Don't output anything in safe_open_ex when we ignore a symlink.

6 years agoAdd a test to ensure that non-terminal symlinks are not followed.
Michael Orlitzky [Mon, 26 Feb 2018 12:45:55 +0000 (07:45 -0500)]
Add a test to ensure that non-terminal symlinks are not followed.

6 years agoAdd a test to ensure that symlinks in the CWD don't cause problems.
Michael Orlitzky [Mon, 26 Feb 2018 12:39:55 +0000 (07:39 -0500)]
Add a test to ensure that symlinks in the CWD don't cause problems.

6 years agoAdd safe_open() function to fix symlink traversal in non-terminal components.
Michael Orlitzky [Mon, 26 Feb 2018 03:11:47 +0000 (22:11 -0500)]
Add safe_open() function to fix symlink traversal in non-terminal components.

The standard library provides lots of ways to avoid symlinks in the
"baz" component of "foo/bar/baz", but very few (i.e. zero) ways to
avoid them in the "bar" component. Of course, they're just as
dangerous in either place, so it would be cool if we could ignore
symlinks entirely.

This commit adds a safe_open() function, which looks just like open()
to the caller, but which starts at the root and calls openat() one
component at-a-time. Thus if you use O_NOFOLLOW, nobody can trick you
with an intermediate component: there are no intermediate components;
it works one at-a-time. This slows things down a bit, but not fatally.

6 years agoFix an old comment about dirname/basename handling in apply_default_acl().
Michael Orlitzky [Mon, 26 Feb 2018 03:11:10 +0000 (22:11 -0500)]
Fix an old comment about dirname/basename handling in apply_default_acl().

6 years agoEliminate the is_path_directory() function.
Michael Orlitzky [Mon, 26 Feb 2018 02:47:25 +0000 (21:47 -0500)]
Eliminate the is_path_directory() function.

The is_path_directory() function was only used in two places:

  1. To avoid involving nftw when the target is a file.
  2. To avoid setting (or trying to) a default ACL on a file.

The first one doesn't really matter, and the correct behavior is
tested, so the additional "is it a directory?" check has been
dropped. In the second case, we still don't want to try to set default
ACLs on files, but now the "is it a directory?" check is done at the
call site, where a stat structure is already available.

With those two uses gone, the function has been removed.

6 years agoPass a stat structure pointer to any_can_execute() to avoid a re-stat.
Michael Orlitzky [Mon, 26 Feb 2018 02:40:11 +0000 (21:40 -0500)]
Pass a stat structure pointer to any_can_execute() to avoid a re-stat.

6 years agoAllow apply_default_acl() to take a stat pointer for its path argument.
Michael Orlitzky [Mon, 26 Feb 2018 02:35:02 +0000 (21:35 -0500)]
Allow apply_default_acl() to take a stat pointer for its path argument.

When operating recursively, nftw has already called stat() on the path
that it feeds to apply_default_acl(). Rather than re-stat it, we can
now pass a stat struct pointer in as the second argument to
apply_default_acl(). When not operating recursively, you just pass it
NULL instead, and apply_default_acl() will do the fstat as before.

6 years agoImprove the error message when assign_default_acl() is fed a NULL path.
Michael Orlitzky [Mon, 26 Feb 2018 01:19:17 +0000 (20:19 -0500)]
Improve the error message when assign_default_acl() is fed a NULL path.

6 years agoEliminate the one remaining use of is_directory().
Michael Orlitzky [Mon, 26 Feb 2018 01:11:54 +0000 (20:11 -0500)]
Eliminate the one remaining use of is_directory().

The is_directory() function was called once, in a place where we
already had access to its argument's stat structure. Instead, we now
just use S_ISDIR, and the is_directory() function has met its end.

6 years agoMove the "or_dir" out of any_can_execute_or_dir().
Michael Orlitzky [Mon, 26 Feb 2018 01:10:04 +0000 (20:10 -0500)]
Move the "or_dir" out of any_can_execute_or_dir().

The any_can_execute_or_dir() function checked two things; whether or
not anyone could execute something, and whether or not that thing was
a directory. It's cleaner to have the "is it directory?" check outside
these days, so this commit renames that function to any_can_execute()
and the one place it's used now checks whether or not the argument is
a directory itself.

6 years agoInline the is_hardlink_safe() and is_regular_file() functions.
Michael Orlitzky [Mon, 26 Feb 2018 01:03:44 +0000 (20:03 -0500)]
Inline the is_hardlink_safe() and is_regular_file() functions.

These two functions were only called in one place, and they were
called right after one another. Both functions merely peek the stat
structure for a file descriptor, so it's easier to stat the thing once
and then just inline the two checks rather than setup/teardown
everything twice.

6 years agoImprove the error message when apply_default_acl() is fed a NULL path.
Michael Orlitzky [Mon, 26 Feb 2018 00:59:52 +0000 (19:59 -0500)]
Improve the error message when apply_default_acl() is fed a NULL path.

6 years agoEliminate pointless newline in the signature of acl_set_entry().
Michael Orlitzky [Mon, 26 Feb 2018 00:58:18 +0000 (19:58 -0500)]
Eliminate pointless newline in the signature of acl_set_entry().

6 years agoInline the one call to the get_mode() function.
Michael Orlitzky [Mon, 26 Feb 2018 00:55:34 +0000 (19:55 -0500)]
Inline the one call to the get_mode() function.

The get_mode() function was only called in one place, and its
implementation was about three lines. The overhead of checking its
arguments and figuring out its return value was not worth the
absolutely tiny improvement in readability that the function afforded,
so the whole thing has been inlined at its one call site.

6 years agoEliminate unnecessary intermediate result variables.
Michael Orlitzky [Mon, 26 Feb 2018 00:50:42 +0000 (19:50 -0500)]
Eliminate unnecessary intermediate result variables.

Before this commit, most library calls looked something like...

  int result = foo(x,y);
  if (result == whatever) {
    ...
  }

and then the "result" variable was never used again. There's no need
to introduce the new name, and it probably only increases
confusion. So, this commit eliminates them all.

6 years agoSimplify wipe_acls() by having it unconditionally write a new, empty ACL.
Michael Orlitzky [Mon, 26 Feb 2018 00:39:16 +0000 (19:39 -0500)]
Simplify wipe_acls() by having it unconditionally write a new, empty ACL.

6 years agoReplace most path usage with file descriptors.
Michael Orlitzky [Fri, 23 Feb 2018 21:11:08 +0000 (16:11 -0500)]
Replace most path usage with file descriptors.

Before this commit, we were passing around paths everywhere to specify
the targets of operations. This is not optimal from a security
standpoint: the best we can do to avoid following hard links is to
check whether or not a given file has more than one name. There is a
race condition inherent in that approach -- between when you stat the
file and when you use it, the number of names may change -- but using
paths makes that window larger than it has to be. There's no guarantee
that a path used at the bottom of apply_default_acl() will refer to
the same file that we called stat() on at the top of the function.

To work around that, most of the path handling functions have been
replaced with versions that use file descriptors. Now we are able to
stat() our file descriptor immediately after opening it, and the
descriptor itself will always refer to the same file. There's still
the smallest of windows for an exploit, but this makes it much safer
to call apply_default_acl() when there may be hard links present.

6 years agoRename is_directory() to is_path_directory() in preparation for other stuff.
Michael Orlitzky [Fri, 23 Feb 2018 21:02:03 +0000 (16:02 -0500)]
Rename is_directory() to is_path_directory() in preparation for other stuff.

6 years agoAdd missing jump-to-cleanup in one error scenario.
Michael Orlitzky [Fri, 23 Feb 2018 21:00:03 +0000 (16:00 -0500)]
Add missing jump-to-cleanup in one error scenario.

6 years agoAdd comments explainining the acl_create_entry() gymnastics.
Michael Orlitzky [Fri, 23 Feb 2018 17:10:25 +0000 (12:10 -0500)]
Add comments explainining the acl_create_entry() gymnastics.

6 years agoRemove pointless indirection in acl_entry_count() and acl_is_minimal().
Michael Orlitzky [Fri, 23 Feb 2018 16:39:07 +0000 (11:39 -0500)]
Remove pointless indirection in acl_entry_count() and acl_is_minimal().

The acl_t type is already a pointer to a structure, so there's no
reason to be passing around pointers to acl_t in acl_entry_count() and
acl_is_minimal(). This commit changes their signatures and call sites.

6 years agoHave acl_execute_masked() take an acl_t rather than a path as its argument.
Michael Orlitzky [Fri, 23 Feb 2018 16:32:31 +0000 (11:32 -0500)]
Have acl_execute_masked() take an acl_t rather than a path as its argument.

We only call acl_execute_masked() in one place; and in that place, the
ACL of the path in question is already available. So, there's no
reason for us to re-retrieve it. Instead, the function has been
updated to take an acl_t (and not a path), simplifing the logic a bit.

6 years agoRename inherit_default_acl() to assign_default_acl().
Michael Orlitzky [Fri, 23 Feb 2018 16:15:22 +0000 (11:15 -0500)]
Rename inherit_default_acl() to assign_default_acl().

The inherit_default_acl() function was called with two path names, and
the default ACL of the second path was retrieved and applied to the
first path. However, the only situation in which the function was used
was when the default ACL of the parent path was already available -- so
we were wasting time re-retrieving it.

This commit changes the name of the function to assign_default_acl(),
and it now takes an acl_t as its second parameter rather than a
path. The one place it is used now passes it the (already-known)
parent's default ACL rather than that parent's path.

6 years agoNaively ignore hard links to avoid security mishaps.
Michael Orlitzky [Thu, 22 Feb 2018 23:00:11 +0000 (18:00 -0500)]
Naively ignore hard links to avoid security mishaps.

If an attacker can introduce a hard link into a directory with a
default ACL, then he may be able to trick the user into applying that
default ACL to the target of the hard link which lives somewhere else
entirely. That can be exploited to gain access to the user's files,
and is hard to detect.

To avoid that problem entirely, great care must be taken. For now, a
naive check of the target path is implemented to ensure that (at the
start of the routine) it has only one name on the filesystem. This
still admits a race condition, but is an improvement.

The new behavior is now documented in the man page, and a test has
been added to ensure that pre-existing hard links are ignored.

8 years agoFix capitalization of "No such..." in the expected output of some tests. v0.0.6
Michael Orlitzky [Mon, 3 Oct 2016 14:19:45 +0000 (10:19 -0400)]
Fix capitalization of "No such..." in the expected output of some tests.

8 years agoAdd one more test for recursive symlink handling.
Michael Orlitzky [Mon, 3 Oct 2016 14:13:50 +0000 (10:13 -0400)]
Add one more test for recursive symlink handling.

8 years agoFix symlink handling and update to version 0.0.6.
Michael Orlitzky [Mon, 3 Oct 2016 14:06:11 +0000 (10:06 -0400)]
Fix symlink handling and update to version 0.0.6.

There was kind of a big bug in previous versions: symlinks were
followed and they weren't supposed to be. This came down to a few
"stat" calls that should have been "lstat" calls. Those changes have
been made, and there's now a test for the correct behavior.

Unrelated: I capitalized the 'n' in the "No such file..." error.

8 years agoAdd three tests for the new "no such file..." error output. v0.0.5
Michael Orlitzky [Tue, 27 Sep 2016 19:39:06 +0000 (15:39 -0400)]
Add three tests for the new "no such file..." error output.

8 years agoUse $() for subshells instead of backticks in run-tests.sh.
Michael Orlitzky [Tue, 27 Sep 2016 19:30:33 +0000 (15:30 -0400)]
Use $() for subshells instead of backticks in run-tests.sh.

8 years agoPrint an error if any targets do not exist.
Michael Orlitzky [Tue, 27 Sep 2016 19:23:33 +0000 (15:23 -0400)]
Print an error if any targets do not exist.

This commit fixes the last known bug, that apply-default-acl can be
called on a file that does not exist and no error is output.

A new function, path_accessible(), was added and it uses the
faccessat() POSIX call to check whether or not the current effective
user/group can access a path. We then call the new path_accessible()
on every target given on the command line. If any do not exist, an
error is printed:

  $ ./apply-default-acl derp
  ./apply-default-acl: derp: no such file or directory

Along with this change comes a version bump to v0.0.5 in configure.ac.
Some minor reorganization was done in configure.ac as well.

8 years agoFix a typo in a comment.
Michael Orlitzky [Tue, 27 Sep 2016 19:21:16 +0000 (15:21 -0400)]
Fix a typo in a comment.

8 years agoMake the usage() function argument program_name const.
Michael Orlitzky [Tue, 27 Sep 2016 19:20:27 +0000 (15:20 -0400)]
Make the usage() function argument program_name const.

11 years agoOutput an error message when a test user is missing.
Michael Orlitzky [Thu, 31 Jan 2013 13:11:31 +0000 (08:11 -0500)]
Output an error message when a test user is missing.
Add two tests for multiple command-line arguments.

11 years agoBump configure.ac to version 0.0.4. v0.0.4
Michael Orlitzky [Sat, 26 Jan 2013 01:05:12 +0000 (20:05 -0500)]
Bump configure.ac to version 0.0.4.
Add -Wall -Werror to the automake command line.
Add the test suite to Makefile.am (will generate a `make check` target).

11 years agoFix the bug from the latest test case.
Michael Orlitzky [Fri, 25 Jan 2013 23:03:09 +0000 (18:03 -0500)]
Fix the bug from the latest test case.

11 years agoAdd a test for a newly-discovered bug.
Michael Orlitzky [Fri, 25 Jan 2013 22:58:20 +0000 (17:58 -0500)]
Add a test for a newly-discovered bug.

11 years agoReplace the global no_exec_mask variable with a slightly less-awful solution.
Michael Orlitzky [Fri, 25 Jan 2013 04:17:45 +0000 (23:17 -0500)]
Replace the global no_exec_mask variable with a slightly less-awful solution.

11 years agoWhitespace fix.
Michael Orlitzky [Fri, 25 Jan 2013 04:09:58 +0000 (23:09 -0500)]
Whitespace fix.

11 years agoAdd a manpage and update Makefile.am to install it.
Michael Orlitzky [Wed, 23 Jan 2013 17:25:16 +0000 (12:25 -0500)]
Add a manpage and update Makefile.am to install it.

11 years agoFinish Doxygen documentation.
Michael Orlitzky [Wed, 23 Jan 2013 16:08:20 +0000 (11:08 -0500)]
Finish Doxygen documentation.

11 years agoDocument more functions with Doxygen.
Michael Orlitzky [Sun, 20 Jan 2013 00:33:25 +0000 (19:33 -0500)]
Document more functions with Doxygen.
Replace magic exit codes with defined constants.
Replace a few failure codes with errors.

11 years agoBegin using Doxygen-style comments.
Michael Orlitzky [Sat, 19 Jan 2013 01:44:19 +0000 (20:44 -0500)]
Begin using Doxygen-style comments.
Add a Doxyfile.

11 years agoStore the test users in a bash array.
Michael Orlitzky [Fri, 18 Jan 2013 23:40:36 +0000 (18:40 -0500)]
Store the test users in a bash array.
Use separate exit codes for test failure and missing users.

11 years agoUse (bin,daemon) users instead of (mail,news).
Michael Orlitzky [Fri, 18 Jan 2013 23:13:09 +0000 (18:13 -0500)]
Use (bin,daemon) users instead of (mail,news).

11 years agoAdd a new command-line option, --no-exec-mask, that disables the exec bit masking...
Michael Orlitzky [Wed, 9 Jan 2013 20:45:15 +0000 (15:45 -0500)]
Add a new command-line option, --no-exec-mask, that disables the exec bit masking heuristics.
Add tests for the new command-line option.

11 years agoAdd the acl_execute_masked() function.
Michael Orlitzky [Wed, 9 Jan 2013 20:08:23 +0000 (15:08 -0500)]
Add the acl_execute_masked() function.
Rename any_can_execute to any_can_execute_or_dir().
Don't mask the execute bit if the target is a directory (more-closely follows setfacl's "X" behavior).

11 years agoAdd more tests in preparation for the -x fix.
Michael Orlitzky [Wed, 9 Jan 2013 20:07:52 +0000 (15:07 -0500)]
Add more tests in preparation for the -x fix.

11 years agoSet permissions on $TESTDIR in acl_reset.
Michael Orlitzky [Wed, 9 Jan 2013 19:36:13 +0000 (14:36 -0500)]
Set permissions on $TESTDIR in acl_reset.
Use equal signs to delimit expected/actual output.