google-code-export / ruby-activeldap

Automatically exported from code.google.com/p/ruby-activeldap
Other
1 stars 1 forks source link

ActiveLDAP-1.0.1 does not return correct DN when entry's DN is outside of ldap.yml's base #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using OpenLDAP (2.3.40?)

I created a model class:

class User < ActiveLdap::Base
    ldap_mapping    :dn_attribute => 'uid',
            :prefix => '',
            :classes => [ 'organizationalPerson' ]
end

Have LDAP entries:

dn: uid=mk1,ou=People,dc=example,dc=com
objectClass: organizationalPerson
uid: mk1
cn: mk1
sn: mk1

dn: uid=mk2,ou=People,dc=example,dc=net
objectClass: organizationalPerson
uid: mk2
cn: mk2
sn: mk2

ldap.yml has a development entry of:

development:
        host: password
        port: 389
        base: ''
        bind_dn: cn=rootdn
        password: <password>

Did a search an entry matching uid=mk1, from a search base of "" (thats the
root DSE)

@entry = User.find( :base => '', :filter => '(uid=mk1)' )

It found the entry I expect, but the .dn of the object was:

uid=mk1,ou=People,dc=example,dc=com,

note the trailing comma.

If I change the ldap.yml base to be 'dc=org', I get the following dn:

uid=mk1,ou=People,dc=example,dc=com,dc=org

Original issue reported on code.google.com by michael....@gmail.com on 27 Dec 2008 at 4:57

GoogleCodeExporter commented 9 years ago
I've fixed it in trunk.

Original comment by kou...@gmail.com on 29 Dec 2008 at 7:26

GoogleCodeExporter commented 9 years ago
I've checked out the code, and done the steps at
http://code.google.com/p/ruby-activeldap/wiki/UsingTrunkWithRails and am 
getting the
error:

stack level too deep

If I stop using the -trunk version, the program continues to work, but with the
extraneous trailing comma.

# gem --version
1.3.1

# rails --version
Rails 2.2.2

I am currently at revision 796 of trunk.

My stack is:

vendor/activeldap-trunk/lib/active_ldap/action_controller/ldap_benchmarking.rb:3
5:in
`rendering_runtime_without_active_ldap'
vendor/activeldap-trunk/lib/active_ldap/action_controller/ldap_benchmarking.rb:3
5:in
`rendering_runtime'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/benchmarking.
rb:71:in
`perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/rescue.rb:201
:in
`perform_action_without_caching'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/caching/sql_c
ache.rb:13:in
`perform_action'
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adap
ters/abstract/query_cache.rb:33:in
`cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.2/lib/active_record/query_cache.rb:
8:in
`cache'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/caching/sql_c
ache.rb:12:in
`perform_action'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:i
n `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:529:i
n
`process_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/filters.rb:56
8:in
`process_without_session_management_support'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/session_manag
ement.rb:130:in
`process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.2/lib/action_controller/base.rb:389:i
n
`process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in 
`synchronize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in 
`run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in 
`each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in 
`run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:503:in
`load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:503:in
`load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:355:in
`new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:503:in
`load'
/Library/Ruby/Gems/1.8/gems/rails-2.1.2/lib/commands/servers/mongrel.rb:64
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:510:in
`require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:355:in
`new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.
rb:510:in
`require'
/Library/Ruby/Gems/1.8/gems/rails-2.1.2/lib/commands/server.rb:39

Original comment by michael....@gmail.com on 29 Dec 2008 at 10:16

GoogleCodeExporter commented 9 years ago
> # rails --version
> Rails 2.2.2
...
> /Library/Ruby/Gems/1.8/gems/rails-2.1.2/lib/commands/server.rb:39

It seems that your Rails application is using Rails 2.1.2.

Sure, ActiveLdap trunk should also work with Rails 2.1.2. (It works well on my
environment.) You Rails application may be using ActiveLdap mixed trunk with 
1.0.1.
It will cause some problems.

Anyway, I can't find where your stack is wasted. It seems that your stack 
doesn't
enter infinite loop.

Original comment by kou...@gmail.com on 30 Dec 2008 at 1:37

GoogleCodeExporter commented 9 years ago
Yes, I have both 1.0.1 installed, as well as -trunk under vendor.  I'm unsure 
how,
short of removing the gem by hand, to clean up the 1.0.1 version.

Original comment by michael....@gmail.com on 30 Dec 2008 at 4:39

GoogleCodeExporter commented 9 years ago
I've uninstalled the activeldap-1.0.1 release as well as 
ruby-activeldap-0.8.3.1 and
am still getting the error.  It is occurring within the rendering of the page, 
or
thereafter.  All my logging is occurring as expected, except the page is not 
being
displayed.

This is a stub view, it doesn't have any complex rendering, and only displays 
some
static text.

Thanks for any help you might be able to give.

Original comment by michael....@gmail.com on 30 Dec 2008 at 4:59

GoogleCodeExporter commented 9 years ago
I can't fix your problem if I can't reproduce the problem on my environment.

Here is my transcript to try reproducing your problem:
{{{
% cd /tmp
% rails _2.1.2_ sample
% cd sample
% svn co http://ruby-activeldap.googlecode.com/svn/trunk vendor/activeldap-trunk
% vim config/environment.rb # add the following lines into 
Rails::Initializer.run block:
config.load_paths += %W(#{RAILS_ROOT}/vendor/activeldap-trunk/lib)
config.plugin_paths += %W(#{RAILS_ROOT}/vendor/activeldap-trunk/rails/plugin)
% script/generate scaffold_active_ldap
% vim config/ldap.yml
% script/generate model_active_ldap user
% script/generate scaffold --skip-migration user cn:string sn:string
% script/server
% firefox http://localhost:3000/users/
}}}

Original comment by kou...@gmail.com on 30 Dec 2008 at 6:10

GoogleCodeExporter commented 9 years ago
Thanks.  I couldn't reproduce it with your steps either.  I'll start fresh with 
it.

Thanks again fro your help.

Original comment by michael....@gmail.com on 30 Dec 2008 at 2:26