Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ldap search not succeding in a single attempt

Reply
Thread Tools

Ldap search not succeding in a single attempt

 
 
rahulc1982@gmail.com
Guest
Posts: n/a
 
      08-17-2007
Hi,
I am writing a code for user authentication from ldapserver in ruby.
For that first i am doing an anonymous search on bluepages
ldap_con = Net::LDAP.new
ldap_con.host = 'X.Y.com'
ldap_con.port = 389
treebase = "ou=X,o=Y.com"
user_filter = Net::LDAP::Filter.eq("notesShortName",username)
dn = String.new
@res = ldap_con.search( :base => treebase, :filter =>
user_filter) do |entry|
dn = entry.dn

then getting "dn" and after that doing authentication with passwd and
dn.

unless dn.empty?
ldap_con.auth dn,password
if ldap_con.bind
login_succeeded = true
But I am getting strange results. Some times the ldap search was
successful some times not. Then i tried with putting the ldap search
in a for loop and tried also to get the return code so I found like

#<OpenStruct code=50, message="Insufficient Access Rights">
#<OpenStruct code=50, message="Insufficient Access Rights">
#<OpenStruct code=0, message="Success">

I dont know why it is happening for same search( same parameters)

Can you help me in this( why the search is not successful in first
iteration) ?
I also wants to tell you few Things
1- First of all i was testing(doing anonymous ldap search) with
A.Y.com and there was no problem with
this server at all or i can say 100% results i got if intranetid/
passwd were correct.
2- I tried on command line ( "cmd" on windows ) with this
ldapsearch -h A.Y.com -b o=Y.com emailaddress=(E-Mail Removed)
ldapsearch -h X.Y.com -b o=Y.com emailaddress= http://www.velocityreviews.com/forums/(E-Mail Removed)
both were giving me 100 % results.
3- Then with the help of a ldap person in pune i tried with a ldap
server here and there also i did not got any problem.

Problem is there only with bluepages and how it can possible that for
anonymous search it gives
#<OpenStruct code=50, message="Insufficient Access Rights">
#<OpenStruct code=50, message="Insufficient Access Rights">
#<OpenStruct code=0, message="Success">

Previously i was suspecting timeout but from the above lines it is
clear that it is access permission related issue.
Please help me in resolving this issue.

One thing i forgot that the problem is only with ldapsearch, if we get
correct "dn" there is no issues i faced in
authentication means 100 % successful.

Is it possible if i can see the logs on bluepages, that what is
happening with my anonymous search on bluepages.

Or do you have any idea about it?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python-ldap/win32 or python/ldap/win32 rcmn Python 1 11-06-2006 11:47 PM
Need to wrtie LDAP class to *answer* LDAP queries. junk1@davidbevan.co.uk Java 1 02-21-2006 09:59 PM
Can't locate object method "first" via package "attempt" (perhaps you forgot to load "attempt"?) at .... GMI Perl Misc 3 06-19-2005 10:44 PM
[ANN] Ruby/LDAP 0.9.1: LDAP API (RFC1823) library. Ian Macdonald Ruby 0 03-15-2005 11:23 PM
using LDAP Controls in ruby-ldap Jason Wold Ruby 5 11-07-2004 03:35 AM



Advertisments