Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227805
b: refs/heads/master
c: 7ae9f23
h: refs/heads/master
i:
  227803: 811d68d
v: v3
  • Loading branch information
Eric Paris committed Nov 30, 2010
1 parent eb1efec commit b93d6ea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b02b524487622ce1cf472123899520b583f47dc
refs/heads/master: 7ae9f23cbd3ef9daff7f768da4bfd4c56b19300d
42 changes: 21 additions & 21 deletions trunk/security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -3041,7 +3041,7 @@ static void security_netlbl_cache_add(struct netlbl_lsm_secattr *secattr,
int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
u32 *sid)
{
int rc = -EIDRM;
int rc;
struct context *ctx;
struct context ctx_new;

Expand All @@ -3052,51 +3052,51 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,

read_lock(&policy_rwlock);

if (secattr->flags & NETLBL_SECATTR_CACHE) {
if (secattr->flags & NETLBL_SECATTR_CACHE)
*sid = *(u32 *)secattr->cache->data;
rc = 0;
} else if (secattr->flags & NETLBL_SECATTR_SECID) {
else if (secattr->flags & NETLBL_SECATTR_SECID)
*sid = secattr->attr.secid;
rc = 0;
} else if (secattr->flags & NETLBL_SECATTR_MLS_LVL) {
else if (secattr->flags & NETLBL_SECATTR_MLS_LVL) {
rc = -EIDRM;
ctx = sidtab_search(&sidtab, SECINITSID_NETMSG);
if (ctx == NULL)
goto netlbl_secattr_to_sid_return;
goto out;

context_init(&ctx_new);
ctx_new.user = ctx->user;
ctx_new.role = ctx->role;
ctx_new.type = ctx->type;
mls_import_netlbl_lvl(&ctx_new, secattr);
if (secattr->flags & NETLBL_SECATTR_MLS_CAT) {
if (ebitmap_netlbl_import(&ctx_new.range.level[0].cat,
secattr->attr.mls.cat) != 0)
goto netlbl_secattr_to_sid_return;
rc = ebitmap_netlbl_import(&ctx_new.range.level[0].cat,
secattr->attr.mls.cat);
if (rc)
goto out;
memcpy(&ctx_new.range.level[1].cat,
&ctx_new.range.level[0].cat,
sizeof(ctx_new.range.level[0].cat));
}
if (mls_context_isvalid(&policydb, &ctx_new) != 1)
goto netlbl_secattr_to_sid_return_cleanup;
rc = -EIDRM;
if (!mls_context_isvalid(&policydb, &ctx_new))
goto out_free;

rc = sidtab_context_to_sid(&sidtab, &ctx_new, sid);
if (rc != 0)
goto netlbl_secattr_to_sid_return_cleanup;
if (rc)
goto out_free;

security_netlbl_cache_add(secattr, *sid);

ebitmap_destroy(&ctx_new.range.level[0].cat);
} else {
} else
*sid = SECSID_NULL;
rc = 0;
}

netlbl_secattr_to_sid_return:
read_unlock(&policy_rwlock);
return rc;
netlbl_secattr_to_sid_return_cleanup:
return 0;
out_free:
ebitmap_destroy(&ctx_new.range.level[0].cat);
goto netlbl_secattr_to_sid_return;
out:
read_unlock(&policy_rwlock);
return rc;
}

/**
Expand Down

0 comments on commit b93d6ea

Please sign in to comment.