Skip to content

Commit

Permalink
SELinux: Write class field in role_trans_write.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by:  Stephen Smalley <[email protected]>
Signed-off-by: Eric Paris <[email protected]>
  • Loading branch information
qcao-zz authored and eparis committed Mar 28, 2011
1 parent 63a312c commit c900ff3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2535,8 +2535,9 @@ static int cat_write(void *vkey, void *datum, void *ptr)
return 0;
}

static int role_trans_write(struct role_trans *r, void *fp)
static int role_trans_write(struct policydb *p, void *fp)
{
struct role_trans *r = p->role_tr;
struct role_trans *tr;
u32 buf[3];
size_t nel;
Expand All @@ -2556,6 +2557,12 @@ static int role_trans_write(struct role_trans *r, void *fp)
rc = put_entry(buf, sizeof(u32), 3, fp);
if (rc)
return rc;
if (p->policyvers >= POLICYDB_VERSION_ROLETRANS) {
buf[0] = cpu_to_le32(tr->tclass);
rc = put_entry(buf, sizeof(u32), 1, fp);
if (rc)
return rc;
}
}

return 0;
Expand Down Expand Up @@ -3267,7 +3274,7 @@ int policydb_write(struct policydb *p, void *fp)
if (rc)
return rc;

rc = role_trans_write(p->role_tr, fp);
rc = role_trans_write(p, fp);
if (rc)
return rc;

Expand Down

0 comments on commit c900ff3

Please sign in to comment.