mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix validator for SELinux user map settings in config plugin.
We need to compare two values and need to be aware of where those values are coming from. They may come from options, setattr or existing config. The format of that data is going to be different depending on its source (always a list internally). One may also set both at the same time so a standard validator cannot be used because it lacks the context of the other value being set. https://fedorahosted.org/freeipa/ticket/2938 https://fedorahosted.org/freeipa/ticket/2940
This commit is contained in:
@@ -60,4 +60,32 @@ class test_config(Declarative):
|
||||
expected=errors.RequirementError(name='ipausersearchfields'),
|
||||
),
|
||||
|
||||
dict(
|
||||
desc='Try to set invalid ipaselinuxusermapdefault',
|
||||
command=('config_mod', [],
|
||||
dict(ipaselinuxusermapdefault=u'unknown_u:s0')),
|
||||
expected=errors.ValidationError(name='ipaselinuxusermapdefault', error='SELinux user map default user not in order list'),
|
||||
),
|
||||
|
||||
dict(
|
||||
desc='Try to set invalid ipaselinuxusermapdefault with setattr',
|
||||
command=('config_mod', [],
|
||||
dict(setattr=u'ipaselinuxusermapdefault=unknown_u:s0')),
|
||||
expected=errors.ValidationError(name='ipaselinuxusermapdefault', error='SELinux user map default user not in order list'),
|
||||
),
|
||||
|
||||
dict(
|
||||
desc='Try to set invalid ipaselinuxusermaporder',
|
||||
command=('config_mod', [],
|
||||
dict(ipaselinuxusermaporder=u'notfound_u:s0')),
|
||||
expected=errors.ValidationError(name='ipaselinuxusermaporder', error='SELinux user map default user not in order list'),
|
||||
),
|
||||
|
||||
dict(
|
||||
desc='Try to set new selinux order and invalid default user',
|
||||
command=('config_mod', [],
|
||||
dict(ipaselinuxusermaporder=u'$xguest_u:s0$guest_u:s0$user_u:s0-s0:c0.c1023$staff_u:s0-s0:c0.c1023$unconfined_u:s0-s0:c0.c1023', ipaselinuxusermapdefault=u'unknown_u:s0')),
|
||||
expected=errors.ValidationError(name='ipaselinuxusermapdefault', error='SELinux user map default user not in order list'),
|
||||
),
|
||||
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user