mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Prevent collisions of hostgroup and netgroup
For every hostgroup a managed netgroup is created (if this is allowed). Make sure that if a stand-alone netgroup exists, a hostgroup with the same name cannot be created to prevent collisions. https://fedorahosted.org/freeipa/ticket/1914
This commit is contained in:
parent
acb2c3106a
commit
a85bb7fa9e
@ -115,6 +115,17 @@ class hostgroup_add(LDAPCreate):
|
||||
|
||||
msg_summary = _('Added hostgroup "%(value)s"')
|
||||
|
||||
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
||||
try:
|
||||
netgroup = api.Command['netgroup_show'](keys[-1])
|
||||
raise errors.DuplicateEntry(message=unicode(_(\
|
||||
u'netgroup with name "%s" already exists' % keys[-1]\
|
||||
)))
|
||||
except errors.NotFound:
|
||||
pass
|
||||
|
||||
return dn
|
||||
|
||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
# Always wait for the associated netgroup to be created so we can
|
||||
# be sure to ignore it in memberOf
|
||||
|
Loading…
Reference in New Issue
Block a user