From 38dded7db6529be096b92c9d63182a980e0b3a93 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Thu, 3 Jan 2013 08:40:40 -0500 Subject: Raise ValidationError for incorrect subtree option. Ticket: https://fedorahosted.org/freeipa/ticket/3233 --- ipalib/plugins/aci.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipalib/plugins/aci.py') diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py index 24be17458..7c4e8a549 100644 --- a/ipalib/plugins/aci.py +++ b/ipalib/plugins/aci.py @@ -341,7 +341,10 @@ def _aci_to_kw(ldap, a, test=False, pkey_only=False): else: # See if the target is a group. If so we set the # targetgroup attr, otherwise we consider it a subtree - targetdn = DN(target.replace('ldap:///','')) + try: + targetdn = DN(target.replace('ldap:///','')) + except ValueError as e: + raise errors.ValidationError(name='subtree', error=_("invalid DN (%s)") % e.message) if targetdn.endswith(DN(api.env.container_group, api.env.basedn)): kw['targetgroup'] = targetdn[0]['cn'] else: -- cgit