mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Limit allowed characters in a netgroup name to alpha, digit, -, _ and .
Apply this to hostgroup names as well since they can be linked. https://fedorahosted.org/freeipa/ticket/2221
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import api, Int, _, ngettext, errors
|
||||
from ipalib.plugins.netgroup import NETGROUP_PATTERN, NETGROUP_PATTERN_ERRMSG
|
||||
from ipalib.dn import DN
|
||||
|
||||
__doc__ = _("""
|
||||
@@ -76,6 +77,8 @@ class hostgroup(LDAPObject):
|
||||
|
||||
takes_params = (
|
||||
Str('cn',
|
||||
pattern=NETGROUP_PATTERN,
|
||||
pattern_errmsg=NETGROUP_PATTERN_ERRMSG,
|
||||
cli_name='hostgroup_name',
|
||||
label=_('Host-group'),
|
||||
doc=_('Name of host-group'),
|
||||
|
||||
@@ -49,6 +49,10 @@ EXAMPLES:
|
||||
ipa netgroup-del admins
|
||||
""")
|
||||
|
||||
|
||||
NETGROUP_PATTERN='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$'
|
||||
NETGROUP_PATTERN_ERRMSG='may only include letters, numbers, _, -, and .'
|
||||
|
||||
output_params = (
|
||||
Str('memberuser_user?',
|
||||
label='Member User',
|
||||
@@ -101,6 +105,8 @@ class netgroup(LDAPObject):
|
||||
|
||||
takes_params = (
|
||||
Str('cn',
|
||||
pattern=NETGROUP_PATTERN,
|
||||
pattern_errmsg=NETGROUP_PATTERN_ERRMSG,
|
||||
cli_name='name',
|
||||
label=_('Netgroup name'),
|
||||
primary_key=True,
|
||||
|
||||
Reference in New Issue
Block a user