diff options
author | Harry Ciao <qingtao.cao@windriver.com> | 2011-03-25 01:52:00 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2011-03-28 14:21:05 -0400 |
commit | c900ff323d761753a56d8d6a67b034ceee277b6e (patch) | |
tree | 0294cfb5904eec80cf8e84004d46cb8734b714e7 /security/selinux | |
parent | 63a312ca55d09a3f6526919df495fff1073c88f4 (diff) |
SELinux: Write class field in role_trans_write.
If kernel policy version is >= 26, then write the class field of the
role_trans structure into the binary reprensentation.
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>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/ss/policydb.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index fd62c50d6e7d..a493eae24e0a 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -2535,8 +2535,9 @@ static int cat_write(void *vkey, void *datum, void *ptr) | |||
2535 | return 0; | 2535 | return 0; |
2536 | } | 2536 | } |
2537 | 2537 | ||
2538 | static int role_trans_write(struct role_trans *r, void *fp) | 2538 | static int role_trans_write(struct policydb *p, void *fp) |
2539 | { | 2539 | { |
2540 | struct role_trans *r = p->role_tr; | ||
2540 | struct role_trans *tr; | 2541 | struct role_trans *tr; |
2541 | u32 buf[3]; | 2542 | u32 buf[3]; |
2542 | size_t nel; | 2543 | size_t nel; |
@@ -2556,6 +2557,12 @@ static int role_trans_write(struct role_trans *r, void *fp) | |||
2556 | rc = put_entry(buf, sizeof(u32), 3, fp); | 2557 | rc = put_entry(buf, sizeof(u32), 3, fp); |
2557 | if (rc) | 2558 | if (rc) |
2558 | return rc; | 2559 | return rc; |
2560 | if (p->policyvers >= POLICYDB_VERSION_ROLETRANS) { | ||
2561 | buf[0] = cpu_to_le32(tr->tclass); | ||
2562 | rc = put_entry(buf, sizeof(u32), 1, fp); | ||
2563 | if (rc) | ||
2564 | return rc; | ||
2565 | } | ||
2559 | } | 2566 | } |
2560 | 2567 | ||
2561 | return 0; | 2568 | return 0; |
@@ -3267,7 +3274,7 @@ int policydb_write(struct policydb *p, void *fp) | |||
3267 | if (rc) | 3274 | if (rc) |
3268 | return rc; | 3275 | return rc; |
3269 | 3276 | ||
3270 | rc = role_trans_write(p->role_tr, fp); | 3277 | rc = role_trans_write(p, fp); |
3271 | if (rc) | 3278 | if (rc) |
3272 | return rc; | 3279 | return rc; |
3273 | 3280 | ||