Revert "mcstransd select correct colour range."

This reverts commit fe17b3d2d9.

MLS ranges should be compared based on dominance.

This fixes mlscolor-test on mcstrans examples.

Eg. mlscolor-test using /usr/share/mcstrans/examples/urcsts when executed on mls
machine fails as follows:

\#pushd /usr/share/mcstrans/examples/urcsts
\#cp -f secolor.conf /etc/selinux/mls/secolor.conf
\#cp -f setrans.conf /etc/selinux/mls/setrans.conf
\#systemctl restart mcstransd
\#python3 /usr/share/mcstrans/util/mlscolor-test urcsts.color
For 'system_u:system_r:inetd_t:SystemLow' got
	'#000000 #000000 #000000 #000000 #000000 #000000 #000000 #000000' expected
	'#000000 #000000 #000000 #000000 #000000 #000000 #000000 #008000'
...
mlscolor-test done with 19 errors

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
This commit is contained in:
Vit Mojzis 2019-07-02 14:09:04 +02:00 committed by stephensmalley
parent 9ba35fe8c2
commit 2ff0fbffcf

View file

@ -134,12 +134,12 @@ static const secolor_t *find_color(int idx, const char *component,
}
while (ptr) {
if (fnmatch(ptr->pattern, component, 0) == 0) {
if (idx == COLOR_RANGE) {
if (check_dominance(ptr->pattern, raw) == 0)
return &ptr->color;
} else
return &ptr->color;
if (idx == COLOR_RANGE) {
if (check_dominance(ptr->pattern, raw) == 0)
return &ptr->color;
} else {
if (fnmatch(ptr->pattern, component, 0) == 0)
return &ptr->color;
}
ptr = ptr->next;
}