class Net::LDAP::Connection
def add(args)
to the error message and the matched-DN returned by the server.
we'll want to do this with all the others. The point is to have access
rather than a simple result number. This is experimental, and eventually
Unlike other operation-methods in this class, we return a result hash
TODO: need to support a time limit, in case the server fails to respond.
--
def add(args) add_dn = args[:dn] or raise Net::LDAP::EmptyDNError, "Unable to add empty DN" add_attrs = [] a = args[:attributes] and a.each do |k, v| add_attrs << [k.to_s.to_ber, Array(v).map(&:to_ber).to_ber_set].to_ber_sequence end message_id = next_msgid request = [add_dn.to_ber, add_attrs.to_ber_sequence].to_ber_appsequence(Net::LDAP::PDU::AddRequest) controls = args.fetch(:controls, nil) unless controls.nil? controls = controls.to_ber_contextspecific(0) end write(request, controls, message_id) pdu = queued_read(message_id) if !pdu || pdu.app_tag != Net::LDAP::PDU::AddResponse raise Net::LDAP::ResponseMissingOrInvalidError, "response missing or invalid" end pdu end