Skip to content

Commit 11ad905

Browse files
committed
Net::LDAP#encryption accepts string
1 parent d65c597 commit 11ad905

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/net/ldap.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,11 @@ def authenticate(username, password)
589589
# :tls_options => { :ca_file => "/etc/cafile.pem", :ssl_version => "TLSv1_1" }
590590
# }
591591
def encryption(args)
592-
case args
592+
return if args.nil?
593+
594+
case method = args.to_sym
593595
when :simple_tls, :start_tls
594-
args = { :method => args, :tls_options => {} }
596+
args = { :method => method, :tls_options => {} }
595597
end
596598
@encryption = args
597599
end

test/test_ldap.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,10 @@ def test_obscure_auth
6464
@subject.auth "joe_user", password
6565
assert_not_include(@subject.inspect, password)
6666
end
67+
68+
def test_encryption
69+
enc = @subject.encryption('start_tls')
70+
71+
assert_equal enc[:method], :start_tls
72+
end
6773
end

0 commit comments

Comments
 (0)