On Fri, Nov 29, 2013 at 10:03 AM, Alexandre Beauclair
<[email protected]> wrote:
> I'm pretty much at a loss as to what I should do, as my configs are
> similar to the working install (adapted for the test install of course).
> Thanks for any input you can give me!

Here's the code that's failing, in
lib/gitorious/authentication/ldap_authentication.rb

      def auto_register(username)
        result = connection.search(:base => base_dn, :filter =>
username_filter(username),
          :attributes => attribute_mapping.keys, :return_result => true)
        if result.size > 0

The connection.search() call in ruby-ldap is not finding anything, so
it's returning nil. The crash comes when we try to call "nil.size". As
far as I can tell, nil.size has never returned anything other than a
NoMethodError exception. (Tested on Ruby 2.0 and Ruby 1.8.)

Looking at the ruby-ldap v0.3.1 that's bundled in Gitorious v2.4.11,
https://github.com/ruby-ldap/ruby-net-ldap/blob/3345c58dfb41192dc06f49632287d6a347b7abbb/lib/net/ldap.rb
has this paragraph:

  # #search returns either a result-set or a boolean, depending on the value
  # of the <tt>:return_result</tt> argument. The default behavior is to
  # return a result set, which is an Array of objects of class
  # Net::LDAP::Entry. If you request a result set and #search fails with an
  # error, it will return nil. Call #get_operation_result to get the error
  # information returned by
  # the LDAP server.

So if that's promised by the ruby-ldap API, we really ought to be
checking for result.nil? before we do anything further with result
here - particularly checking it's size. We might not be able to do
anything at this point, but hopefully we can do something more
graceful than crash.

What's curious to me is "how could authenticate() succeed, but
auto_register() fail?" It seems like there's some subtle difference
there.

What does your gitorious.yml say for the LDAPAuthentication portion?
Maybe shed some light on this.

- Ken

-- 
-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Gitorious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to