@@ -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)
{
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*`. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- libsepol/include/sepol/policydb/flask_types.h | 1 + libsepol/include/sepol/policydb/services.h | 2 +- libsepol/src/context.c | 2 +- libsepol/src/services.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-)