summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/ldap.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-02-13 11:00:49 +0000
committerSteve Kemp <steve@steve.org.uk>2013-02-13 11:00:49 +0000
commita63e77193e1e49700e9d92d984431d27a31609c2 (patch)
tree65a640c91759d76c4dfa7f5f0740016b9c111c57 /lib/custodian/protocoltest/ldap.rb
parent0658265bbfb8180b1f4a78c1cc8bf8c58274f59c (diff)
Fixed syntax
Diffstat (limited to 'lib/custodian/protocoltest/ldap.rb')
-rw-r--r--lib/custodian/protocoltest/ldap.rb26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb
index 3e849f3..9da4ce5 100644
--- a/lib/custodian/protocoltest/ldap.rb
+++ b/lib/custodian/protocoltest/ldap.rb
@@ -96,23 +96,17 @@ module Custodian
@error = nil
begin
- #
# Connect.
- #
ldap = LDAP::Conn.new( @host, @port )
ldap.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)
- #
# Hardwired search is bad..
- #
base = 'ou=groups,dc=bytemark,dc=co,dc=uk'
scope = LDAP::LDAP_SCOPE_SUBTREE
filter = '(cn=vpn*)'
attrs = ['sn', 'cn']
- #
# Bind.
- #
ldap.bind( @ldap_user, @ldap_pass )
if ( ldap.bound? )
@@ -130,28 +124,30 @@ module Custodian
end
end
rescue LDAP::ResultError => ex
- @error = "LDAP exception: #{ex} when talkign to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'"
+ @error = "LDAP exception: #{ex} when talking to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'"
return false
end
+ @error = "LDAP server test failed against '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'"
+ return false
end
- #
- # If the test fails then report the error.
- #
- def error
- @error
- end
+ #
+ # If the test fails then report the error.
+ #
+ def error
+ @error
+ end
- register_test_type "ldap"
+ register_test_type "ldap"
- end
end
end
+end