>>>>> "O" == Ollivier Robert <roberto / REMOVETHIS.eu.org> writes:

O> ldap2mutt.rb:49:in `get_values': #<LDAP::Entry:0x805cff4> is not valid entry (LDAP::InvalidEntryError)

 I know nothing about LDAP but see the example test/search2.rb

pigeon% cat search2.rb
# -*- ruby -*-
# This file is a part of test scripts of LDAP extension module.
 
require "test/conf"
require "ldap"
 
conn = LDAP::Conn.new($HOST, $PORT)
conn.bind{
  conn.perror("bind")
  sub = nil
  conn.search("o=JAIST, c=JP", LDAP::LDAP_SCOPE_SUBTREE,
              "(objectclass=*)", nil, false, 0, 0){|e|
    dn = e.dn
    print("# #{LDAP.dn2ufn(dn)}\n")
    print("dn: #{dn}\n")
    e.attrs.each{|attr|
      print("#{attr}: #{e.vals(attr).join(', ')}\n")
    }
    print("\n")
    sub = e if !sub
  }
 
  begin
    sub.dn
  rescue LDAP::InvalidEntryError => e
    $stderr.print("#{e.to_s}.\n",
                  "This exception is expected.\n")
#                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  end
}
pigeon% 

 Apparently all entries are invalided at the end of the search (see 
rb_ldap_conn_search_s in conn.c)

  if( ldapdata->err == LDAP_SUCCESS ){
    for( e = ldap_first_entry(cldap, cmsg);
	 e != NULL;
	 e = ldap_next_entry(cldap, e) ){
      VALUE m;
      m = rb_ldap_entry_new(cldap, e);
      rb_ensure(rb_yield, m, rb_ldap_conn_invalidate_entry, m);
/*                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      */
    }
    ldap_msgfree(cmsg);
  };


Guy Decoux