Guest User

Untitled

a guest
Jan 13th, 2018
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. require 'net-ldap'
  2.  
  3. ldap = Net::LDAP.new
  4. ldap.host = '192.168.2.3'
  5. ldap.auth 'advorak@ohreally.local', 'pass5551212ABC!@#'
  6.  
  7. ldap.search(:base => 'dc=ohreally,dc=local', :filter => '(mail=*)')
  8.  
  9.  
  10. ###### The last command as cfldap is what might interest you :-P ######
  11.  
  12. def cfldap(*args)
  13. args = args[0]
  14. if args[:action] == "query"
  15. ldap = Net::LDAP.new
  16. ldap.host = args[:server]
  17. ldap.auth args[:username], args[:password]
  18. ldap.search(:base => args[:start], :filter => args[:filter])
  19. end
  20. end
  21.  
  22. cfldap action:"query",
  23. server:"192.168.2.3",
  24. username:"advorak@ohreally.local",
  25. password:"pass5551212ABC!@#",
  26. start:"dc=ohreally,dc=local",
  27. filter:"(mail=*)"
Add Comment
Please, Sign In to add comment