mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
idviews: Use case-insensitive detection of Default Trust View
The usage of lowercased varsion of 'Default Trust View' can no longer be used to bypass the validation. https://fedorahosted.org/freeipa/ticket/4915 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
8b199b813d
commit
93f3bb3ddd
@ -53,6 +53,7 @@ protected_default_trust_view_error = errors.ProtectedEntryError(
|
|||||||
reason=_('system ID View')
|
reason=_('system ID View')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DEFAULT_TRUST_VIEW_NAME = "default trust view"
|
||||||
|
|
||||||
@register()
|
@register()
|
||||||
class idview(LDAPObject):
|
class idview(LDAPObject):
|
||||||
@ -106,8 +107,9 @@ class idview_del(LDAPDelete):
|
|||||||
msg_summary = _('Deleted ID View "%(value)s"')
|
msg_summary = _('Deleted ID View "%(value)s"')
|
||||||
|
|
||||||
def pre_callback(self, ldap, dn, *keys, **options):
|
def pre_callback(self, ldap, dn, *keys, **options):
|
||||||
if "Default Trust View" in keys:
|
for key in keys:
|
||||||
raise protected_default_trust_view_error
|
if key.lower() == DEFAULT_TRUST_VIEW_NAME:
|
||||||
|
raise protected_default_trust_view_error
|
||||||
|
|
||||||
return dn
|
return dn
|
||||||
|
|
||||||
@ -118,8 +120,9 @@ class idview_mod(LDAPUpdate):
|
|||||||
msg_summary = _('Modified an ID View "%(value)s"')
|
msg_summary = _('Modified an ID View "%(value)s"')
|
||||||
|
|
||||||
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
||||||
if "Default Trust View" in keys:
|
for key in keys:
|
||||||
raise protected_default_trust_view_error
|
if key.lower() == DEFAULT_TRUST_VIEW_NAME:
|
||||||
|
raise protected_default_trust_view_error
|
||||||
|
|
||||||
return dn
|
return dn
|
||||||
|
|
||||||
@ -240,7 +243,7 @@ class baseidview_apply(LDAPQuery):
|
|||||||
# the ipaAssignedIDView to None
|
# the ipaAssignedIDView to None
|
||||||
view_dn = None
|
view_dn = None
|
||||||
|
|
||||||
if view == 'Default Trust View':
|
if view.lower() == DEFAULT_TRUST_VIEW_NAME:
|
||||||
raise errors.ValidationError(
|
raise errors.ValidationError(
|
||||||
name=_('ID View'),
|
name=_('ID View'),
|
||||||
error=_('Default Trust View cannot be applied on hosts')
|
error=_('Default Trust View cannot be applied on hosts')
|
||||||
@ -584,7 +587,7 @@ class baseidoverride(LDAPObject):
|
|||||||
# Check if parent object is Default Trust View, if so, prohibit
|
# Check if parent object is Default Trust View, if so, prohibit
|
||||||
# adding overrides for IPA objects
|
# adding overrides for IPA objects
|
||||||
|
|
||||||
if dn[1].value == 'Default Trust View':
|
if dn[1].value.lower() == DEFAULT_TRUST_VIEW_NAME:
|
||||||
if dn[0].value.startswith(IPA_ANCHOR_PREFIX):
|
if dn[0].value.startswith(IPA_ANCHOR_PREFIX):
|
||||||
raise errors.ValidationError(
|
raise errors.ValidationError(
|
||||||
name=_('ID View'),
|
name=_('ID View'),
|
||||||
|
Loading…
Reference in New Issue
Block a user