SSL enabled or disabled per presence of OpenSSL.
This commit is contained in:
parent
c3f991fdf8
commit
e31af4bead
|
@ -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
|
=== Net::LDAP 0.1.1 / 2010-03-18
|
||||||
* Fixing a critical problem with sockets.
|
* Fixing a critical problem with sockets.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
require 'openssl'
|
|
||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
|
||||||
|
module Net
|
||||||
|
class LDAP
|
||||||
|
begin
|
||||||
|
require 'openssl'
|
||||||
|
HasOpenSSL = true
|
||||||
|
rescue LoadError
|
||||||
|
HasOpenSSL = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
require 'socket'
|
require 'socket'
|
||||||
|
|
||||||
require 'net/ber'
|
require 'net/ber'
|
||||||
|
@ -1141,6 +1151,7 @@ module Net
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.wrap_with_ssl(io)
|
def self.wrap_with_ssl(io)
|
||||||
|
raise Net::LDAP::LdapError, "OpenSSL is unavailable" unless Net::LDAP::HasOpenSSL
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
conn = OpenSSL::SSL::SSLSocket.new(io, ctx)
|
conn = OpenSSL::SSL::SSLSocket.new(io, ctx)
|
||||||
conn.connect
|
conn.connect
|
||||||
|
|
Loading…
Reference in a new issue