SSL enabled or disabled per presence of OpenSSL.
This commit is contained in:
parent
c3f991fdf8
commit
e31af4bead
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
=== Net::LDAP NEXT / 2010-__-__
|
||||
* SSL capabilities will be enabled or disabled based on whether we can load
|
||||
OpenSSL successfully or not.
|
||||
|
||||
=== Net::LDAP 0.1.1 / 2010-03-18
|
||||
* Fixing a critical problem with sockets.
|
||||
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
require 'openssl'
|
||||
require 'ostruct'
|
||||
|
||||
module Net
|
||||
class LDAP
|
||||
begin
|
||||
require 'openssl'
|
||||
HasOpenSSL = true
|
||||
rescue LoadError
|
||||
HasOpenSSL = false
|
||||
end
|
||||
end
|
||||
end
|
||||
require 'socket'
|
||||
|
||||
require 'net/ber'
|
||||
|
@ -1141,6 +1151,7 @@ module Net
|
|||
end
|
||||
|
||||
def self.wrap_with_ssl(io)
|
||||
raise Net::LDAP::LdapError, "OpenSSL is unavailable" unless Net::LDAP::HasOpenSSL
|
||||
ctx = OpenSSL::SSL::SSLContext.new
|
||||
conn = OpenSSL::SSL::SSLSocket.new(io, ctx)
|
||||
conn.connect
|
||||
|
|
Loading…
Reference in a new issue