Red Hat Bugzilla – Bug 845288
semanage fcontext accepts paths with double slash but the entry is invalid
Last modified: 2012-10-15 07:18:21 EDT
Description of problem:
After adding a path with double slash with semanage fcontext the added path doesn't get the wanted context
Version-Release number of selected component (if applicable):
Steps to Reproduce:
# mkdir /tmp/test
# touch /tmp/test/a
# touch /tmp/test/b
# semanage fcontext -a -t var_log_t "/tmp//test(/.*)?"
# restorecon -RvvF /tmp/test/
# ll -Z /tmp/test/a
-rw-r--r--. root root unconfined_u:object_r:user_tmp_t:s0 /tmp/test/a
Double slash paths are invalid
Semanage should convert directly subsequent slashes to one slash only, or work well with more directly subsequent slashes
That is someone tough to do. I guess we could do a realpath on /tmp//test somehow if we can figure out where the path get screwed up.
IE There are a lot of paths that regex will not complain about, but this is somewhat the problem of the user. Currently the tool is checking for spaces so we could add "//" as being invalid, I am not sure what else we should look for,
I am going to close this one for now as CANTFIX. Let's look if we can find a solution in Fedora first.