From 017022eae9f74c662acd048418b105717c604c43 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 31 May 2017 13:36:25 +0200 Subject: [PATCH] Fixed issue #1114 - Configuration of LDAP with disabled anonymous bind fails. --- .../app/controllers/_integration/ldap.coffee | 13 +++++++------ .../integration/ldap_controller.rb | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_integration/ldap.coffee b/app/assets/javascripts/app/controllers/_integration/ldap.coffee index b497b0f05..dc0bbbdef 100644 --- a/app/assets/javascripts/app/controllers/_integration/ldap.coffee +++ b/app/assets/javascripts/app/controllers/_integration/ldap.coffee @@ -287,12 +287,13 @@ class ConnectionWizard extends App.WizardModal option = '' options = {} - for dn in data.attributes.namingcontexts - options[dn] = dn - if option is '' - option = dn - if option.length > dn.length - option = dn + if !_.isEmpty data.attributes + for dn in data.attributes.namingcontexts + options[dn] = dn + if option is '' + option = dn + if option.length > dn.length + option = dn @wizardConfig.options = options @wizardConfig.option = option diff --git a/app/controllers/integration/ldap_controller.rb b/app/controllers/integration/ldap_controller.rb index ff91b292f..16d2393fb 100644 --- a/app/controllers/integration/ldap_controller.rb +++ b/app/controllers/integration/ldap_controller.rb @@ -14,12 +14,21 @@ class Integration::LdapController < ApplicationController attributes: ldap.preferences, } rescue => e - logger.error e + # workaround for issue #1114 + if e.message.end_with?(', 48, Inappropriate Authentication') + result = { + result: 'ok', + attributes: {}, + } + else + logger.error e + result = { + result: 'failed', + message: e.message, + } + end - render json: { - result: 'failed', - message: e.message, - } + render json: result end def bind