Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Lawrence Holcomb
RE: ldap.modify error [ reply ]  
2008-01-30 21:12
Thanks again James.

After looking at the rdoc again I really should have figure that one out on my own.

By: James Hunt
RE: ldap.modify error [ reply ]  
2008-01-30 21:03
For posterity's sake, here's why it worked:

With `modify', you can carry out multiple operations on the same DN, for efficiency's sake. Each operation is passed to Net::LDAP's modify method as a tuple of [ op, attr, values ]. Because LDAP supports multiple operations, these tuples must themselves be members of an array (i.e. [ [ op1, attr1, values1 ], [ op2, attr2, values2 ] ])

Happy hacking,
James

By: Lawrence Holcomb
RE: ldap.modify error [ reply ]  
2008-01-30 21:00
That did the trick.

Thanks!

By: James Hunt
RE: ldap.modify error [ reply ]  
2008-01-30 20:50
Try changing the line to this:

ldap.modify(:dn => "cn=...", :operations => [
[ :delete,
:memberof,
"cn=..." ]
])

By: Lawrence Holcomb
RE: ldap.modify error [ reply ]  
2008-01-30 20:38
NoMethodError: undefined method 'to_ber_enumerated' for nil:NilClass

from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb: 1238:in 'modify'
from C:/ruby/lib/rubygems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb: 1235:in 'each'
from C:/ruby/lib/rubygems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb: 1235:in 'modify'
from C:/ruby/lib/rubygems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb: 894:in 'modify'


There are comments in the source code leading me to believe it thinks the op is "invalid"

starting on line 1225 of ldap.rb:

modify
# TODO, need to support a time limit, in case the server fails to respond.
# TODO!!! We're throwing an exception here on empty DN.
# Should return a proper error instead, probaby from farther up the chain.
# TODO!!! If the user specifies a bogus opcode, we'll throw a
# confusing error here ("to_ber_enumerated is not defined on nil").
#

By: James Hunt
RE: ldap.modify error [ reply ]  
2008-01-30 20:25
Can you post the full backtrace you receive when the aforementioned line crashes?

Also, what do you mean by 'According to the source code this is because I'm passing a bogus opcode'?

By: Lawrence Holcomb
RE: ldap.modify error [ reply ]  
2008-01-30 19:12
No body?

This puts the brakes on a whole section of my project big time as I can't modify group memberships.

The :replace op for LDAP.modify doesn't seem to work either.

By: Lawrence Holcomb
ldap.modify error [ reply ]  
2008-01-23 17:31
I am having trouble with an ldap.modify query. I'm getting an undefined method 'to_ber_enumerated' for nil:NilClass error. I'm not sure why this is being thrown. I'm trying to delete a value from an attribute.

According to the source code this is because I'm passing a bogus opcode. However I'm specifying :delete.

Here is the full line:

ldap.modify(:dn => "cn=TestAccount,ou=CADUsers,ou=CADLab,dc=techno,dc=tvinet", :operations => [:delete, :memberof, "cn="CAD_1001_101,ou=CADGroups,ou=CADLab,dc=techno,dc=tvinet"])

Any ideas?