selinux: Use selinux_set_mapping() to avoid hardcoded constants for policy
authorosmond sun <osmond.sun@gmail.com>
Tue, 5 Nov 2013 16:53:18 +0000 (00:53 +0800)
committerColin Walters <walters@verbum.org>
Thu, 7 Nov 2013 19:52:27 +0000 (14:52 -0500)
commitba088208bc0c35ca418a097a8482c4a7705f4a43
tree1ac7e8e71852e414338808a8587c46863cea8331
parent4cf2df1355e0f22e86395453d78a615a19fa958d
selinux: Use selinux_set_mapping() to avoid hardcoded constants for policy

Previous to the introduction of selinux_set_mapping(), DBus pulled
constants generated from the system's policy at build time.  But this
means it's impossible to replace the system policy without rebuilding
userspace components.

This patch maps from arbitrary class/perm indices used by D-Bus and
the policy values and handles all the translation at runtime on
avc_has_perm() calls.

Bug: https://bugs.freedesktop.org/attachment.cgi?id=88719
Reviewed-By: Colin Walters <walters@verbum.org>
Tested-By: Colin Walters <walters@verbum.org>
bus/bus.c
bus/selinux.c