CRED: Wrap current->cred and a few other accessors
Wrap current->cred and a few other accessors to hide their actual implementation. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
parent
f1752eec61
commit
86a264abe5
27 changed files with 271 additions and 162 deletions
|
@ -39,9 +39,13 @@ EXPORT_SYMBOL_GPL(selinux_string_to_sid);
|
|||
int selinux_secmark_relabel_packet_permission(u32 sid)
|
||||
{
|
||||
if (selinux_enabled) {
|
||||
struct task_security_struct *tsec = current->cred->security;
|
||||
const struct task_security_struct *__tsec;
|
||||
u32 tsid;
|
||||
|
||||
return avc_has_perm(tsec->sid, sid, SECCLASS_PACKET,
|
||||
__tsec = current_security();
|
||||
tsid = __tsec->sid;
|
||||
|
||||
return avc_has_perm(tsid, sid, SECCLASS_PACKET,
|
||||
PACKET__RELABELTO, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -197,7 +197,7 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp,
|
|||
struct xfrm_user_sec_ctx *uctx, u32 sid)
|
||||
{
|
||||
int rc = 0;
|
||||
struct task_security_struct *tsec = current->cred->security;
|
||||
const struct task_security_struct *tsec = current_security();
|
||||
struct xfrm_sec_ctx *ctx = NULL;
|
||||
char *ctx_str = NULL;
|
||||
u32 str_len;
|
||||
|
@ -333,7 +333,7 @@ void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
|
|||
*/
|
||||
int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
|
||||
{
|
||||
struct task_security_struct *tsec = current->cred->security;
|
||||
const struct task_security_struct *tsec = current_security();
|
||||
int rc = 0;
|
||||
|
||||
if (ctx) {
|
||||
|
@ -378,7 +378,7 @@ void selinux_xfrm_state_free(struct xfrm_state *x)
|
|||
*/
|
||||
int selinux_xfrm_state_delete(struct xfrm_state *x)
|
||||
{
|
||||
struct task_security_struct *tsec = current->cred->security;
|
||||
const struct task_security_struct *tsec = current_security();
|
||||
struct xfrm_sec_ctx *ctx = x->security;
|
||||
int rc = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue