11175
(-- --)
March 19, 2009, 8:44am
1
Hi,
I have installed openLDAP on windows vista. i correctly configure
the openLDAP server. when i do the ladpadd &ldap search by using the
following commands
Commands:
ldapadd -x step1.ldif
ldapsearch -D "cn=shalini,dc=mips,dc=com" -w serverpwd -b
cn=shalini,ou=people,dc=mips,dc=com"
It shows the output like:
# extended LDIF
Palani,
I’d suggest you use a 3rd party tool like LDAP Browser (www.ldapbrowser.com ) to verify your server, then check your code too.
James.
Hi Palani,
If you're trying to auth against ldap using Net::LDAP, might want to
try:
...
require 'net/ldap'
LDAP_HOST = '127.0.0.1' # or match your setup.
LDAP_PORT = 389 # or ...
LDAP_DN = 'cn=shalini,ou=people,dc=mips,dc=com' # or ...
...
def ldap_auth(uid, pss)
return false if uid.blank? || pss.blank?
clean_uid = uid.gsub(/[^a-zA-Z0-9._-]+/, '') # or ..., to guard
against ldap-injection.
usr = "uid=#{clean_uid},#{LDAP_DN}"
ldap = Net::LDAP.new({:host=>LDAP_HOST, :port=>LDAP_PORT, :auth=>
{:method=>:simple, :username=>usr, :password=>pss}})
return ldap.bind # returns true if successfully auth'd; false if
not.
end
...
Jeff