Commit c900ff323d761753a56d8d6a67b034ceee277b6e
Committed by
Eric Paris
1 parent
63a312ca55
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff
security/selinux/ss/policydb.c
... | ... | @@ -2535,8 +2535,9 @@ |
2535 | 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 | 2541 | struct role_trans *tr; |
2541 | 2542 | u32 buf[3]; |
2542 | 2543 | size_t nel; |
... | ... | @@ -2556,6 +2557,12 @@ |
2556 | 2557 | rc = put_entry(buf, sizeof(u32), 3, fp); |
2557 | 2558 | if (rc) |
2558 | 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 | 2568 | return 0; |
... | ... | @@ -3267,7 +3274,7 @@ |
3267 | 3274 | if (rc) |
3268 | 3275 | return rc; |
3269 | 3276 | |
3270 | - rc = role_trans_write(p->role_tr, fp); | |
3277 | + rc = role_trans_write(p, fp); | |
3271 | 3278 | if (rc) |
3272 | 3279 | return rc; |
3273 | 3280 |