Bug 845288 - semanage fcontext accepts paths with double slash but the entry is invalid
semanage fcontext accepts paths with double slash but the entry is invalid
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: policycoreutils (Show other bugs)
All All
medium Severity medium
: rc
: ---
Assigned To: Daniel Walsh
BaseOS QE Security Team
Depends On:
  Show dependency treegraph
Reported: 2012-08-02 10:53 EDT by Miroslav Vadkerti
Modified: 2012-10-15 07:18 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-10-15 07:18:21 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Miroslav Vadkerti 2012-08-02 10:53: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):

How reproducible:

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/
(nothing happens)
# ll -Z /tmp/test/a 
-rw-r--r--. root root unconfined_u:object_r:user_tmp_t:s0 /tmp/test/a
Actual results:
Double slash paths are invalid

Expected results:
Semanage should convert directly subsequent slashes to one slash only, or work well with more directly subsequent slashes 

Additional info:
Comment 1 Daniel Walsh 2012-08-02 16:26:17 EDT
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,
Comment 2 Miroslav Grepl 2012-10-15 07:18:21 EDT
I am going to close this one for now as CANTFIX. Let's look if we can find a solution in Fedora first.

Note You need to log in before you can comment on or make changes to this bug.