mirror of
https://github.com/topjohnwu/selinux.git
synced 2025-03-01 16:05:40 +00:00
libsepol: validate genfs contexts
Check the literal contexts in a genfs statement are defined. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
8628133757
commit
88e280a1d9
@ -779,6 +779,25 @@ bad:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int validate_genfs(sepol_handle_t *handle, policydb_t *p, validate_t flavors[])
|
||||
{
|
||||
genfs_t *genfs;
|
||||
ocontext_t *octx;
|
||||
|
||||
for (genfs = p->genfs; genfs; genfs = genfs->next) {
|
||||
for (octx = genfs->head; octx; octx = octx->next) {
|
||||
if (validate_context(&octx->context[0], flavors, p->mls))
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
ERR(handle, "Invalid genfs");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions to validate a module policydb
|
||||
*/
|
||||
@ -982,6 +1001,9 @@ int validate_policydb(sepol_handle_t *handle, policydb_t *p)
|
||||
if (validate_ocontexts(handle, p, flavors))
|
||||
goto bad;
|
||||
|
||||
if (validate_genfs(handle, p, flavors))
|
||||
goto bad;
|
||||
|
||||
if (validate_scopes(handle, p->scope, p->global))
|
||||
goto bad;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user