@@ -26,7 +26,7 gem "rbpdf", "~> 1.19.0" | |||
|
26 | 26 | |
|
27 | 27 | # Optional gem for LDAP authentication |
|
28 | 28 | group :ldap do |
|
29 |
gem "net-ldap", "~> 0.12. |
|
|
29 | gem "net-ldap", "~> 0.12.1" | |
|
30 | 30 | end |
|
31 | 31 | |
|
32 | 32 | # Optional gem for OpenID authentication |
@@ -21,7 +21,7 require 'timeout' | |||
|
21 | 21 | |
|
22 | 22 | class AuthSourceLdap < AuthSource |
|
23 | 23 | NETWORK_EXCEPTIONS = [ |
|
24 |
Net::LDAP:: |
|
|
24 | Net::LDAP::Error, | |
|
25 | 25 | Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET, |
|
26 | 26 | Errno::EHOSTDOWN, Errno::EHOSTUNREACH, |
|
27 | 27 | SocketError |
@@ -117,7 +117,7 class AuthSourceLdap < AuthSource | |||
|
117 | 117 | if filter.present? |
|
118 | 118 | Net::LDAP::Filter.construct(filter) |
|
119 | 119 | end |
|
120 |
rescue Net::LDAP:: |
|
|
120 | rescue Net::LDAP::Error, Net::LDAP::FilterSyntaxInvalidError | |
|
121 | 121 | nil |
|
122 | 122 | end |
|
123 | 123 |
@@ -134,7 +134,7 class AuthSourcesControllerTest < Redmine::ControllerTest | |||
|
134 | 134 | end |
|
135 | 135 | |
|
136 | 136 | def test_test_connection_with_failure |
|
137 |
AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP:: |
|
|
137 | AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::Error.new("Something went wrong")) | |
|
138 | 138 | |
|
139 | 139 | get :test_connection, :id => 1 |
|
140 | 140 | assert_redirected_to '/auth_sources' |
@@ -150,7 +150,7 class AuthSourceLdapTest < ActiveSupport::TestCase | |||
|
150 | 150 | end |
|
151 | 151 | |
|
152 | 152 | def test_search_with_exception_should_return_an_empty_array |
|
153 |
Net::LDAP.stubs(:new).raises(Net::LDAP:: |
|
|
153 | Net::LDAP.stubs(:new).raises(Net::LDAP::Error, 'Cannot connect') | |
|
154 | 154 | |
|
155 | 155 | results = AuthSource.search("exa") |
|
156 | 156 | assert_equal [], results |
@@ -643,7 +643,7 class UserTest < ActiveSupport::TestCase | |||
|
643 | 643 | if ldap_configured? |
|
644 | 644 | test "#try_to_login using LDAP with failed connection to the LDAP server" do |
|
645 | 645 | auth_source = AuthSourceLdap.find(1) |
|
646 |
AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP:: |
|
|
646 | AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::Error, 'Cannot connect') | |
|
647 | 647 | |
|
648 | 648 | assert_nil User.try_to_login('edavis', 'wrong') |
|
649 | 649 | end |
General Comments 0
You need to be logged in to leave comments.
Login now