--000325557516498834047718c3b6
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 29, 2009 at 1:54 PM, Michael Linfield <globyy3000 / hotmail.com>wrote:

>
> > The docs say string or array of strings.  Tried it with :attributes =>
> > []
> > and I get the same error.  I also tried reinstalling the gem but that
> > didn't
> > help.
>
> What gem are you using? ruby-net-ldap? via require 'net/ldap'?
> Might help to post more of your code so I can understand the whole
> picture of things...
>
> p entry.attrs is invalid as it isn't a method per'se... hence the
> NoMethodError.
> attrs is like you said a string or array of strings.
>
> It should be used via connection.add("dc=localhost, dc=localdomain",
> entry)
>
> Regards,
>
> - Mac
> --
> Posted via http://www.ruby-forum.com/.
>
>
Here is the code in its entirety:

require 'rubygems'
require 'net/ldap'

ldap = Net::LDAP.new :host => , :port => 389, :auth => { :method => :simple,
:username => "", :password => "" }

address_only_filter = Net::LDAP::Filter.pres("mailForwardingAddress") &
~(Net::LDAP::Filter.eq("mailDeliveryOption", "forward"))

base = "ou=People,o=cnm.edu,o=cp"

ldap.search(:base => base, :scope => Net::LDAP::SearchScope_WholeSubtree,
:filter => address_only_filter, :attributes => "*") do |entry|
    p entry.dn
    p entry.attrs
end


I've removed the credentials and the host IP intentionally.  Calling a
specific attribute on the object works just fine.  It just breaks when I try
to request all of them.  I figured it would be the easiest way to ensure I
only remove the attribute I'm interested in since not all records are sure
to have the same attributes.


-- 
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I canÃÕ hear a word youÃÓe saying."

-Greg Graffin (Bad Religion)

--000325557516498834047718c3b6--