Skip to content

Instantly share code, notes, and snippets.

@johnivanoff
Created July 26, 2012 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnivanoff/3179855 to your computer and use it in GitHub Desktop.
Save johnivanoff/3179855 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = '192.168.1.1'
ldap.port = 389
ldap.auth "username", "password"
filter = Net::LDAP::Filter.eq('CN', '*')
treebase = "dc= reputablecompany, dc=com"
ldap.search(:base => treebase, :filter => filter) do |entry|
puts "CN: #{entry.cn}"
end
p ldap.get_operation_result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment