Class: Net::LDAP::Connection
- Inherits:
-
Object
- Object
- Net::LDAP::Connection
- Defined in:
- lib/rex/proto/ldap.rb
Overview
Monkeypatch upstream library, for now TODO: write a real LDAP client in Rex and migrate all consumers
Defined Under Namespace
Modules: SynchronousRead
Instance Method Summary collapse
-
#initialize(server) {|_self| ... } ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(server) {|_self| ... } ⇒ Connection
Returns a new instance of Connection.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rex/proto/ldap.rb', line 24 def initialize(server) begin @conn = Rex::Socket::Tcp.create( 'PeerHost' => server[:host], 'PeerPort' => server[:port], 'Proxies' => server[:proxies] ) @conn.extend(SynchronousRead) rescue SocketError raise Net::LDAP::LdapError, 'No such address or other socket error.' rescue Errno::ECONNREFUSED raise Net::LDAP::LdapError, "Server #{server[:host]} refused connection on port #{server[:port]}." end if server[:encryption] setup_encryption server[:encryption] end yield self if block_given? end |