From 360aa69d92f124a4ec33f91f79ad1cf075440437 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 16 Mar 2015 14:33:53 -0400 Subject: [PATCH] Fix LDAP error and url handling to be more clear for the end user --- static/directives/config/config-setup-tool.html | 8 +++++++- util/config/validator.py | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/static/directives/config/config-setup-tool.html b/static/directives/config/config-setup-tool.html index 2ed51dd5c..219dea4a3 100644 --- a/static/directives/config/config-setup-tool.html +++ b/static/directives/config/config-setup-tool.html @@ -309,7 +309,13 @@ - + diff --git a/util/config/validator.py b/util/config/validator.py index 271ce678e..b009cc0c0 100644 --- a/util/config/validator.py +++ b/util/config/validator.py @@ -232,12 +232,17 @@ def _validate_ldap(config): raise Exception('Missing Admin Password for LDAP configuration') ldap_uri = config.get('LDAP_URI', 'ldap://localhost') + if not ldap_uri.startswith('ldap://') and not ldap_uri.startswith('ldaps://'): + raise Exception('LDAP URI must start with ldap:// or ldaps://') try: with LDAPConnection(ldap_uri, admin_dn, admin_passwd): pass except ldap.LDAPError as ex: values = ex.args[0] if ex.args else {} + if not isinstance(values, dict): + raise Exception(str(ex.args)) + raise Exception(values.get('desc', 'Unknown error'))
LDAP URI: + +
+ The full LDAP URI, including the ldap:// or ldaps:// prefix. +
+
Administrator DN: