Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192421
b: refs/heads/master
c: a200005
h: refs/heads/master
i:
  192419: 7d9ec56
v: v3
  • Loading branch information
Eric Paris authored and James Morris committed Apr 20, 2010
1 parent d680766 commit 55f0190
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 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: 6f262d8e1acb7b1605b811700326163fa707d355
refs/heads/master: a200005038955057063fc8ea82129ebc785df41c
37 changes: 22 additions & 15 deletions trunk/security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,22 +1760,28 @@ int security_load_policy(void *data, size_t len)

if (!ss_initialized) {
avtab_cache_init();
if (policydb_read(&policydb, fp)) {
rc = policydb_read(&policydb, fp);
if (rc) {
avtab_cache_destroy();
return -EINVAL;
return rc;
}
if (selinux_set_mapping(&policydb, secclass_map,
&current_mapping,
&current_mapping_size)) {

rc = selinux_set_mapping(&policydb, secclass_map,
&current_mapping,
&current_mapping_size);
if (rc) {
policydb_destroy(&policydb);
avtab_cache_destroy();
return -EINVAL;
return rc;
}
if (policydb_load_isids(&policydb, &sidtab)) {

rc = policydb_load_isids(&policydb, &sidtab);
if (rc) {
policydb_destroy(&policydb);
avtab_cache_destroy();
return -EINVAL;
return rc;
}

security_load_policycaps();
ss_initialized = 1;
seqno = ++latest_granting;
Expand All @@ -1791,8 +1797,9 @@ int security_load_policy(void *data, size_t len)
sidtab_hash_eval(&sidtab, "sids");
#endif

if (policydb_read(&newpolicydb, fp))
return -EINVAL;
rc = policydb_read(&newpolicydb, fp);
if (rc)
return rc;

/* If switching between different policy types, log MLS status */
if (policydb.mls_enabled && !newpolicydb.mls_enabled)
Expand All @@ -1807,8 +1814,8 @@ int security_load_policy(void *data, size_t len)
return rc;
}

if (selinux_set_mapping(&newpolicydb, secclass_map,
&map, &map_size))
rc = selinux_set_mapping(&newpolicydb, secclass_map, &map, &map_size);
if (rc)
goto err;

rc = security_preserve_bools(&newpolicydb);
Expand All @@ -1819,10 +1826,10 @@ int security_load_policy(void *data, size_t len)

/* Clone the SID table. */
sidtab_shutdown(&sidtab);
if (sidtab_map(&sidtab, clone_sid, &newsidtab)) {
rc = -ENOMEM;

rc = sidtab_map(&sidtab, clone_sid, &newsidtab);
if (rc)
goto err;
}

/*
* Convert the internal representations of contexts
Expand Down

0 comments on commit 55f0190

Please sign in to comment.