Skip to content

Commit

Permalink
libselinux: cycle though subs until there's none
Browse files Browse the repository at this point in the history
should fix:
    $ matchpathcon /var/run/foo/bar /run/foo/bar
    /var/run/foo/bar        system_u:object_r:etc_t:s0
    /run/foo/bar    system_u:object_r:var_run_t:s0

Signed-off-by: Petr Lautrbach <[email protected]>
  • Loading branch information
bachradsusi committed Oct 3, 2023
1 parent e609391 commit 520c547
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libselinux/src/label_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,11 @@ static struct spec **lookup_all(struct selabel_handle *rec,
key = clean_key;
}

sub = selabel_sub_key(data, key);
if (sub)
key = sub;
do {
sub = selabel_sub_key(data, key);
if (sub)
key = sub;
} while (sub);

file_stem = find_stem_from_file(data, key);
mode &= S_IFMT;
Expand Down

0 comments on commit 520c547

Please sign in to comment.