Module: check_mk
Branch: master
Commit: 096a92cd9b36f65b9e2f42b073b06d5ab26ca5e5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=096a92cd9b36f6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 19 14:52:08 2013 +0100
LDAP: Fixed bug in last commit
---
web/htdocs/wato.py | 4 ++++
web/plugins/config/builtin.py | 1 +
web/plugins/userdb/ldap.py | 5 ++++-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2a37ef0..2f6a0a5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6098,6 +6098,8 @@ def mode_ldap_config(phase):
return (False, msg)
def test_user_base_dn(address):
+ if not userdb.ldap_user_base_dn_configured():
+ return (False, _('The User Base DN is not configured.'))
userdb.ldap_connect(enforce_new = True, enforce_server = address)
if userdb.ldap_user_base_dn_exists():
return (True, _('The User Base DN could be found.'))
@@ -6110,6 +6112,8 @@ def mode_ldap_config(phase):
'to configure proper bind credentials.'))
def test_user_count(address):
+ if not userdb.ldap_user_base_dn_configured():
+ return (False, _('The User Base DN is not configured.'))
userdb.ldap_connect(enforce_new = True, enforce_server = address)
try:
ldap_users = userdb.ldap_get_users()
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index 8881a22..0dc9f35 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -215,6 +215,7 @@ escape_plugin_output = True
user_connectors = ['htpasswd']
userdb_automatic_sync = [ 'wato_users', 'page',
'wato_pre_activate_changes', 'wato_snapshot_pushed' ]
ldap_connection = {
+ 'type' : 'ad',
'page_size' : 1000,
}
ldap_userspec = {
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 43c04e3..644c56b 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -438,6 +438,9 @@ def ldap_member_attr():
def ldap_bind_credentials_configured():
return config.ldap_connection.get('bind', ('', ''))[0] !=
''
+def ldap_user_base_dn_configured():
+ return config.ldap_userspec.get('dn', '') != ''
+
def ldap_group_base_dn_configured():
return config.ldap_groupspec.get('dn', '') != ''
@@ -943,7 +946,7 @@ def ldap_sync(add_to_changelog, only_username):
# requests to e.g. the page hook would cause duplicate calculations
file(g_ldap_sync_time_file, 'w').write('%s\n' % time.time())
- if not config.ldap_connection:
+ if not config.ldap_connection or not ldap_user_base_dn_configured():
return # silently skip sync without configuration
# Flush ldap related before each sync to have a caching only for the