SELinux: Compute role in newcontext for all classes
authorHarry Ciao <harrytaurus200@hotmail.com>
Fri, 25 Mar 2011 05:51:58 +0000 (13:51 +0800)
committerEric Paris <eparis@redhat.com>
Mon, 28 Mar 2011 18:21:01 +0000 (14:21 -0400)
Apply role_transition rules for all kinds of classes.

Signed-off-by: Harry Ciao <qingtao.cao@windriver.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Eric Paris <eparis@redhat.com>
security/selinux/ss/services.c

index 3e7544d2a07bb617e4d7a4eaee6cf6dcb0dd6c63..03f7a4748ee8fed8f6d92dcc863fda60e5b715fe 100644 (file)
@@ -1484,17 +1484,15 @@ static int security_compute_sid(u32 ssid,
                                      tcontext->type, tclass, qstr);
 
        /* Check for class-specific changes. */
-       if  (tclass == policydb.process_class) {
-               if (specified & AVTAB_TRANSITION) {
-                       /* Look for a role transition rule. */
-                       for (roletr = policydb.role_tr; roletr;
-                            roletr = roletr->next) {
-                               if (roletr->role == scontext->role &&
-                                   roletr->type == tcontext->type) {
-                                       /* Use the role transition rule. */
-                                       newcontext.role = roletr->new_role;
-                                       break;
-                               }
+       if (specified & AVTAB_TRANSITION) {
+               /* Look for a role transition rule. */
+               for (roletr = policydb.role_tr; roletr; roletr = roletr->next) {
+                       if ((roletr->role == scontext->role) &&
+                           (roletr->type == tcontext->type) &&
+                           (roletr->tclass == tclass)) {
+                               /* Use the role transition rule. */
+                               newcontext.role = roletr->new_role;
+                               break;
                        }
                }
        }