selinux: introduce security_context_str_to_sid
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 21 Oct 2015 21:44:25 +0000 (17:44 -0400)
committerPaul Moore <pmoore@redhat.com>
Wed, 21 Oct 2015 21:44:25 +0000 (17:44 -0400)
commit44be2f65d979291ffb2a47112449507ffe1f9726
tree9f3732d534de8425f6bf5d7519812263d0c292c9
parent44d37ad3602b3823764eeb0f6c1ee3ef6c4fb936
selinux: introduce security_context_str_to_sid

There seems to be a little confusion as to whether the scontext_len
parameter of security_context_to_sid() includes the nul-byte or
not. Reading security_context_to_sid_core(), it seems that the
expectation is that it does not (both the string copying and the test
for scontext_len being zero hint at that).

Introduce the helper security_context_str_to_sid() to do the strlen()
call and fix all callers.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
security/selinux/hooks.c
security/selinux/include/security.h
security/selinux/selinuxfs.c
security/selinux/ss/services.c