diff options
Diffstat (limited to 'security/selinux/ss/policydb.c')
-rw-r--r-- | security/selinux/ss/policydb.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index a7f61d52f05c..2bb9c2fd5f1a 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -133,6 +133,11 @@ static struct policydb_compat_info policydb_compat[] = { | |||
133 | .sym_num = SYM_NUM, | 133 | .sym_num = SYM_NUM, |
134 | .ocon_num = OCON_NUM, | 134 | .ocon_num = OCON_NUM, |
135 | }, | 135 | }, |
136 | { | ||
137 | .version = POLICYDB_VERSION_NEW_OBJECT_DEFAULTS, | ||
138 | .sym_num = SYM_NUM, | ||
139 | .ocon_num = OCON_NUM, | ||
140 | }, | ||
136 | }; | 141 | }; |
137 | 142 | ||
138 | static struct policydb_compat_info *policydb_lookup_compat(int version) | 143 | static struct policydb_compat_info *policydb_lookup_compat(int version) |
@@ -1306,6 +1311,16 @@ static int class_read(struct policydb *p, struct hashtab *h, void *fp) | |||
1306 | goto bad; | 1311 | goto bad; |
1307 | } | 1312 | } |
1308 | 1313 | ||
1314 | if (p->policyvers >= POLICYDB_VERSION_NEW_OBJECT_DEFAULTS) { | ||
1315 | rc = next_entry(buf, fp, sizeof(u32) * 3); | ||
1316 | if (rc) | ||
1317 | goto bad; | ||
1318 | |||
1319 | cladatum->default_user = le32_to_cpu(buf[0]); | ||
1320 | cladatum->default_role = le32_to_cpu(buf[1]); | ||
1321 | cladatum->default_range = le32_to_cpu(buf[2]); | ||
1322 | } | ||
1323 | |||
1309 | rc = hashtab_insert(h, key, cladatum); | 1324 | rc = hashtab_insert(h, key, cladatum); |
1310 | if (rc) | 1325 | if (rc) |
1311 | goto bad; | 1326 | goto bad; |
@@ -2832,6 +2847,16 @@ static int class_write(void *vkey, void *datum, void *ptr) | |||
2832 | if (rc) | 2847 | if (rc) |
2833 | return rc; | 2848 | return rc; |
2834 | 2849 | ||
2850 | if (p->policyvers >= POLICYDB_VERSION_NEW_OBJECT_DEFAULTS) { | ||
2851 | buf[0] = cpu_to_le32(cladatum->default_user); | ||
2852 | buf[1] = cpu_to_le32(cladatum->default_role); | ||
2853 | buf[2] = cpu_to_le32(cladatum->default_range); | ||
2854 | |||
2855 | rc = put_entry(buf, sizeof(uint32_t), 3, fp); | ||
2856 | if (rc) | ||
2857 | return rc; | ||
2858 | } | ||
2859 | |||
2835 | return 0; | 2860 | return 0; |
2836 | } | 2861 | } |
2837 | 2862 | ||