Raise the proper IPA exception when a value isn't a valid DN.

rob
>From 916f1e9b80c0f8bc88da2651a44d0d33ad3bec30 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Wed, 15 Aug 2012 16:30:24 -0400
Subject: [PATCH] Raise proper exception when given a bad DN attribute.

---
 ipalib/plugins/baseldap.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index e05f59ff4224bbfaf1c57989e1a3616c87b6996e..011d626291b797406c63c249e6d315429f260ad7 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -809,7 +809,10 @@ last, after all sets and adds."""),
                 value = None
 
             if ldap.has_dn_syntax(attr):
-                value = DN(value)
+                try:
+                    value = DN(value)
+                except ValueError:
+                    raise errors.InvalidSyntax(attr=attr)
 
             if attr in newdict:
                 if type(value) in (tuple,):
-- 
1.7.10.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to