File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 44# Monkeypatch upstream library, for now
55# TODO: write a real LDAP client in Rex and migrate all consumers
66class Net ::LDAP ::Connection # :nodoc:
7+ module SynchronousRead
8+ def read ( length = nil , opts = { } )
9+ data = ''
10+ loop do
11+ chunk = super ( length - data . length )
12+ if chunk . nil?
13+ return data == '' ? nil : data
14+ end
15+
16+ data << chunk
17+ break if data . length == length
18+ end
19+
20+ data
21+ end
22+ end
723
824 def initialize ( server )
925 begin
@@ -12,6 +28,7 @@ def initialize(server)
1228 'PeerPort' => server [ :port ] ,
1329 'Proxies' => server [ :proxies ]
1430 )
31+ @conn . extend ( SynchronousRead )
1532 rescue SocketError
1633 raise Net ::LDAP ::LdapError , 'No such address or other socket error.'
1734 rescue Errno ::ECONNREFUSED
You can’t perform that action at this time.
0 commit comments