Howdy-
I'm experimenting with ruby-ldap, but I've run across an issue I can't
resolve with the Rdoc.
I can't seem to add a new entry. It fails with an object class
violation, but I don't think the object I'm adding would be illegal if
I added it some other way. I wonder if this relates to the LDAP
libraries present on the system (I'm pointing the script at SunONE 5.2,
but it's not installed locally)? Anyone have any tips for me?
#!/usr/local/bin/ruby -w
require'ldap'
mypw = 'x0x0x0x0'
mydn = "cn=Directory Manager"
newentry = Hash.new
newentry["objectclass"] = ["top","organizationalunit"]
newentry["ou"] = ["test"]
newentry["dn"] = ["ou=" + (newentry["ou"])[0] + ",dc=domain,dc=edu"]
conn = LDAP::Conn.new(host='host.domain.edu',port=389)
puts newentry.inspect
conn.simple_bind(dn=mydn,password=mypw) { |conn|
conn.add((newentry["dn"])[0], newentry)
}
[crawford@dandruff rubyTests]$ ./addnew.rb
../addnew.rb:11: warning: instance variable @sasl_quiet not initialized
{"objectclass"=>["top", "organizationalunit"], "ou"=>["test"],
"dn"=>["ou=test,dc=domain,dc=edu"]}
../addnew.rb:16:in `add': Object class violation (LDAP::ResultError)
from ./addnew.rb:16
from ./addnew.rb:15:in `simple_bind'
from ./addnew.rb:15