Revert "selinux: add security_sid_to_context_type() function"

This reverts commit 16e5331962.
This commit is contained in:
Ksawlii 2024-12-13 19:44:19 +01:00
parent 352f8ae637
commit 7713ceb1f7
2 changed files with 0 additions and 31 deletions

View file

@ -329,8 +329,6 @@ int security_change_sid(struct selinux_state *state, u32 ssid, u32 tsid,
int security_sid_to_context(struct selinux_state *state, u32 sid, int security_sid_to_context(struct selinux_state *state, u32 sid,
char **scontext, u32 *scontext_len); char **scontext, u32 *scontext_len);
int security_sid_to_context_type(struct selinux_state *state, u32 sid, u32 *out);
int security_sid_to_context_force(struct selinux_state *state, int security_sid_to_context_force(struct selinux_state *state,
u32 sid, char **scontext, u32 *scontext_len); u32 sid, char **scontext, u32 *scontext_len);

View file

@ -1386,35 +1386,6 @@ out_unlock:
} }
// based on security_sid_to_context_core() above
int security_sid_to_context_type(struct selinux_state *state, u32 sid, u32 *out)
{
struct selinux_policy *policy;
struct policydb *policydb;
struct sidtab *sidtab;
struct sidtab_entry *entry;
int rc = 0;
rcu_read_lock();
policy = rcu_dereference(state->policy);
policydb = &policy->policydb;
sidtab = policy->sidtab;
entry = sidtab_search_entry(sidtab, sid);
if (!entry) {
pr_err("SELinux: %s: unrecognized SID %d\n", __func__, sid);
rc = -EINVAL;
goto out_unlock;
}
*out = entry->context.type;
out_unlock:
rcu_read_unlock();
return rc;
}
/** /**
* security_sid_to_context - Obtain a context for a given SID. * security_sid_to_context - Obtain a context for a given SID.
* @sid: security identifier, SID * @sid: security identifier, SID