aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/services.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-03-20 14:35:12 -0400
committerBrett Rogers <brettrogers11@gmail.com>2015-11-07 23:28:25 -0800
commit2e85a7bc765134be125037bb44130620002cb2c3 (patch)
tree422688c84dfe2696788b3dbb006620defb659b46 /security/selinux/ss/services.c
parentaa5083ab363ce861304d788f31a5387d6f6a8eb0 (diff)
downloadkernel_samsung_smdk4412-2e85a7bc765134be125037bb44130620002cb2c3.zip
kernel_samsung_smdk4412-2e85a7bc765134be125037bb44130620002cb2c3.tar.gz
kernel_samsung_smdk4412-2e85a7bc765134be125037bb44130620002cb2c3.tar.bz2
SELinux: add default_type statements
Because Fedora shipped userspace based on my development tree we now have policy version 27 in the wild defining only default user, role, and range. Thus to add default_type we need a policy.28. Upstream commit eed7795d0a2c9b2e934afc088e903fa2c17b7958 Signed-off-by: Eric Paris <eparis@redhat.com> Change-Id: Icb3324af7f740249977a4559c2c5692c7fcc22a2
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r--security/selinux/ss/services.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 4344278..a6a0d01 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1478,12 +1478,18 @@ static int security_compute_sid(u32 ssid,
}
/* Set the type to default values. */
- if ((tclass == policydb.process_class) || (sock == true)) {
- /* Use the type of process. */
+ if (cladatum && cladatum->default_type == DEFAULT_SOURCE) {
newcontext.type = scontext->type;
- } else {
- /* Use the type of the related object. */
+ } else if (cladatum && cladatum->default_type == DEFAULT_TARGET) {
newcontext.type = tcontext->type;
+ } else {
+ if ((tclass == policydb.process_class) || (sock == true)) {
+ /* Use the type of process. */
+ newcontext.type = scontext->type;
+ } else {
+ /* Use the type of the related object. */
+ newcontext.type = tcontext->type;
+ }
}
/* Look for a type transition/member/change rule. */