Ruby net:LDAP returns "code = 53 message = Unwilling to perform" error

Posted by Yong on Server Fault See other posts from Server Fault or by Yong
Published on 2009-11-20T20:14:00Z Indexed on 2010/03/15 13:10 UTC
Read the original article Hit count: 310

Filed under:

Hi, I am getting this error "code = 53, message = Unwilling to perform" while I am traversing the eDirectory treebase = "ou=Users,o=MTC". My ruby script can read about 126 entries from eDirectory and then it stops and prints out this error. I do not have any clue of why this is happening.

I am using the ruby net:LDAP library version 0.0.4. The following is an excerpt of the code.

require 'rubygems'
require 'net/ldap'

ldap = Net::LDAP.new :host => "10.121.121.112",
 :port => 389,
 :auth => {:method => :simple, :username => "cn=abc,ou=Users,o=MTC", :password => "123"
 }

filter = Net::LDAP::Filter.eq( "mail", "*mtc.ca.gov" )

treebase = "ou=Users,o=MTC"

attrs = ["mail", "uid", "cn", "ou", "fullname"]

i = 0
ldap.search( :base => treebase, :attributes => attrs, :filter => filter ) do |entry|
  puts "DN: #{entry.dn}"
  i += 1
  entry.each do |attribute, values|
    puts "   #{attribute}:"
    values.each do |value|
      puts "      --->#{value}"
    end
  end
end

puts "Total #{i} entries found."
p ldap.get_operation_result

Here is the output and the error at the end. Thank you very much for your help.

DN: cn=uvogle,ou=Users,o=MTC

mail:

  --->[email protected]

fullname:

  --->Ursula Vogler

ou:

  --->Legislation and Public Affairs

dn:

  --->cn=uvogle,ou=Users,o=MTC

cn:

  --->uvogle

Total 126 entries found.

OpenStruct code=53, message="Unwilling to perform"

© Server Fault or respective owner

Related posts about ruby