mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-18 20:24:32 +00:00
libsepol: validate class default targets
Check the class default targets are valid values, e.g. source or target for user, role and type. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
24618ad3f5
commit
5e6e516ee0
@ -258,6 +258,47 @@ static int validate_class_datum(sepol_handle_t *handle, class_datum_t *class, va
|
||||
if (class->permissions.nprim > PERM_SYMTAB_SIZE)
|
||||
goto bad;
|
||||
|
||||
switch (class->default_user) {
|
||||
case 0:
|
||||
case DEFAULT_SOURCE:
|
||||
case DEFAULT_TARGET:
|
||||
break;
|
||||
default:
|
||||
goto bad;
|
||||
}
|
||||
|
||||
switch (class->default_role) {
|
||||
case 0:
|
||||
case DEFAULT_SOURCE:
|
||||
case DEFAULT_TARGET:
|
||||
break;
|
||||
default:
|
||||
goto bad;
|
||||
}
|
||||
|
||||
switch (class->default_type) {
|
||||
case 0:
|
||||
case DEFAULT_SOURCE:
|
||||
case DEFAULT_TARGET:
|
||||
break;
|
||||
default:
|
||||
goto bad;
|
||||
}
|
||||
|
||||
switch (class->default_range) {
|
||||
case 0:
|
||||
case DEFAULT_SOURCE_LOW:
|
||||
case DEFAULT_SOURCE_HIGH:
|
||||
case DEFAULT_SOURCE_LOW_HIGH:
|
||||
case DEFAULT_TARGET_LOW:
|
||||
case DEFAULT_TARGET_HIGH:
|
||||
case DEFAULT_TARGET_LOW_HIGH:
|
||||
case DEFAULT_GLBLUB:
|
||||
break;
|
||||
default:
|
||||
goto bad;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
|
Loading…
Reference in New Issue
Block a user