mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-24 14:17:41 -05:00
Netgroup nisdomain and hosts validation
nisdomain validation: Added pattern to the 'nisdomain' parameter to validate the specified nisdomain name. According to most common use cases the same pattern as for netgroup should fit. Unit-tests added. https://fedorahosted.org/freeipa/ticket/2448 'add_external_pre_callback' function was created to allow validation of all external members. Validation is based on usage of objects primary key parameter. The 'add_external_pre_callback' fucntion has to be called directly from in the 'pre_callback' function. This change affects netgroup, hbacrule and sudorule commands. For hostname, the validator allows non-fqdn and underscore characters. validate_hostname function in ipalib.util was modified and contains additional option that allows hostname to contain underscore characters. This option is disabled by default. Unit-tests added. https://fedorahosted.org/freeipa/ticket/2447
This commit is contained in:
1 parent
159e848d85
commit
5cfee2338d
10 files changed
+165
-31
No files matched your search
@@ -431,7 +431,7 @@ class sudorule_add_user(LDAPAddMember):
|
||||
self.obj.handle_not_found(*keys)
|
||||
if is_all(_entry_attrs, 'usercategory'):
|
||||
raise errors.MutuallyExclusiveError(reason=_("users cannot be added when user category='all'"))
|
||||
return dn
|
||||
return add_external_pre_callback('user', ldap, dn, keys, options)
|
||||
|
||||
def post_callback(self, ldap, completed, failed, dn, entry_attrs, *keys, **options):
|
||||
return add_external_post_callback('memberuser', 'user', 'externaluser', ldap, completed, failed, dn, entry_attrs, keys, options)
|
||||
@@ -464,7 +464,7 @@ class sudorule_add_host(LDAPAddMember):
|
||||
self.obj.handle_not_found(*keys)
|
||||
if is_all(_entry_attrs, 'hostcategory'):
|
||||
raise errors.MutuallyExclusiveError(reason=_("hosts cannot be added when host category='all'"))
|
||||
return dn
|
||||
return add_external_pre_callback('host', ldap, dn, keys, options)
|
||||
|
||||
def post_callback(self, ldap, completed, failed, dn, entry_attrs, *keys, **options):
|
||||
return add_external_post_callback('memberhost', 'host', 'externalhost', ldap, completed, failed, dn, entry_attrs, keys, options)
|
||||
@@ -517,7 +517,7 @@ class sudorule_add_runasuser(LDAPAddMember):
|
||||
error=unicode(_("RunAsUser does not accept '%(name)s' as a group name")) %
|
||||
dict(name=name))
|
||||
|
||||
return dn
|
||||
return add_external_pre_callback('user', ldap, dn, keys, options)
|
||||
|
||||
def post_callback(self, ldap, completed, failed, dn, entry_attrs, *keys, **options):
|
||||
return add_external_post_callback('ipasudorunas', 'user', 'ipasudorunasextuser', ldap, completed, failed, dn, entry_attrs, keys, options)
|
||||
@@ -565,7 +565,7 @@ class sudorule_add_runasgroup(LDAPAddMember):
|
||||
error=unicode(_("RunAsGroup does not accept '%(name)s' as a group name")) %
|
||||
dict(name=name))
|
||||
|
||||
return dn
|
||||
return add_external_pre_callback('group', ldap, dn, keys, options)
|
||||
|
||||
def post_callback(self, ldap, completed, failed, dn, entry_attrs, *keys, **options):
|
||||
return add_external_post_callback('ipasudorunasgroup', 'group', 'ipasudorunasextgroup', ldap, completed, failed, dn, entry_attrs, keys, options)
|
||||
|
||||
Reference in new issue
Block a user