mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-17 10:50:43 +00:00
libsepol: introduce sepol_const_security_context_t typedef
The typedef `sepol_security_context_t` is used for contexts. For the read-only input parameter in `sepol_context_to_sid()` `const sepol_security_context_t` is used as type, which does not expand to the expected `const char*` but `char *const`. Introduce a corresponding typedef for `const char*`. Acked-by: James Carter <jwcart2@gmail.com> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
f0e085f684
commit
3ae07ec36f
@ -27,6 +27,7 @@ extern "C" {
|
||||
* understanding of the security policy.
|
||||
*/
|
||||
typedef char *sepol_security_context_t;
|
||||
typedef const char *sepol_const_security_context_t;
|
||||
|
||||
/*
|
||||
* An access vector (AV) is a collection of related permissions
|
||||
|
@ -155,7 +155,7 @@ extern int sepol_sid_to_context(sepol_security_id_t sid, /* IN */
|
||||
* Return a SID associated with the security context that
|
||||
* has the string representation specified by `scontext'.
|
||||
*/
|
||||
extern int sepol_context_to_sid(const sepol_security_context_t scontext, /* IN */
|
||||
extern int sepol_context_to_sid(sepol_const_security_context_t scontext, /* IN */
|
||||
size_t scontext_len, /* IN */
|
||||
sepol_security_id_t * out_sid); /* OUT */
|
||||
|
||||
|
@ -22,7 +22,7 @@ int policydb_context_isvalid(const policydb_t * p, const context_struct_t * c)
|
||||
int sepol_check_context(const char *context)
|
||||
{
|
||||
|
||||
return sepol_context_to_sid((const sepol_security_context_t)context,
|
||||
return sepol_context_to_sid(context,
|
||||
strlen(context) + 1, NULL);
|
||||
}
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ int sepol_sid_to_context(sepol_security_id_t sid,
|
||||
* Return a SID associated with the security context that
|
||||
* has the string representation specified by `scontext'.
|
||||
*/
|
||||
int sepol_context_to_sid(const sepol_security_context_t scontext,
|
||||
int sepol_context_to_sid(sepol_const_security_context_t scontext,
|
||||
size_t scontext_len, sepol_security_id_t * sid)
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user