Skip to content

Commit e31af4b

Browse files
author
Austin Ziegler
committed
SSL enabled or disabled per presence of OpenSSL.
1 parent c3f991f commit e31af4b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

History.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
=== Net::LDAP NEXT / 2010-__-__
2+
* SSL capabilities will be enabled or disabled based on whether we can load
3+
OpenSSL successfully or not.
4+
15
=== Net::LDAP 0.1.1 / 2010-03-18
26
* Fixing a critical problem with sockets.
37

lib/net/ldap.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
require 'openssl'
21
require 'ostruct'
2+
3+
module Net
4+
class LDAP
5+
begin
6+
require 'openssl'
7+
HasOpenSSL = true
8+
rescue LoadError
9+
HasOpenSSL = false
10+
end
11+
end
12+
end
313
require 'socket'
414

515
require 'net/ber'
@@ -1141,6 +1151,7 @@ def getbyte
11411151
end
11421152

11431153
def self.wrap_with_ssl(io)
1154+
raise Net::LDAP::LdapError, "OpenSSL is unavailable" unless Net::LDAP::HasOpenSSL
11441155
ctx = OpenSSL::SSL::SSLContext.new
11451156
conn = OpenSSL::SSL::SSLSocket.new(io, ctx)
11461157
conn.connect

0 commit comments

Comments
 (0)