2 * @file apply-default-acl.c
4 * @brief The entire implementation.
8 /* On Linux, ftw.h needs this special voodoo to work. */
9 #define _XOPEN_SOURCE 500
13 #include <fcntl.h> /* AT_FOO constants */
14 #include <ftw.h> /* nftw() et al. */
16 #include <libgen.h> /* dirname() */
17 #include <limits.h> /* PATH_MAX */
26 #include <acl/libacl.h> /* acl_get_perm, not portable */
27 #include <sys/types.h>
30 /* Most of the libacl functions return 1 for success, 0 for failure,
39 * @brief Get the mode bits from the given path.
42 * The path (file or directory) whose mode we want.
44 * @return A mode_t (st_mode) structure containing the mode bits.
45 * See sys/stat.h for details.
47 mode_t
get_mode(const char* path
) {
54 int result
= lstat(path
, &s
);
60 /* errno will be set already by lstat() */
68 * @brief Determine if the given path might refer to an (unsafe) hard link.
73 * @return true if we are certain that @c path does not refer to a hard
74 * link, and false otherwise. In case of error, false is returned,
75 * because we are not sure that @c path is not a hard link.
77 bool is_hardlink_safe(const char* path
) {
82 int result
= lstat(path
, &s
);
84 return (s
.st_nlink
== 1 || S_ISDIR(s
.st_mode
));
93 * @brief Determine whether or not the given path is a regular file.
98 * @return true if @c path is a regular file, false otherwise.
100 bool is_regular_file(const char* path
) {
106 int result
= lstat(path
, &s
);
108 return S_ISREG(s
.st_mode
);
118 * @brief Determine whether or not the given path is accessible.
123 * @return true if @c path is accessible to the current effective
124 * user/group, false otherwise.
126 bool path_accessible(const char* path
) {
131 /* Test for access using the effective user and group rather than
133 int flags
= AT_EACCESS
;
135 /* Don't follow symlinks when checking for a path's existence,
136 since we won't follow them to set its ACLs either. */
137 flags
|= AT_SYMLINK_NOFOLLOW
;
139 /* If the path is relative, interpret it relative to the current
140 working directory (just like the access() system call). */
141 int result
= faccessat(AT_FDCWD
, path
, F_OK
, flags
);
154 * @brief Determine whether or not the given path is a directory.
159 * @return true if @c path is a directory, false otherwise.
161 bool is_directory(const char* path
) {
167 int result
= lstat(path
, &s
);
169 return S_ISDIR(s
.st_mode
);
179 * @brief Update (or create) an entry in an @b minimal ACL.
181 * This function will not work if @c aclp contains extended
182 * entries. This is fine for our purposes, since we call @c wipe_acls
183 * on each path before applying the default to it.
185 * The assumption that there are no extended entries makes things much
186 * simpler. For example, we only have to update the @c ACL_USER_OBJ,
187 * @c ACL_GROUP_OBJ, and @c ACL_OTHER entries -- all others can simply
188 * be created anew. This means we don't have to fool around comparing
189 * named-user/group entries.
192 * A pointer to the acl_t structure whose entry we want to modify.
195 * The new entry. If @c entry contains a user/group/other entry, we
196 * update the existing one. Otherwise we create a new entry.
198 * @return If there is an unexpected library error, @c ACL_ERROR is
199 * returned. Otherwise, @c ACL_SUCCESS.
202 int acl_set_entry(acl_t
* aclp
,
206 int gt_result
= acl_get_tag_type(entry
, &entry_tag
);
207 if (gt_result
== ACL_ERROR
) {
208 perror("acl_set_entry (acl_get_tag_type)");
212 acl_permset_t entry_permset
;
213 int ps_result
= acl_get_permset(entry
, &entry_permset
);
214 if (ps_result
== ACL_ERROR
) {
215 perror("acl_set_entry (acl_get_permset)");
219 acl_entry_t existing_entry
;
220 /* Loop through the given ACL looking for matching entries. */
221 int result
= acl_get_entry(*aclp
, ACL_FIRST_ENTRY
, &existing_entry
);
223 while (result
== ACL_SUCCESS
) {
224 acl_tag_t existing_tag
= ACL_UNDEFINED_TAG
;
225 int tag_result
= acl_get_tag_type(existing_entry
, &existing_tag
);
227 if (tag_result
== ACL_ERROR
) {
228 perror("set_acl_tag_permset (acl_get_tag_type)");
232 if (existing_tag
== entry_tag
) {
233 if (entry_tag
== ACL_USER_OBJ
||
234 entry_tag
== ACL_GROUP_OBJ
||
235 entry_tag
== ACL_OTHER
) {
236 /* Only update for these three since all other tags will have
237 been wiped. These three are guaranteed to exist, so if we
238 match one of them, we're allowed to return ACL_SUCCESS
239 below and bypass the rest of the function. */
240 acl_permset_t existing_permset
;
241 int gep_result
= acl_get_permset(existing_entry
, &existing_permset
);
242 if (gep_result
== ACL_ERROR
) {
243 perror("acl_set_entry (acl_get_permset)");
247 int s_result
= acl_set_permset(existing_entry
, entry_permset
);
248 if (s_result
== ACL_ERROR
) {
249 perror("acl_set_entry (acl_set_permset)");
258 result
= acl_get_entry(*aclp
, ACL_NEXT_ENTRY
, &existing_entry
);
261 /* This catches both the initial acl_get_entry and the ones at the
263 if (result
== ACL_ERROR
) {
264 perror("acl_set_entry (acl_get_entry)");
268 /* If we've made it this far, we need to add a new entry to the
270 acl_entry_t new_entry
;
272 /* We allocate memory here that we should release! */
273 int c_result
= acl_create_entry(aclp
, &new_entry
);
274 if (c_result
== ACL_ERROR
) {
275 perror("acl_set_entry (acl_create_entry)");
279 int st_result
= acl_set_tag_type(new_entry
, entry_tag
);
280 if (st_result
== ACL_ERROR
) {
281 perror("acl_set_entry (acl_set_tag_type)");
285 int s_result
= acl_set_permset(new_entry
, entry_permset
);
286 if (s_result
== ACL_ERROR
) {
287 perror("acl_set_entry (acl_set_permset)");
291 if (entry_tag
== ACL_USER
|| entry_tag
== ACL_GROUP
) {
292 /* We need to set the qualifier too. */
293 void* entry_qual
= acl_get_qualifier(entry
);
294 if (entry_qual
== (void*)NULL
) {
295 perror("acl_set_entry (acl_get_qualifier)");
299 int sq_result
= acl_set_qualifier(new_entry
, entry_qual
);
300 if (sq_result
== ACL_ERROR
) {
301 perror("acl_set_entry (acl_set_qualifier)");
312 * @brief Determine the number of entries in the given ACL.
315 * A pointer to an @c acl_t structure.
317 * @return Either the non-negative number of entries in @c acl, or
318 * @c ACL_ERROR on error.
320 int acl_entry_count(acl_t
* acl
) {
324 int result
= acl_get_entry(*acl
, ACL_FIRST_ENTRY
, &entry
);
326 while (result
== ACL_SUCCESS
) {
328 result
= acl_get_entry(*acl
, ACL_NEXT_ENTRY
, &entry
);
331 if (result
== ACL_ERROR
) {
332 perror("acl_entry_count (acl_get_entry)");
342 * @brief Determine whether or not the given ACL is minimal.
344 * An ACL is minimal if it has fewer than four entries.
347 * A pointer to an acl_t structure.
350 * - @c ACL_SUCCESS - @c acl is minimal
351 * - @c ACL_FAILURE - @c acl is not minimal
352 * - @c ACL_ERROR - Unexpected library error
354 int acl_is_minimal(acl_t
* acl
) {
356 int ec
= acl_entry_count(acl
);
358 if (ec
== ACL_ERROR
) {
359 perror("acl_is_minimal (acl_entry_count)");
374 * @brief Determine whether the given ACL's mask denies execute.
377 * The ACL whose mask we want to check.
380 * - @c ACL_SUCCESS - The @c acl has a mask which denies execute.
381 * - @c ACL_FAILURE - The @c acl has a mask which does not deny execute.
382 * - @c ACL_ERROR - Unexpected library error.
384 int acl_execute_masked(acl_t acl
) {
387 int ge_result
= acl_get_entry(acl
, ACL_FIRST_ENTRY
, &entry
);
389 while (ge_result
== ACL_SUCCESS
) {
390 acl_tag_t tag
= ACL_UNDEFINED_TAG
;
391 int tag_result
= acl_get_tag_type(entry
, &tag
);
393 if (tag_result
== ACL_ERROR
) {
394 perror("acl_execute_masked (acl_get_tag_type)");
398 if (tag
== ACL_MASK
) {
399 /* This is the mask entry, get its permissions, and see if
400 execute is specified. */
401 acl_permset_t permset
;
403 int ps_result
= acl_get_permset(entry
, &permset
);
404 if (ps_result
== ACL_ERROR
) {
405 perror("acl_execute_masked (acl_get_permset)");
409 int gp_result
= acl_get_perm(permset
, ACL_EXECUTE
);
410 if (gp_result
== ACL_ERROR
) {
411 perror("acl_execute_masked (acl_get_perm)");
415 if (gp_result
== ACL_FAILURE
) {
416 /* No execute bit set in the mask; execute not allowed. */
421 ge_result
= acl_get_entry(acl
, ACL_NEXT_ENTRY
, &entry
);
430 * @brief Determine whether @c path is executable (by anyone) or a
433 * This is used as part of the heuristic to determine whether or not
434 * we should mask the execute bit when inheriting an ACL. If @c path
435 * is a directory, the answer is a clear-cut yes. This behavior is
436 * modeled after the capital 'X' perms of setfacl.
438 * If @c path is a file, we check the @a effective permissions,
439 * contrary to what setfacl does.
445 * - @c ACL_SUCCESS - @c path is a directory, or someone has effective
447 * - @c ACL_FAILURE - @c path is a regular file and nobody can execute
449 * - @c ACL_ERROR - Unexpected library error.
451 int any_can_execute_or_dir(const char* path
) {
453 if (is_directory(path
)) {
454 /* That was easy... */
458 acl_t acl
= acl_get_file(path
, ACL_TYPE_ACCESS
);
460 if (acl
== (acl_t
)NULL
) {
461 perror("any_can_execute_or_dir (acl_get_file)");
465 /* Our return value. */
466 int result
= ACL_FAILURE
;
468 if (acl_is_minimal(&acl
)) {
469 mode_t mode
= get_mode(path
);
470 if (mode
& (S_IXUSR
| S_IXOTH
| S_IXGRP
)) {
471 result
= ACL_SUCCESS
;
475 result
= ACL_FAILURE
;
481 int ge_result
= acl_get_entry(acl
, ACL_FIRST_ENTRY
, &entry
);
483 while (ge_result
== ACL_SUCCESS
) {
484 /* The first thing we do is check to see if this is a mask
485 entry. If it is, we skip it entirely. */
486 acl_tag_t tag
= ACL_UNDEFINED_TAG
;
487 int tag_result
= acl_get_tag_type(entry
, &tag
);
489 if (tag_result
== ACL_ERROR
) {
490 perror("any_can_execute_or_dir (acl_get_tag_type)");
495 if (tag
== ACL_MASK
) {
496 ge_result
= acl_get_entry(acl
, ACL_NEXT_ENTRY
, &entry
);
500 /* Ok, so it's not a mask entry. Check the execute perms. */
501 acl_permset_t permset
;
503 int ps_result
= acl_get_permset(entry
, &permset
);
504 if (ps_result
== ACL_ERROR
) {
505 perror("any_can_execute_or_dir (acl_get_permset)");
510 int gp_result
= acl_get_perm(permset
, ACL_EXECUTE
);
511 if (gp_result
== ACL_ERROR
) {
512 perror("any_can_execute_or_dir (acl_get_perm)");
517 if (gp_result
== ACL_SUCCESS
) {
518 /* Only return ACL_SUCCESS if this execute bit is not masked. */
519 if (acl_execute_masked(acl
) != ACL_SUCCESS
) {
520 result
= ACL_SUCCESS
;
525 ge_result
= acl_get_entry(acl
, ACL_NEXT_ENTRY
, &entry
);
528 if (ge_result
== ACL_ERROR
) {
529 perror("any_can_execute_or_dir (acl_get_entry)");
542 * @brief Set @c acl as the default ACL on @c path if it's a directory.
544 * This overwrites any existing default ACL on @c path. If no default
545 * ACL exists, then one is created. If @c path is not a directory, we
546 * return ACL_FAILURE but no error is raised.
549 * The target directory whose ACL we wish to replace or create.
552 * The ACL to set as default on @c path.
555 * - @c ACL_SUCCESS - The default ACL was assigned successfully.
556 * - @c ACL_FAILURE - If @c path is not a directory.
557 * - @c ACL_ERROR - Unexpected library error.
559 int assign_default_acl(const char* path
, acl_t acl
) {
566 if (!is_directory(path
)) {
570 /* Our return value; success unless something bad happens. */
571 int result
= ACL_SUCCESS
;
572 acl_t path_acl
= acl_dup(acl
);
574 if (path_acl
== (acl_t
)NULL
) {
575 perror("inherit_default_acl (acl_dup)");
576 return ACL_ERROR
; /* Nothing to clean up in this case. */
579 int sf_result
= acl_set_file(path
, ACL_TYPE_DEFAULT
, path_acl
);
580 if (sf_result
== -1) {
581 perror("inherit_default_acl (acl_set_file)");
592 * @brief Remove @c ACL_USER, @c ACL_GROUP, and @c ACL_MASK entries
593 * from the given path.
596 * The path whose ACLs we want to wipe.
599 * - @c ACL_SUCCESS - The ACLs were wiped successfully, or none
600 * existed in the first place.
601 * - @c ACL_ERROR - Unexpected library error.
603 int wipe_acls(const char* path
) {
610 acl_t acl
= acl_get_file(path
, ACL_TYPE_ACCESS
);
611 if (acl
== (acl_t
)NULL
) {
612 perror("wipe_acls (acl_get_file)");
616 /* Our return value. */
617 int result
= ACL_SUCCESS
;
620 int ge_result
= acl_get_entry(acl
, ACL_FIRST_ENTRY
, &entry
);
622 while (ge_result
== ACL_SUCCESS
) {
623 int d_result
= acl_delete_entry(acl
, entry
);
624 if (d_result
== ACL_ERROR
) {
625 perror("wipe_acls (acl_delete_entry)");
630 ge_result
= acl_get_entry(acl
, ACL_NEXT_ENTRY
, &entry
);
633 /* Catches the first acl_get_entry as well as the ones at the end of
635 if (ge_result
== ACL_ERROR
) {
636 perror("wipe_acls (acl_get_entry)");
641 int sf_result
= acl_set_file(path
, ACL_TYPE_ACCESS
, acl
);
642 if (sf_result
== ACL_ERROR
) {
643 perror("wipe_acls (acl_set_file)");
656 * @brief Apply parent default ACL to a path.
658 * This overwrites any existing ACLs on @c path.
661 * The path whose ACL we would like to reset to its default.
663 * @param no_exec_mask
664 * The value (either true or false) of the --no-exec-mask flag.
667 * - @c ACL_SUCCESS - The parent default ACL was inherited successfully.
668 * - @c ACL_FAILURE - The target path is not a regular file/directory,
669 * or the parent of @c path is not a directory.
670 * - @c ACL_ERROR - Unexpected library error.
672 int apply_default_acl(const char* path
, bool no_exec_mask
) {
679 /* Refuse to operate on hard links, which can be abused by an
680 * attacker to trick us into changing the ACL on a file we didn't
681 * intend to; namely the "target" of the hard link. To truly prevent
682 * that sort of mischief, we should be using file descriptors for
683 * the target and its parent directory. Then modulo a tiny race
684 * condition, we would be sure that "path" and "parent" don't change
685 * their nature between the time that we test them and when we
686 * utilize them. For contrast, the same attacker is free to replace
687 * "path" with a hard link after is_hardlink_safe() has returned
690 * Unfortunately, our API is lacking in this area. For example,
691 * acl_set_fd() is only capable of setting the ACL_TYPE_ACCESS list,
692 * and not the ACL_TYPE_DEFAULT. Apparently the only way to operate
693 * on default ACLs is through the path name, which is inherently
694 * unreliable since the acl_*_file() calls themselves might follow
695 * links (both hard and symbolic).
697 * Some improvement could still be made by using descriptors where
698 * possible -- this would shrink the exploit window -- but for now
699 * we use a naive implementation that only keeps honest men honest.
701 if (!is_hardlink_safe(path
)) {
705 if (!is_regular_file(path
) && !is_directory(path
)) {
709 /* dirname mangles its argument */
710 char path_copy
[PATH_MAX
];
711 strncpy(path_copy
, path
, PATH_MAX
-1);
712 path_copy
[PATH_MAX
-1] = 0;
714 char* parent
= dirname(path_copy
);
715 if (!is_directory(parent
)) {
716 /* Make sure dirname() did what we think it did. */
720 /* Default to not masking the exec bit; i.e. applying the default
721 ACL literally. If --no-exec-mask was not specified, then we try
722 to "guess" whether or not to mask the exec bit. */
723 bool allow_exec
= true;
726 int ace_result
= any_can_execute_or_dir(path
);
728 if (ace_result
== ACL_ERROR
) {
729 perror("apply_default_acl (any_can_execute_or_dir)");
733 allow_exec
= (bool)ace_result
;
736 acl_t defacl
= acl_get_file(parent
, ACL_TYPE_DEFAULT
);
738 if (defacl
== (acl_t
)NULL
) {
739 perror("apply_default_acl (acl_get_file)");
743 /* Our return value. */
744 int result
= ACL_SUCCESS
;
746 int wipe_result
= wipe_acls(path
);
747 if (wipe_result
== ACL_ERROR
) {
748 perror("apply_default_acl (wipe_acls)");
753 /* Do this after wipe_acls(), otherwise we'll overwrite the wiped
754 ACL with this one. */
755 acl_t acl
= acl_get_file(path
, ACL_TYPE_ACCESS
);
756 if (acl
== (acl_t
)NULL
) {
757 perror("apply_default_acl (acl_get_file)");
761 /* If it's a directory, inherit the parent's default. */
762 int inherit_result
= assign_default_acl(path
, defacl
);
763 if (inherit_result
== ACL_ERROR
) {
764 perror("apply_default_acl (inherit_acls)");
770 int ge_result
= acl_get_entry(defacl
, ACL_FIRST_ENTRY
, &entry
);
772 while (ge_result
== ACL_SUCCESS
) {
773 acl_tag_t tag
= ACL_UNDEFINED_TAG
;
774 int tag_result
= acl_get_tag_type(entry
, &tag
);
776 if (tag_result
== ACL_ERROR
) {
777 perror("apply_default_acl (acl_get_tag_type)");
783 /* We've got an entry/tag from the default ACL. Get its permset. */
784 acl_permset_t permset
;
785 int ps_result
= acl_get_permset(entry
, &permset
);
786 if (ps_result
== ACL_ERROR
) {
787 perror("apply_default_acl (acl_get_permset)");
792 /* If this is a default mask, fix it up. */
793 if (tag
== ACL_MASK
||
794 tag
== ACL_USER_OBJ
||
795 tag
== ACL_GROUP_OBJ
||
799 /* The mask doesn't affect acl_user_obj, acl_group_obj (in
800 minimal ACLs) or acl_other entries, so if execute should be
801 masked, we have to do it manually. */
802 int d_result
= acl_delete_perm(permset
, ACL_EXECUTE
);
803 if (d_result
== ACL_ERROR
) {
804 perror("apply_default_acl (acl_delete_perm)");
809 int sp_result
= acl_set_permset(entry
, permset
);
810 if (sp_result
== ACL_ERROR
) {
811 perror("apply_default_acl (acl_set_permset)");
818 /* Finally, add the permset to the access ACL. */
819 int set_result
= acl_set_entry(&acl
, entry
);
820 if (set_result
== ACL_ERROR
) {
821 perror("apply_default_acl (acl_set_entry)");
826 ge_result
= acl_get_entry(defacl
, ACL_NEXT_ENTRY
, &entry
);
829 /* Catches the first acl_get_entry as well as the ones at the end of
831 if (ge_result
== ACL_ERROR
) {
832 perror("apply_default_acl (acl_get_entry)");
837 int sf_result
= acl_set_file(path
, ACL_TYPE_ACCESS
, acl
);
838 if (sf_result
== ACL_ERROR
) {
839 perror("apply_default_acl (acl_set_file)");
852 * @brief Display program usage information.
854 * @param program_name
855 * The program name to use in the output.
858 void usage(const char* program_name
) {
859 printf("Apply any applicable default ACLs to the given files or "
861 printf("Usage: %s [flags] <target1> [<target2> [ <target3>...]]\n\n",
864 printf(" -h, --help Print this help message\n");
865 printf(" -r, --recursive Act on any given directories recursively\n");
866 printf(" -x, --no-exec-mask Apply execute permissions unconditionally\n");
873 * @brief Wrapper around @c apply_default_acl() for use with @c nftw().
875 * For parameter information, see the @c nftw man page.
877 * @return If the ACL was applied to @c target successfully, we return
878 * @c FTW_CONTINUE to signal to @ nftw() that we should proceed onto
879 * the next file or directory. Otherwise, we return @c FTW_STOP to
883 int apply_default_acl_nftw(const char *target
,
884 const struct stat
*s
,
888 bool app_result
= apply_default_acl(target
, false);
900 * @brief Wrapper around @c apply_default_acl() for use with @c nftw().
902 * This is identical to @c apply_default_acl_nftw(), except it passes
903 * @c true to @c apply_default_acl() as its no_exec_mask argument.
906 int apply_default_acl_nftw_x(const char *target
,
907 const struct stat
*s
,
911 bool app_result
= apply_default_acl(target
, true);
923 * @brief Recursive version of @c apply_default_acl().
925 * If @c target is a directory, we use @c nftw() to call @c
926 * apply_default_acl() recursively on all of its children. Otherwise,
927 * we just delegate to @c apply_default_acl().
929 * We ignore symlinks for consistency with chmod -r.
932 * The root (path) of the recursive application.
934 * @param no_exec_mask
935 * The value (either true or false) of the --no-exec-mask flag.
938 * If @c target is not a directory, we return the result of
939 * calling @c apply_default_acl() on @c target. Otherwise, we convert
940 * the return value of @c nftw(). If @c nftw() succeeds (returns 0),
941 * then we return @c true. Otherwise, we return @c false.
943 * If there is an error, it will be reported via @c perror, but
944 * we still return @c false.
946 bool apply_default_acl_recursive(const char *target
, bool no_exec_mask
) {
948 if (!is_directory(target
)) {
949 return apply_default_acl(target
, no_exec_mask
);
952 int max_levels
= 256;
953 int flags
= FTW_PHYS
; /* Don't follow links. */
955 /* There are two separate functions that could be passed to
956 nftw(). One passes no_exec_mask = true to apply_default_acl(),
957 and the other passes no_exec_mask = false. Since the function we
958 pass to nftw() cannot have parameters, we have to create separate
959 options and make the decision here. */
960 int (*fn
)(const char *, const struct stat
*, int, struct FTW
*) = NULL
;
961 fn
= no_exec_mask
? apply_default_acl_nftw_x
: apply_default_acl_nftw
;
963 int nftw_result
= nftw(target
, fn
, max_levels
, flags
);
965 if (nftw_result
== 0) {
970 /* nftw will return -1 on error, or if the supplied function
971 * (apply_default_acl_nftw) returns a non-zero result, nftw will
974 if (nftw_result
== -1) {
975 perror("apply_default_acl_recursive (nftw)");
984 * @brief Call apply_default_acl (possibly recursively) on each
985 * command-line argument.
987 * @return Either @c EXIT_FAILURE or @c EXIT_SUCCESS. If everything
988 * goes as expected, we return @c EXIT_SUCCESS. Otherwise, we return
991 int main(int argc
, char* argv
[]) {
998 bool recursive
= false;
999 bool no_exec_mask
= false;
1001 struct option long_options
[] = {
1002 /* These options set a flag. */
1003 {"help", no_argument
, NULL
, 'h'},
1004 {"recursive", no_argument
, NULL
, 'r'},
1005 {"no-exec-mask", no_argument
, NULL
, 'x'},
1011 while ((opt
= getopt_long(argc
, argv
, "hrx", long_options
, NULL
)) != -1) {
1015 return EXIT_SUCCESS
;
1020 no_exec_mask
= true;
1024 return EXIT_FAILURE
;
1028 int result
= EXIT_SUCCESS
;
1031 for (arg_index
= optind
; arg_index
< argc
; arg_index
++) {
1032 const char* target
= argv
[arg_index
];
1033 bool reapp_result
= false;
1035 /* Make sure we can access the given path before we go out of our
1036 * way to please it. Doing this check outside of
1037 * apply_default_acl() lets us spit out a better error message for
1040 if (!path_accessible(target
)) {
1041 fprintf(stderr
, "%s: %s: No such file or directory\n", argv
[0], target
);
1042 result
= EXIT_FAILURE
;
1047 reapp_result
= apply_default_acl_recursive(target
, no_exec_mask
);
1050 /* It's either a normal file, or we're not operating recursively. */
1051 reapp_result
= apply_default_acl(target
, no_exec_mask
);
1054 if (!reapp_result
) {
1055 result
= EXIT_FAILURE
;