diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-05-21 11:38:13 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-05-23 02:04:24 +0100 |
commit | 4ce7488e8d96080f18b518bcf6a6356e0c392dda (patch) | |
tree | d6ab80621d20c4eea51f817f105d68785434e789 /tests | |
parent | b5f332cfe06956f972aa385b38a40d2a0c675d09 (diff) | |
download | coreutils-4ce7488e8d96080f18b518bcf6a6356e0c392dda.tar.xz |
mkdir: fix -pZ with existing parent directories
When the parent directory exists and has a different
default context to the final directory, the context
was incorrectly left as that of the parent directory.
* src/mkdir.c (process_dir): Because defaultcon() is called for
existing ancestors (as it must be to avoid races), then we must
unconditionally call restorecon() on the last component due to
the already documented caveat with make_dir_parents().
Alternatively you could temp disable o->set_security_context
around make_dir_parents(), but that would be subject to races.
* tests (tests/mkdir/restorecon.sh): Add a TODO for improvement.
Reference mknod and mkfifo with print_ver_.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/20616
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/mkdir/restorecon.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/mkdir/restorecon.sh b/tests/mkdir/restorecon.sh index a31cab9bc..7d6a671b5 100755 --- a/tests/mkdir/restorecon.sh +++ b/tests/mkdir/restorecon.sh @@ -17,7 +17,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ mkdir +print_ver_ mkdir mknod mkfifo require_selinux_ @@ -38,6 +38,7 @@ if restorecon restored 2>/dev/null; then mkdir -Z single || fail=1 # Run these as separate processes in case global context # set for an arg, impacts on another arg + # TODO: Have the defaultcon() vary over these directories for dir in single_p single_p/existing multi/ple; do mkdir -Zp "$dir" || fail=1 done |