X-Git-Url: http://gitweb.michael.orlitzky.com/?p=apply-default-acl.git;a=blobdiff_plain;f=src%2Flibadacl.c;h=1d539488601dc98ef1f7fd81ea2572f714b888e1;hp=62ab3cc0047dcb2e92dcf3d9b21d86b21fe518b8;hb=5fa76c4883985b89802574ec7f47ccc186eb2201;hpb=940d3a24319ed7fd67ae0f400add78af4e37b1c7 diff --git a/src/libadacl.c b/src/libadacl.c index 62ab3cc..1d53948 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -654,9 +654,6 @@ int has_default_acl_fd(int fd) { * @param fd * The file descriptor that should inherit its parent's default ACL. * - * @param no_exec_mask - * The value (either true or false) of the --no-exec-mask flag. - * * @param recursive * Should we recurse into subdirectories? * @@ -667,7 +664,6 @@ int has_default_acl_fd(int fd) { */ int apply_default_acl_fds(int parent_fd, int fd, - bool no_exec_mask, bool recursive) { int result = ACL_SUCCESS; @@ -718,24 +714,20 @@ int apply_default_acl_fds(int parent_fd, } - /* Default to not masking the exec bit; i.e. applying the default - ACL literally. If --no-exec-mask was not specified, then we try - to "guess" whether or not to mask the exec bit. This behavior - is modeled after the capital 'X' perms of setfacl. */ - bool allow_exec = true; + /* Next We try to guess whether or not to strip the execute bits. + * This behavior is modeled after the capital 'X' perms of setfacl. + */ + int ace_result = any_can_execute(fd, &s); - if (!no_exec_mask) { - /* Never mask the execute bit on directories. */ - int ace_result = any_can_execute(fd,&s) || S_ISDIR(s.st_mode); + if (ace_result == ACL_ERROR) { + perror("apply_default_acl_fds (any_can_execute)"); + result = ACL_ERROR; + goto cleanup; + } - if (ace_result == ACL_ERROR) { - perror("apply_default_acl_fds (any_can_execute)"); - result = ACL_ERROR; - goto cleanup; - } + /* Never mask the execute bit on directories. */ + bool allow_exec = (bool)ace_result || S_ISDIR(s.st_mode); - allow_exec = (bool)ace_result; - } /* If it's a directory, inherit the parent's default. */ if (S_ISDIR(s.st_mode)) { @@ -905,7 +897,7 @@ int apply_default_acl_fds(int parent_fd, continue; } } - switch (apply_default_acl_fds(fd, new_fd, no_exec_mask, recursive)) { + switch (apply_default_acl_fds(fd, new_fd, recursive)) { /* Don't overwrite an error result with success/failure. */ case ACL_FAILURE: if (result == ACL_SUCCESS) { @@ -940,9 +932,6 @@ int apply_default_acl_fds(int parent_fd, * @param path * The path whose ACL we would like to reset to its default. * - * @param no_exec_mask - * The value (either true or false) of the --no-exec-mask flag. - * * @param recursive * Should we recurse into subdirectories? * @@ -951,7 +940,7 @@ int apply_default_acl_fds(int parent_fd, * - @c ACL_FAILURE - If symlinks or hard links are encountered. * - @c ACL_ERROR - Unexpected library error. */ -int apply_default_acl(const char* path, bool no_exec_mask, bool recursive) { +int apply_default_acl(const char* path, bool recursive) { if (path == NULL) { errno = EINVAL; @@ -1024,7 +1013,7 @@ int apply_default_acl(const char* path, bool no_exec_mask, bool recursive) { } } - result = apply_default_acl_fds(parent_fd, fd, no_exec_mask, recursive); + result = apply_default_acl_fds(parent_fd, fd, recursive); cleanup: free(dirname_path_copy);