Module: Net::LDAP::Connection::SynchronousRead

Defined in:
lib/rex/proto/ldap.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#read(length = nil, _opts = {}) ⇒ String

Read ‘length` bytes of data from the LDAP connection socket and return this data as a string.

Parameters:

  • length (Integer) (defaults to: nil)

    Length of the data to be read from the LDAP connection socket.

  • _opts (Hash) (defaults to: {})

    Unused

Returns:

  • (String)

    A string containing the data read from the LDAP connection socket.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rex/proto/ldap.rb', line 61

def read(length = nil, _opts = {})
  data = ''
  loop do
    chunk = super(length - data.length)
    if chunk.nil?
      return data == '' ? nil : data
    end

    data << chunk
    break if data.length == length
  end

  data
end