class Net::LDAP::Connection

def modify(args)

++
error here ("to_ber_enumerated is not defined on nil").
TODO: If the user specifies a bogus opcode, we'll throw a confusing
proper error instead, probaby from farther up the chain.
TODO: We're throwing an exception here on empty DN. Should return a
TODO: need to support a time limit, in case the server fails to respond.
--
def modify(args)
  modify_dn = args[:dn] or raise "Unable to modify empty DN"
  ops = self.class.modify_ops args[:operations]
  message_id = next_msgid
  request    = [
    modify_dn.to_ber,
    ops.to_ber_sequence,
  ].to_ber_appsequence(Net::LDAP::PDU::ModifyRequest)
  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::ModifyResponse
    raise Net::LDAP::ResponseMissingOrInvalidError, "response missing or invalid"
  end
  pdu
end