Git Product home page Git Product logo

ruby-activeldap's Introduction

= ActiveLdap

ruby library for object-oriented LDAP interction

* Copyright (C) 2004-2006 Will Drewry <tt><[email protected]></tt>
* Copyright (C) 2006-2009 Kouhei Sutou <tt><[email protected]></tt>

Contributors::
  * Dick Davies <tt><rasputnik AT hellooperator.net></tt>
  * Nathan Kinder <tt><quicksilver02 AT mac.com></tt>
  * Patrick Cole <tt><pac AT independent.com.au></tt>
  * Google Inc.

== DESCRIPTION

'ActiveLdap' is a ruby extension library which provides a clean objected
oriented interface to the Ruby/LDAP[0] library.  It was inspired by
ActivRecord[3]. This is not nearly as clean or as flexible as ActiveRecord, but
it is still trivial to define new objects and manipulate them with minimal
difficulty.

For example and usage - read the rdoc in doc/ from lib/activeldap.rb.
It is also available on the web at:

http://ruby-activeldap.rubyforge.org/

== PREREQUISITES

[Ruby intepreter]
  One of them:
  * Ruby[http://www.ruby-lang.org] (1.8.x or 1.9.1)
  * JRuby[http://jruby.codehaus.org/]

[LDAP client]
  JRuby doesn't need to install new library because JRuby
  has builtin LDAP support. Ruby users need one of them:
  * Ruby/LDAP[http://rubyforge.org/projects/ruby-ldap/]
  * Net::LDAP[http://rubyforge.org/projects/net-ldap/]

* ActiveRecord[http://activerecord.rubyonrails.org]

== NOTES

* Only GSSAPI SASL support exists due to Ruby/LDAP limitations

== INSTALL

  % sudo gem install activeldap

== RAILS

There is a small rails plugin included that allows the use
of a file named 'config/ldap.yml' in the config directory of
your rails app. This file has a similar function to the
'database.yml' file that allows you to set your database
connection settings per environment. Similarly, the ldap.yml
file allows settings to be set for development, test, and
production environments. For instance, the development entry
would look something like the following:

  development:
    host: 127.0.0.1
    port: 389
    base: dc=localhost
    bind_dn: cn=admin,dc=localhost
    password: secret

To install, simply add the following codes to you config/environment.rb:

  config.gem "activeldap", :lib => "active_ldap"

When your application starts up, the plugin will call
ActiveLdap::Base.setup_connection using the parameters
specified for your current environment.

== LICENCE

This program is free software; you can redistribute it and/or modify it.  It is
dual licensed under Ruby's license and under the terms of the GNU General
Public License as published by the Free Software Foundation; either version 2,
or (at your option) any later version.

Please see the file LICENSE for the terms of the licence.

== THANKS

This list may not be correct. If you notice mistakes of this
list, please point out.

* Nobody: Bug reports and API improveent ideas.
* James Hughes: Bug reports and advices and documentations.
* Buzz Chopra: Documentations.
* Christoph Lipp:
  * Bug reports.
  * Tell us character escape syntax.
* Jeff Hall: Bug reports.
* Ernie Miller: Bug reports and advices.
* Daniel Pfile: Patches.
* Jacob Wilkins: Bug reports.
* Ace Suares:
  * Bug reports.
  * Nederlands translations.
* Iain Pople: Bug reports and API improvement ideas.
* Kevin McCarthy: Patches.
* Perry Smith: Patches, bug reports and indications.
* Marc Dequènes: API suggestions.
* Jeremy Pruitt: Bug reports.
* Bodaniel Jeanes:
  * A suggestion for behavior on simple bind with empty password.
  * Bug reports.
* Naoto Morishima: Bug reports.
* David Morton:
  * An API improvement idea.
  * Bug reports.
* Lennon Day-Reynolds: Bug reports.
* Tilo: A bug report.
* Matt Mencel: Bug reports.
* CultureSpy:
  * Bug reports.
  * Bug fixes.
* gwarf12: A bug report.
* Baptiste Grenier: API improvement ideas.
* Richard 3 Nicholas: API improvement ideas.
* Kazuhiro NISHIYAMA: A bug report.
* Grzegorz Marszałek: A bug report.
* しまさわらさん: A suggesetion.
* Ted Lepich: A suggestion.
* danger1986: A suggestion.
* michael.j.konopka: Bug reports.
* ingersoll: A suggestion.
* Alexey.Chebotar: Bug reports.
* ery.lee: A bug report.
* id:dicdak: A bug report.
* Raiko Mitsu: A bug report.
* Kazuaki Takase: Documents in Japanese.
* Tim Hermans: A bug report.
* Joe Francis: A suggestion.
* Tiago Fernandes: Bug reports.
* achemze: A suggestion.
* George Montana Harkin: A suggestion.
* Marc Dequènes: Bug reports.
* [email protected]: A bug report.
* Hideyuki Yasuda: Bug reports.
* zachwily: A bug report.
* [email protected]: A bug report.
* Tim Hermans: A bug report.
* Anthony M. Martinez: Helped SASL options support
* ilusi0n.x: A bug report.
* projekttabla: A suggestion.
* christian.pennaforte: A bug report.
* planetmcd: A bug report.
* spoidar: Rails 3 support.

ruby-activeldap's People

Stargazers

 avatar

Watchers

 avatar

Forkers

isabella232

ruby-activeldap's Issues

Error saving an ActiveLDAP user

What steps will reproduce the problem?
1. Set up a class (LdapUser) mapping to an inetOrgPerson
2. Use LdapUser.find("brad") to get a user
3. Set something like user.surname = "test"
4. Call user.save

What is the expected output? What do you see instead?

I would like it to save back to server without error.  Instead I am 
getting this error:

TypeError: singleton can't be dumped
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.0.9/lib/
active_ldap/base.rb:1465:in `dump'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.0.9/lib/
active_ldap/base.rb:1465:in `prepare_data_for_saving'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.0.9/lib/
active_ldap/base.rb:1486:in `update_without_callbacks'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/callbacks.rb:282:in `update'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.0.9/lib/
active_ldap/base.rb:1449:in `create_or_update_without_callbacks'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/callbacks.rb:250:in `create_or_update'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.0.9/lib/
active_ldap/base.rb:778:in `save_without_valida
tion!'


What version of the product are you using? On what operating system?

Gem 1.0.9 on OS X 10.5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 22 Jun 2009 at 7:08

Strangeness with DN

What steps will reproduce the problem?
1. Create model role.rb:
class Role < ActiveLdap::Base
  ldap_mapping :dn_attribute => 'i2Canonic', :prefix => 
'ou=domains', :classes => ['Role'], :scope => :one, :sort_by => 'i2Canonic'

  attr_accessor :i2Domain

private

  def validate_on_create
    unless self.id.blank?
      unless self.i2Domain.blank?
        roles = OrgUnit.find(:attribute => "ou", :value => 
"roles", :prefix => "dc=#{self.i2Domain},ou=domains")
        self.dn = "#{self.dn_attribute}=#{self.id},#{roles.dn}"
      end
    end
  end

end
2. Run script/console
3. Create new Role:
?> role = Role.create(:i2Canonic => "USER3", :i2Name => "User", :i2Domain 
=> "test3.com")
=> #<Role objectClass:<Role>, must:<i2Canonic, i2Name>, may:<description, 
i2Right>, description: [], i2Canonic: ["USER2"], i2Name: ["User"], 
i2Right: [], objectClass: ["Role"]>

Checking value of DN:

>> old_rdn = role.id
=> "USER3"

>> role.base
=> #<ActiveLdap::DistinguishedName:0xa02c4a8 @rdns=[{"ou"=>"roles"}, 
{"dc"=>"test3.com"}, {"ou"=>"domains"}, {"dc"=>"..."}, {"dc"=>""}, 
{"dc"=>""}, {"dc"=>"com"}]>

>> old_dn = role.dn
=> #<ActiveLdap::DistinguishedName:0xa017844 @rdns=
[{"i2Canonic"=>"USER3"}, {"ou"=>"roles"}, {"dc"=>"test3.com"}, 
{"ou"=>"domains"}, {"dc"=>"..."}, {"dc"=>""}, {"dc"=>""}, {"dc"=>"com"}]>

I trying change id (The same happens when I trying change rdn)

>> role.id = "USER2"
=> "USER2"

>> role.base
=> #<ActiveLdap::DistinguishedName:0xa02c4a8 @rdns=[{"ou"=>"roles"}, 
{"dc"=>"test3.com"}, {"ou"=>"domains"}, {"dc"=>"..."}, {"dc"=>""}, 
{"dc"=>""}, {"dc"=>"com"}]>

Here is strange behavior:

>> role.dn
=> #<ActiveLdap::DistinguishedName:0x9ee6474 @rdns=
[{"i2Canonic"=>"USER2"}, {"ou"=>"domains"}, {"dc"=>"..."}, {"dc"=>""}, 
{"dc"=>""}, {"dc"=>"com"}]>

>> role.base
=> #<ActiveLdap::DistinguishedName:0xa342a7c @rdns=[{"ou"=>"domains"}, 
{"dc"=>"..."}, {"dc"=>""}, {"dc"=>""}, {"dc"=>"com"}]>

So, when I tried save record, I got error:

?> role.save
ActiveLdap::NotImplemented: not implemented: modify RDN with new superior
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/ldap.rb:162:in `block in modify_rdn'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/base.rb:238:in `block in modify_rdn'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/base.rb:270:in `block in operation'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
timeout.rb:15:in `call'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
timeout.rb:15:in `alarm'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/base.rb:316:in `with_timeout'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/base.rb:269:in `operation'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/base.rb:237:in `modify_rdn'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
adapter/ldap.rb:160:in `modify_rdn'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
operations.rb:559:in `modify_rdn_entry'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
base.rb:1562:in `block in update'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
base.rb:1526:in `prepare_data_for_saving'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
base.rb:1551:in `update'
 from /usr/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/
callbacks.rb:282:in `update_with_callbacks'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
base.rb:1511:in `create_or_update'
 from /usr/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/
callbacks.rb:250:in `create_or_update_with_callbacks'
 from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.2.0/lib/active_ldap/
base.rb:816:in `save'
 from /usr/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/
validations.rb:1078:in `save_with_validation'
 from (irb):182
 from /usr/bin/irb:12:in `<main>'>>
?>

I would suggest solution: Generate new DN from old DN and replace old rdn 
when not present new_superior (only for created records)

?> role.dn = old_dn.to_s.gsub("USER3", "USER2")
=> 
"i2Canonic=USER2,ou=roles,dc=test3.com,ou=domains,dc=...,dc=...,dc=...,dc=com"
>>
?> role.save
=> true

LDAP: modify: RDN (4.1ms): 
{:dn=>"i2Canonic=USER3,ou=roles,dc=test3.com,ou=domains,dc=...,dc=...,dc=...,dc=
com", :new_rdn=>"i2Canonic=USER2", :new_superior=>nil, :delete_old_rdn=>true}

Original issue reported on code.google.com by [email protected] on 10 Oct 2009 at 7:24

Problem with Colon n an attribue value

What steps will reproduce the problem?
1. Person.find(:first, :attribute=>"isMemberOf", :value=> "COMMUNITY:ALL")
2. Tried the net-ldap query directly and it seemed fine

3.

What is the expected output? What do you see instead?
I expect a record to come back from the directory.  If I do a ldap query for an 
attribute that does not contain a colon or I replace the colon with a *, it 
works fine.

The error I get is:
Net::LDAP::LdapError: invalid filter syntax
    from /opt/local/lib/ruby/gems/1.8/gems/net-ldap-0.1.1/lib/net/ldap/filter.rb:407:in `initialize'
    from /opt/local/lib/ruby/gems/1.8/gems/net-ldap-0.1.1/lib/net/ldap/filter.rb:389:in `new'
    from /opt/local/lib/ruby/gems/1.8/gems/net-ldap-0.1.1/lib/net/ldap/filter.rb:389:in `construct'
    from /opt/local/lib/ruby/gems/1.8/gems/net-ldap-0.1.1/lib/net/ldap.rb:1352:in `search'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:143:in `send'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:143:in `execute'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:659:in `log'
    from /opt/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:659:in `log'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:141:in `execute'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:78:in `search'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:170:in `search'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:275:in `operation'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/timeout.rb:15:in `call'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/timeout.rb:15:in `alarm'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:321:in `with_timeout'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:274:in `operation'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:169:in `search'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/net_ldap.rb:66:in `search'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:65:in `search'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:284:in `find_every'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:257:in `find_initial'
    from /opt/local/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:222:in `find'
    from (irb):56

What version of the product are you using? On what operating system?
Ubuntu 10.04; current activeldap 1.2.2; ruby 1.8.7 (2009-06-12 patchlevel 174) 
[x86_64-linux]

Please provide any additional information below.


Any help or guidance on where I am making a mistake would be welcome.
thanks for your time,
Mike

Original issue reported on code.google.com by [email protected] on 8 Jul 2010 at 4:41

LDAP_OPT_X_TLS_PROTOCOL is undeclared

What steps will reproduce the problem?
1. Download the tarball and extract it
2. Run `ruby extconf.rb'
3. Run `make'

What is the expected output? What do you see instead?
`make' should complete, but it spews out this error report instead:
cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DUSE_OPENLDAP2
-DUSE_OPENLDAP -DLDAP_DEPRECATED -D_REENTRANT -DHAVE_LDAP_H -DHAVE_LBER_H
-DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_CRYPTO_H -DHAVE_LDAP_INIT
-DHAVE_LDAP_SET_OPTION -DHAVE_LDAP_GET_OPTION -DHAVE_LDAP_START_TLS_S
-DHAVE_LDAP_MEMFREE -DHAVE_LDAP_PERROR -DHAVE_LDAP_SORT_ENTRIES
-DHAVE_LDAP_SASL_BIND_S -DHAVE_LDAP_COMPARE_S -DHAVE_LDAP_ADD_EXT_S
-DHAVE_LDAP_COMPARE_EXT_S -DHAVE_LDAP_DELETE_EXT_S -DHAVE_LDAP_MODIFY_EXT_S
-DHAVE_LDAP_SEARCH_EXT_S -DHAVE_LDAP_UNBIND_EXT_S
-DHAVE_LDAP_SASL_INTERACTIVE_BIND_S -DRUBY_VERSION_CODE=187 
-D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   -c conn.c
conn.c: In function ‘rb_ldap_conn_set_option’:
conn.c:501: error: ‘LDAP_OPT_X_TLS_PROTOCOL’ undeclared (first use in this
function)
conn.c:501: error: (Each undeclared identifier is reported only once
conn.c:501: error: for each function it appears in.)
conn.c: In function ‘rb_ldap_conn_get_option’:
conn.c:631: error: ‘LDAP_OPT_X_TLS_PROTOCOL’ undeclared (first use in this
function)
make: *** [conn.o] Error 1


What version of the product are you using? On what operating system?
~/code/ruby-ldap-0.9.8% uname -a
Linux square 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009
i686 GNU/Linux


Please provide any additional information below.
I think I have read somewhere that it should be LDAP_OPT_X_TLS_PROTOCOL_MIN

Original issue reported on code.google.com by [email protected] on 12 May 2009 at 7:11

rails3 support

What steps will reproduce the problem?
1. Try to use ActiveLdap with rails3
2. Fail

With rails3 in RC, it's probably time to start looking at compatibility.

Should probably look at migrating to fast_gettext 
http://github.com/grosser/fast_gettext since it's better in various ways, and 
already supports rails3.

Following that, ActiveLdap::Validations will need some refactoring to come into 
line with the various validation changes in rails3.

Original issue reported on code.google.com by [email protected] on 1 Aug 2010 at 7:00

Delete entry found with :base => '' returns error because of trailing comma in user dn

I am attempting to .destroy an entry found with activeldap (currently trunk).

>> require 'active_ldap'
=> []
>> @user = User.find(:first,:base=>'',:scope => :sub, :filter =>"(uid=mike)")
=> #<User .......>
>> @user.destroy
ActiveLdap::DeleteError: Failed to delete LDAP entry: 
uid=mike,ou=People,dc=example,dc=com
    from /rails_root/vendor/activeldap-trunk/lib/active_ldap/base.rb:728:in 
`destroy_without_callbacks'
    from /Library/Ruby/Gems/1.8/gems/activerecord-
2.1.2/lib/active_record/callbacks.rb:289:in `destroy'
    from (irb):3

When I do a log of it in my application, I notice there is the following LDAP 
error:

LDAP: search (1.0ms): {:base=>"", :filter=>"objectClass=*", :scope=>:base, 
:attributes=>["subschemaSubentry"]}
  LDAP: search (35.3ms): {:base=>"cn=Subschema", :filter=>"(objectClass=subschema)", 
:scope=>:base, :attributes=>["objectClasses", "attributeTypes", 
"matchingRules", 
"matchingRuleUse", "dITStructureRules", "dITContentRules", "nameForms", 
"ldapSyntaxes"]}
  LDAP: delete: FAILED (0.0ms): {:error_message=>"Invalid DN syntax", 
:dn=>"uid=mike,ou=People,dc=example,dc=com,", :error=>"LDAP::ResultError"}

Note, the trailing comma in the DN it is attempting to delete.  I have been 
able to add and edit 
entries successfully.

This is the latest activeldap-trunk version.

# svn up

Fetching external item into 'activeldap-trunk'

Fetching external item into 'activeldap-trunk/test-unit'
External at revision 185.

At revision 799.
At revision 506.

Thanks very much for the help.  I very much appreciate it.


Original issue reported on code.google.com by [email protected] on 15 Jan 2009 at 8:41

Ruby-LDAP controls missing for #search_ext and #search_ext2

What steps will reproduce the problem?
1. Query the directory using either #search_ext or #search_ext2 with a
server control (e.g., the paged results control)
2. Fetch the results, and try to fetch the controls coming back from the
server for the estimated count and pager cookie

What is the expected output? What do you see instead?

I expected the #controls method to return the server control for paged
results. It was empty.

What version of the product are you using? On what operating system?

I'm using the 0.9.9 gem on MacOS X 10.5 and 10.6, FreeBSD 6.x, 7.x, and
8.x, and Ubuntu Linux.

Please provide any additional information below.

I'm not sure if this is the right place to file a bug report, but since
this is where the download and repository are, I though this would be the
best place to try. I'd be happy to move it elsewhere if there's somewhere
more appropriate.

I've attached a patch that fixes this issue (ruby-ldap-248.patch) and a
patch to the paged-result example (example/pr_ctl) that demonstrates the
problem.

Original issue reported on code.google.com by [email protected] on 11 Dec 2009 at 4:50

Attachments:

Can't build an org chart using ActiveLdap 1.2.0

I have a model that uses has_many to reference itself to build a tree. It's
my "Person" class, so this represents an org chart. Each record's "manager"
field contains the dn of that person's supervisor. The root of the chart is
a person who is their own manager.

I have updated from 1.0.9 to 1.2.0, and now the org chart doesn't work.

In the deprecation that was created in has_many to warn users about the
need to swap the primary and foreign key options, since my new primary key
is "dn" it always gets swapped. (This is because the "dn" attribute doesn't
exist for newly created objects?)

So I have to comment out the deprecation to get around it thinking I did it
wrong. I know I built my model correctly because it worked fine in 1.0.9
and I followed the directions to swap the options. Even if I comment the
deprecation out, I still cannot get back the proper list of subordinates.

With the sample code and data given below, this query

    Person.find('employee2').subordinates

should come back with employee4's record. Instead, I get employee2.

However

    Person.find('employee4').manager

does correctly return employee2's record.

Also,

    Person.find('employee1').subordinates

only returns employee1, when I should see employees 1 through 3.


Using: ActiveLdap 1.2.0 and OpenLDAP 2.4.11 on Linux 64 bit

Model:

class Person < ActiveLdap::Base
  ldap_mapping :dn_attribute => 'uid',
               :prefix => 'ou=People',
               :classes => ['top', 'inetOrgPerson'],
               :scope => :sub

#This is the association as it should be for ActiveLdap 1.2.0
  has_many :subordinates,
           :class => "Person",
           :foreign_key => "manager",
           :primary_key => "dn"

#This is the association that worked under ActiveLdap 1.0.9
#  has_many :subordinates,
#           :class => "Person",
#           :foreign_key => "dn",
#           :primary_key => "manager"

end


LDIF:

dn: dc=localhost
dc: localhost
o: Local Host
objectClass: top
objectClass: dcObject
objectClass: organization

dn: ou=People,dc=localhost
objectClass: organizationalUnit
ou: People

dn: uid=employee1,ou=People,dc=localhost
objectClass: inetOrgPerson
uid: employee1
sn: One
cn: Employee One
manager: uid=employee1,ou=People,dc=localhost

dn: uid=employee2,ou=People,dc=localhost
objectClass: inetOrgPerson
uid: employee2
sn: Two
cn: Employee Two
manager: uid=employee1,ou=People,dc=localhost

dn: uid=employee3,ou=People,dc=localhost
objectClass: inetOrgPerson
uid: employee3
sn: Three
cn: Employee Three
manager: uid=employee1,ou=People,dc=localhost

dn: uid=employee4,ou=People,dc=localhost
objectClass: inetOrgPerson
uid: employee4
sn: Four
cn: Employee Four
manager: uid=employee2,ou=People,dc=localhost

Original issue reported on code.google.com by [email protected] on 3 Nov 2009 at 12:25

Unable to get ActiveLdap collection to display in xml.

What steps will reproduce the problem?
1. Basic setup of LDAP and ActiveLdap installed
2.
3.

What is the expected output? What do you see instead?

Expected:
>> @machines.to_xml
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<machines 
type=\"array\">\n<machine><dn>cn=host.domain.com,cn=machines,dc=lab-
odmst,ou=ecs,o=<domain></dn>\n  <cns type=\"array\">\n    
<cn>host.domain.com</cn>\n  </cns>\n</machine>\n........</machines>\n
>> @machines.size
=> 20

Actual:
>> @machines.to_xml
=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<machines 
type=\"array\">\n</machines>\n"
>> @machines.size
=> 20

What version of the product are you using? On what operating system?
1.0.9 on Darwin 10.5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 15 Jun 2009 at 6:50

ActiveLdap::Base#attributes returns Array for non RDN and SINGLE-VALUE attributes

What steps will reproduce the problem?
1. create model user.rb
class User < ActiveLdap::Base
  ldap_mapping :dn_attribute => "uid", :prefix => "ou=users", :classes => 
['posixAccount'], :scope => :one
end
2. run script/console
3. create User
4. User.find(:first).attributes

What is the expected output?
=> {"objectClass"=>["posixAccount"], "uid"=>"admin", "cn"=>["User"], 
"uidNumber"=> "10020", "gidNumber"=> "10000", "homeDirectory"=>["/opt/
storage/admin"]}

What do you see instead?
=> {"objectClass"=>["posixAccount"], "uid"=>"admin", "cn"=>["User"], 
"uidNumber"=>["10020"], "gidNumber"=>["10000"], "homeDirectory"=>["/opt/
storage/admin"]}

Please solve this issue if this is defect and don't take many time to 
solve.
Thanks.

Original issue reported on code.google.com by [email protected] on 4 Oct 2009 at 1:08

Does not work with latest activerecord releases

The latest stable release depends on a specific version of active record ( = 
2.3.5 rather than >= 2.3.5) to that version.  This makes it impossible to use 
with the current stable release of activerecord (2.3.8) or the almost RC 
version 3.

Original issue reported on code.google.com by [email protected] on 13 Jun 2010 at 12:59

HasManyWrap association should return ANY associated entries that exist in the directory

What steps will reproduce the problem?

1. Create a groupOfUniqueNames group, call it "test", where the uniqueMember 
attribute contains DNs that don't actually exist in the directory.

2.

class Person < ActiveLdap::Base
  ldap_mapping :dn_attribute => 'cn'
end

class Group < ActiveLdap::Base
  ldap_mapping :dn_attribute => 'cn'
  has_many :members, :class => 'Person', :primary_key => 'dn', :wrap => 'uniqueMember'
end

3. group = Group.find('test')

What is the expected output? What do you see instead?

I'd expect group.members to return any people who's DN was listed in the 
uniqueMember 
attribute and exist in the directory.

Instead, I get no results.


What version of the product are you using? On what operating system?

This behavior is present in trunk r805.  I've tried it against the Sun LDAP 
server using OSX and 
Linux clients, both using ruby-ldap (C extension).


Please provide any additional information below.

Not really related to this report, but thanks normalizing the DNs!  I was just 
about to report on 
that one as well.


Original issue reported on code.google.com by [email protected] on 26 Jan 2009 at 10:44

Intermittent SSL Errors Closing the LDAP Connection

What steps will reproduce the problem?
1. Setup an ssl ldap connection:

staging:
  host: something.com
  port: 636
  base: dc=something,dc=com
  method: ssl

2. Setup a Model:

class Person < ActiveLdap::Base
  ldap_mapping :prefix => 'ou=People'
end

3. in the rails console type: Person.first occasionally.

What is the expected output? What do you see instead?
Expected output is a Person object is returned.  What I'm seeing
intermittently is the following error:

LDAP: search: FAILED (0.0ms): {:attributes=>[],
:error=>"OpenSSL::SSL::SSLError", :scope=>:sub,
:base=>"ou=People,dc=something,dc=com", :error_message=>"SSL_write:: bad
write retry", :filter=>"(&(uid=someuid)(objectClass=top))"}

OpenSSL::SSL::SSLError (SSL_write:: bad write retry):

followed by the stack trace.

What version of the product are you using? On what operating system?
ActiveLDAP 1.1.0
Rails 2.3.2

Original issue reported on code.google.com by [email protected] on 16 Sep 2009 at 3:44

Cannot search with spaces

What steps will reproduce the problem?
1. User.all("bob*") works fine.
2. User.first("Bob Smith") causes error

What is the expected output? What do you see instead?
 - I expect to see a result returned with the correct CN

bruce@xxx:~$ ./script/console 
Loading development environment (Rails 2.3.5)
>> User.all("Bob Smith")
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:302:in
`initialize': invalid filter syntax (Net::LDAP::LdapError)
    from
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:283:in
`new'
    from
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:283:in
`construct'
    from
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1128:in
`search'
    from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/adapter/net_ldap.rb
:141:in
`send'
    from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/adapter/net_ldap.rb
:141:in
`execute'
    from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/adapter/base.rb:659
:in
`log'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benc
hmark.rb:10:in
`realtime'
    from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/adapter/base.rb:659
:in
`log'
     ... 13 levels...
    from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/operations.rb:250:i
n
`all'
    from (irb):1:in `irb_binding'
    from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
    from /usr/lib/ruby/1.8/irb/workspace.rb:52


What version of the product are you using? On what operating system?
 - activeldap 1.2.1 on Ubuntu 8.04.2 LTS



Original issue reported on code.google.com by [email protected] on 7 Jan 2010 at 5:27

Does not work with rails 2.3.5.

What steps will reproduce the problem?
1. Start a rails project (rails project && cd project)
2. Add config.gem 'active_ldap' to env/config.rb
3. script/console

What is the expected output? What do you see instead?

I expect console to start.  Instead I get an error like:

"can't activate activesupport (= 2.3.4, runtime) for [], already activated
activesupport-2.3.5 for ["rails-2.3.5"] (Gem::LoadError)
...
from...active_ldap.rb:899

What version of the product are you using? On what operating system?

Latest: active_ldap-1.2.0

Please provide any additional information below.

The call should be for a version >= 2.3.4, not precisely 2.3.4.  Apparent
workaround is to use rails 2.3.4 until the bug is fixed in active_ldap.

Original issue reported on code.google.com by [email protected] on 10 Dec 2009 at 7:21

Boolean

If one use checkbox in rails application for boolen values, params has will
contains "1" or "0" strings. 
It would be nice if syntaxes boolen class convert it to boolean value like
this:


  def normalize_value(value)
          case value
          when true, 1, "1"
            "TRUE"
          when false, 0, "0"
            "FALSE"
          else
            value
          end
        end

Original issue reported on code.google.com by [email protected] on 24 May 2010 at 6:01

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

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 [email protected] on 27 Dec 2008 at 4:57

Raised on modify_rdn_entry when rdn already exists

Hi kou!
I would ask you replace this 'raise' by error message, like when you trying
create new record when rdn already exists

What steps will reproduce the problem?
1. Create model: org_unit.rb

---
class OrgUnit < ActiveLdap::Base
 ldap_mapping :dn_attribute => "ou", :prefix => "", :classes => ['top', 
'organizationalUnit']
end

---
2. Run console: script/console development
3. Generate records:
test_root   = OrgUnit.create("test_root")
test_child1 = OrgUnit.create(:ou => "test_child1", :parent => test_root)
test_child2 = OrgUnit.create(:ou => "test_child2", :parent => test_root)
3. Try to modify rdn of test_child1 to "test_child2"

What is the expected output? What do you see instead?

>> test_child1.modify_rdn_entry(test_child1.dn, "ou=test_child2", true, {})
ActiveLdap::LdapError::AlreadyExists: Already exists
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap_ext.
rb:80:in
`assert_error_code'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:1
81:in
`rescue in execute'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:1
77:in
`execute'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:1
65:in
`block in modify_rdn'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:2
34:in
`block in modify_rdn'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:2
66:in
`block in operation'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/timeout.rb:15:in
`call'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/timeout.rb:15:in
`alarm'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:3
12:in
`with_timeout'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:2
65:in
`operation'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:2
33:in
`modify_rdn'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:1
60:in
`modify_rdn'
 from
/usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/operations.rb:540
:in
`modify_rdn_entry'
 from (irb):4
 from /usr/bin/irb:12:in `<main>'
>> test_child1.errors
=> #<ActiveRecord::Errors:0x8336018 @base=#<OrgUnit objectClass:<top,
organizationalUnit>, must:<objectClass, ou>, may:<...>, @errors={}>

---

>> test_child3 = OrgUnit.create(:ou => "test_child2", :parent => test_root)
=> #<OrgUnit objectClass:<top, organizationalUnit>, must:<objectClass, ou>,
may:<...>
>> test_child3.errors
=> #<ActiveRecord::Errors:0xa65d730 @base=#<OrgUnit objectClass:<top,
organizationalUnit>, must:<objectClass, ou>, may:<...>,
@errors={"dn"=>["%{fn} is duplicated: ou=test_child2,ou=test_root,dc=com"]}>

What version of the product are you using? On what operating system?

openldap 2.4.16 (hdb database)
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
rubygems 1.3.4
ruby-ldap (0.9.9)
activeldap (1.1.0)

I hope it possible :)

Original issue reported on code.google.com by [email protected] on 6 Aug 2009 at 5:47

TypeError: can't convert nil into Array when searching for groups

What steps will reproduce the problem?
1. Search for groups where one attributes returns nil (why ? I don't know) 

u=AD::User.find("cpennafo")
p u.groupes.collect{|g|g.cn}

What is the expected output? What do you see instead?

The expected output is : 

["PEMOD-CRIH", "CANADA-CRIH" ...] # A list of groups cn

The result I see instead is : 

TypeError: can't convert nil into Array
    from /Library/Ruby/Gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/operations.rb:71:in 
`concat'
    from /Library/Ruby/Gems/1.8/gems/activeldap-1.2.1/lib/active_ldap/operations.rb:71:in 
`search'


What version of the product are you using? On what operating system?
activeldap-1.2.1

Please provide any additional information below.

I patched activeldap-1.2.1/lib/active_ldap/operations.rb on line 71 
transforming 
normalized_value into a table. It also seems to work adding a "if 
normalized_value" at the end of 
the line :
 71             attributes[normalized_attr].concat([normalized_value])

Original issue reported on code.google.com by [email protected] on 3 Feb 2010 at 1:55

Error with to_xml

What steps will reproduce the problem?
1. script/console
2. Usuario.all.to_xml

What is the expected output?
The XML!

What do you see instead?
TypeError: can't convert nil into String
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:73:in `pack'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:73:in `normalize_value'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:53:in `normalize_values'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:52:in `each'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:52:in `normalize_values'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:24:in `to_s'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:23:in `each'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:23:in `to_s'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:134:in `call'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:31:in `tag!'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:22:in `to_s'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/xml.rb:115:in `to_s'
        from /var/lib/gems/1.8/gems/activeldap-
1.2.1/lib/active_ldap/base.rb:953:in `to_xml'
        from /var/lib/gems/1.8/gems/activesupport-
2.3.5/lib/active_support/core_ext/array/conversions.rb:189:in `to_xml'
        from /var/lib/gems/1.8/gems/activesupport-
2.3.5/lib/active_support/core_ext/array/conversions.rb:189:in `each'
        from /var/lib/gems/1.8/gems/activesupport-
2.3.5/lib/active_support/core_ext/array/conversions.rb:189:in `to_xml'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:134:in `call'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
        from /var/lib/gems/1.8/gems/builder-
2.1.2/lib/builder/xmlbase.rb:31:in `tag!'
        from /var/lib/gems/1.8/gems/activesupport-
2.3.5/lib/active_support/core_ext/array/conversions.rb:187:in `to_xml'


What version of the product are you using? On what operating system?
I'm using Debian Lenny 5.0.4, ruby 1.8
my gems:
*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activeldap (1.2.1)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
builder (2.1.2)
gettext (2.1.0)
gettext_activerecord (2.1.0)
hoe (2.6.0)
json_pure (1.2.4)
locale (2.0.5)
log4r (1.1.7)
mkrf (0.2.3)
net-https-wrapper (1.0)
net-httpstub (0.0.2)
net-ldap (0.1.1)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
ruby-activeldap (0.8.3.1)
ruby-mysql (2.9.2)
rubyforge (2.0.4)


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 16 Apr 2010 at 3:57

when dn contains integer, exception occurs in "compute_dn" method of base.rb

What steps will reproduce the problem?

1. a dn like "ifindex=1,cn=device1"
2. when delete, update the object, exception occurs


What version of the product are you using? On what operating system?

1.0.1


Additional Infomation:

I modified the compute_dn method in base.rb file to fix this issue:

    def compute_dn(escape_dn_value=false)
      return base if @dn_is_base

      dn_value = id
      if dn_value.nil?
        raise DistinguishedNameNotSetError.new,
                _("%s's DN attribute (%s) isn't set") % [self, dn_attribute]
      end
      unless dn_value.is_a?(Integer)
    dn_value = DN.escape_value(dn_value) if escape_dn_value
      end
      _base = base
      _base = nil if _base.empty?
      ["#{dn_attribute}=#{dn_value}", _base].compact.join(",")
    end

Original issue reported on code.google.com by [email protected] on 4 Feb 2009 at 1:57

Syntax error in schema.rb

I'm still learning ruby, so apologies if this patch is not correct, however
without it I am unable to use the find method of any class that I create.

I can't think why you'd want to pass an array with one entry into the
has_key function.

Cheers

Matt


Original issue reported on code.google.com by [email protected] on 12 Mar 2007 at 10:40

Attachments:

Ruby 1.8.6 p287 :: Undefined methods

What steps will reproduce the problem?
1. Install Ruby 1.8.6 p287
{{{
# wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p287.tar.bz2
# tar xjpf ruby-1.8.6-p287.tar.bz2
# cd ruby-1.8.6-p287
# ./configure
# make && make install
}}}
2. Get Ruby/LDAP from svn and install
{{{
# svn checkout http://ruby-activeldap.googlecode.com/svn/ldap/trunk
ruby-ldap-ro
# cd ruby-ldap-ro
# ruby extconf.rb
# make && make install
}}}
3. Install Ruby/ActiveLdap from svn and running tests
{{{
# svn checkout http://ruby-activeldap.googlecode.com/svn/trunk/
ruby-activeldap-ro
# cd ruby-activeldap-ro
# cp test/config.yaml.sample test/config.yaml
[ Configure test/config.yaml ]
# cat test/config.yaml
test:
  host: 127.0.0.1
  port: 389
  base: dc=127.0.0.1
  bind_dn: ""
  try_sasl: true
  method: :plain
  sasl_mechanisms: ["GSSAPI"]
  allow_anonymous: false
# ruby test/run-test.rb > ../ruby186_r905_run-test.log
}}}

What is the expected output? What do you see instead?
Some like results of tests on Ruby 1.9.1:

---
312 tests, 875 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0
notifications

---

But gives errors:
1) Undefined method 'lines' for String
2) Undefined method 'self_and_descendents_from_active_record' for Class

Attached log maybe not full (I will attach log with full  test results)

Original issue reported on code.google.com by [email protected] on 20 Mar 2009 at 11:57

Attachments:

Critical Issue: NoMemoryError when calling ldap.rb:94:in `vals'!

OS: Centos5.3
libldap-ruby1.8
activeldap1.0.9
ruby1.8.7

I have spend many hours on this critical issue. My openldap has about 10K
ldap entries. When calling find("cn=yunnan,c=cn") in rails production
environment, there will be NoMemoryError! 

NoMemoryError (failed to allocate memory):
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:94:in `vals'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:94:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:93:in `each'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:93:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `send'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `execute'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:646:in `log'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:646:in `log'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:179:in `execute'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:90:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:165:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:266:in `operation'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `call'
  activeldap (1.0.9) lib/active_ldap/timeout.rb:15:in `alarm'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:312:in `with_timeout'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:265:in `operation'
  activeldap (1.0.9) lib/active_ldap/adapter/base.rb:164:in `search'
  activeldap (1.0.9) lib/active_ldap/adapter/ldap.rb:83:in `search'
  activeldap (1.0.9) lib/active_ldap/operations.rb:65:in `search'
  activeldap (1.0.9) lib/active_ldap/operations.rb:269:in `find_every'
  activeldap (1.0.9) lib/active_ldap/operations.rb:242:in `find_initial'
  activeldap (1.0.9) lib/active_ldap/operations.rb:309:in `find_one'
  activeldap (1.0.9) lib/active_ldap/operations.rb:296:in `find_from_dns'
  activeldap (1.0.9) lib/active_ldap/operations.rb:215:in `find'
  app/controllers/monet_controller.rb:325:in `find_path_and_subnodes'
  app/controllers/application_controller.rb:162:in `set_language'
  app/controllers/application_controller.rb:162:in `set_language'



Original issue reported on code.google.com by [email protected] on 15 Jul 2009 at 4:06

undefined method `map' for nil:NilClass

I am getting an error when trying to unpack the gem.

What steps will reproduce the problem?
1. config.gem 'activeldap', :lib => "active_ldap" (environment.rb file)
2. sudo rake gems:install
3. rake gems:unpack
3. Result:
rake gems:unpack
(in /Users/david/github/bloomfire-app)
rake aborted!
undefined method `map' for nil:NilClass

(See full trace by running task with --trace)

------------------------------------------------------------------
Full Trace:
------------------------------------------------------------------
rake gems:unpack --trace
(in /Users/david/github/bloomfire-app)
** Invoke gems:unpack (first_time)
** Invoke gems:install (first_time)
** Invoke gems:base (first_time)
** Execute gems:base
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `map' for nil:NilClass
/Library/Ruby/Site/1.8/rubygems.rb:223:in `activate'
/Library/Ruby/Site/1.8/rubygems.rb:249:in `activate'
/Library/Ruby/Site/1.8/rubygems.rb:248:in `each'
/Library/Ruby/Site/1.8/rubygems.rb:248:in `activate'
/Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/rails/gem_
dependency.rb:73:in
`add_load_paths'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/initialize
r.rb:301:in
`add_gem_load_paths'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/initialize
r.rb:301:in
`each'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/initialize
r.rb:301:in
`add_gem_load_paths'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/initialize
r.rb:132:in
`process'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/initialize
r.rb:113:in
`send'
/Users/david/github/bloomfire-app/config/../vendor/rails/railties/lib/initialize
r.rb:113:in
`run'
/Users/david/github/bloomfire-app/config/environment.rb:10
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Users/david/github/bloomfire-app/vendor/rails/activesupport/lib/active_support/
dependencies.rb:156:in
`require'
/Users/david/github/bloomfire-app/vendor/rails/activesupport/lib/active_support/
dependencies.rb:521:in
`new_constants_in'
/Users/david/github/bloomfire-app/vendor/rails/activesupport/lib/active_support/
dependencies.rb:156:in
`require'
/Users/david/github/bloomfire-app/vendor/rails/railties/lib/tasks/misc.rake:4
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.
rb:242:in
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/david/github/bloomfire-app/vendor/rails/railties/lib/tasks/gems.rake:17
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.
rb:242:in
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in
`invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.
rb:242:in
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in
`invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
`invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.
rb:242:in
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
`standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19



What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 27 May 2010 at 12:25

to_xml should express collections and arrays for ActiveResource compatibility

What steps will reproduce the problem?
1. Create Group and User LDAP bindings
class Group < ActiveLdap::Base
  ldap_mapping :dn_attribute => "ou",
               :prefix => '', :classes => ['top', 'groupOfNames']

  has_many  :members,
            :class => 'User',
            :primary_key => 'dn',     # User#dn
            :foreign_key => 'member'  # Group#member
end

class User < ActiveLdap::Base
  ldap_mapping :dn_attribute => "cn",
    :prefix => 'ou=people',
    :scope => :one,
    :classes => ['top', 'person', 'organizationalPerson', 'inetOrgPerson',
'hgPerson']

  has_many :groups,
    :class => 'Group',
    :primary_key => 'member', # Group#member
    :foreign_key => 'dn'      # User#dn
end
2. g = Group.find('admins')
3. g.to_xml

What is the expected output? What do you see instead?
Expected:
<group>
  <dn>ou=admins,dc=plop,dc=org</dn>
  <cn>admins</cn>
  <members type="array">
    <member>cn=Baptiste Grenier,ou=people,dc=plop,dc=org</member>
    <member>cn=Raoul Bloggs,ou=people,dc=plop,dc=org</member>
  </members>
  <objectClasses type="array">
    <objectClass>groupOfNames</objectClass>
    <objectClass>top</objectClass>
  </objectClasses>
  <ou>admins</ou>
</group>

Actual result:
<group>
  <dn>ou=admins,dc=plop,dc=org</dn>
  <cn>admins</cn>
  <member>cn=Baptiste Grenier,ou=people,dc=plop,dc=org</member>
  <member>cn=Raoul Bloggs,ou=people,dc=plop,dc=org</member>
  <objectClass>groupOfNames</objectClass>
  <objectClass>top</objectClass>
  <ou>admins</ou>
</group>

What version of the product are you using? On what operating system?
archlinux, debian etch, ActiveLdap trunk and 1.0.1 and Rails 2.1.0.

Please provide any additional information below.
For now this makes impossible to use an ActiveResource object created from
an xml serialization of an ActiveLdap object that has a multivaluated
element, here is a quick example:
REST WS with ActiceLdap side:
>> print User.find('Baptiste Grenier').to_xml
<user>
  <dn>cn=Baptiste Grenier,ou=people,dc=plop,dc=org</dn>
  <businessCategory>Computer Scientist</businessCategory>
  <cn>Baptiste Grenier</cn>
  <knownLanguages>english</knownLanguages>
  <knownLanguages>french</knownLanguages>
  <objectClass>hgPerson</objectClass>
  <objectClass>inetOrgPerson</objectClass>
  <hgPersonUid>50</hgPersonUid>
</user>

ActiveResource consumer side:
class User < ActiveResource::Base
  self.site = 'https://accountsws.test.plop.org/'
  self.site.user = 'dadasdasd'
  self.site.password = 'passsssWWord'
end

>> u = User.find('50')
ArgumentError: expected an attributes Hash, got "english"
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:883
:in
`load'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:639
:in
`initialize'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:890
:in
`new'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:890
:in
`load'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:890
:in
`map'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:890
:in
`load'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:885
:in
`each'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:885
:in
`load'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:639
:in
`initialize'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:587
:in
`new'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:587
:in
`instantiate_record'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:579
:in
`find_single'
    from
/usr/lib/ruby/gems/1.8/gems/activeresource-2.1.0/lib/active_resource/base.rb:507
:in
`find'
    from (irb):66

The name of the collection should/could be the pluralized name of the element.

Explaination of collections expression for ActiveResource:
- http://github.com/rails/rails/tree/master/activeresource/README
ActiveResource API:
- http://api.rubyonrails.org/classes/ActiveResource/Base.html

Original issue reported on code.google.com by [email protected] on 9 Jul 2008 at 11:16

Atomic modification not working for incrementing a max UID

What steps will reproduce the problem?
1. In order to block race conditions when incrementing an uid, I try to
follow an advice from Howard Chu[1], and want to do a delete and a add in a
single modify request, I have also read test_load.rb[2].

The cn=conf,dc=plop,dc=org belongs to a class that require the
'hgMaxPersonUid' to be present.

2. I did try this:
    ldif = ActiveLdap::LDIF.new
    record = ActiveLdap::LDIF::ModifyRecord.new(conf.dn)
    ldif << record
    record.add_operation(:delete, 'hgMaxPersonUid', [], {'hgMaxPersonUid'
=> [conf.hgMaxPersonUid.to_s]})
    conf.hgMaxPersonUid += 1
    record.add_operation(:add, 'hgMaxPersonUid', [], {'hgMaxPersonUid' =>
[conf.hgMaxPersonUid.to_s]})
    ActiveLdap::Base.load(ldif.to_s)

What is the expected output? What do you see instead?
The hgMaxPersonUid should be incremented in one atomic operation.

The ActiveLdap::Base.load(ldif.to_s) fails:
    ActiveLdap::RequiredAttributeMissed: Object class violation:
cn=conf,dc=plop,dc=org

What version of the product are you using? On what operating system?
I'm using Rails 2.1.0 and ActiveLdap 1.0.0 on a debian etch.

Please provide any additional information below.
The ldif.to_s gives this:
version: 1
dn: cn=conf,dc=plop,dc=org
changetype: modify
delete: hgMaxPersonUid
hgMaxPersonUid: 690 
-
add: hgMaxPersonUid
hgMaxPersonUid: 691 
-

If I use ldapmodify with this ldif, it works as the operation is done in
one time and is atomic.

It seems that ActiveLdap::Base.load(ldif.to_s) does not play the LDIF as an
atomic operation, but instead as two operations, so the schema checking
seems to forbid to delete the field.

Is this the correct way of doing this, or am I doing something wrong?
Is this the intended behaviour?

For now I use a working code like this one, using ruby-ldap:
    ldap_conn = LDAP::Conn.new('ldap.plop.org', 389)
    ldap_conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
    ldap_conn.start_tls
    remove = LDAP::Mod.new(LDAP::LDAP_MOD_DELETE, "hgMaxPersonUid",
[(conf.hgMaxPersonUid).to_s])
    conf.hgMaxPersonUid += 1
    add = LDAP::Mod.new(LDAP::LDAP_MOD_ADD, "hgMaxPersonUid",
[conf.hgMaxPersonUid.to_s])
    ldap_conn.bind('cn=admin,dc=healthgrid,dc=org', 'pass')
    ldap_conn.modify(conf.dn, [remove, add])

It works but I need to open a second connection to the server instead of
using the already opened ActiveLdap connection.

Thanks for any help.

Ref: 
[1] - http://www.openldap.org/lists/openldap-software/200208/msg00358.html
[2] -
http://code.google.com/p/ruby-activeldap/source/browse/trunk/test/test_load.rb

Original issue reported on code.google.com by [email protected] on 17 Jun 2008 at 5:05

[Rails 2.3 Support] :: Running WEBrick Hangs

Hello koutou.
I need to run Ruby 1.9.1 + Rails 2.3 + Activeldap + WEBrick (And later +
Thin) :)

Did you thinking about Rails 2.3 ? Do you have time for this ? :) I hope,
yes. So, lets begin. :)

= Install Ruby 1.9.1-p0 =
{{{
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz
tar -xjpf ruby-1.9.1-p0.tar.bz2
cd ruby-1.9.1-p0
./configure
make && make_install
}}}

= Reinstall Rubygems 1.3.1 =
{{{
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar -xzpf rubygems-1.3.1.tgz
cd rubygems-1.3.1
ruby setup.rb
}}}

= Install Rails 2.3.0 RC1 =
{{{
gem install rake rack test-unit
gem install rails --source http://gems.rubyonrails.org
gem install thin
}}}

{{{
[root al-admin]# gem list
*** LOCAL GEMS ***
actionmailer (2.3.1)
actionpack (2.3.1)
activerecord (2.3.1)
activeresource (2.3.1)
activesupport (2.3.1)
daemons (1.0.10)
eventmachine (0.12.4)
rack (0.9.1)
rails (2.3.1)
rake (0.8.4)
test-unit (2.0.2)
thin (1.0.0)
}}}

= Getting Activeldap from trunk r837 =
{{{ 
cd /root
svn checkout http://ruby-activeldap.googlecode.com/svn/trunk/
ruby-activeldap-read-only
cd ruby-activeldap-read-only/examples/al-admin/
}}}

Change RAILS_GEM_VERSION to 2.3.1 in config/environment.rb

= Trying to update rails =
{{{
[root al-admin]# rake rails:update
(in /root/ruby-activeldap-read-only/examples/al-admin)
/root/ruby-activeldap-read-only/examples/al-admin/app/controllers/application.rb
has been renamed to
/root/ruby-activeldap-read-only/examples/al-admin/app/controllers/application_co
ntroller.rb,
update your SCM as necessary
}}}

Looks great. :)

= Trying to run server (Webrick) =
{{{
[root al-admin]# mv config/database.yml.example config/database.yml
[root al-admin]# script/server
=> Booting WEBrick
=> Rails 2.3.1 application starting on http://0.0.0.0:3000
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require': no such file to load -- md5 (MissingSourceFile)
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:2:in `<top
(required)>'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from /root/ruby-activeldap-read-only/lib/active_ldap.rb:969:in
`<top (required)>'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/requires.rb:7:in
`block in require_library_or_gem'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/reporting.rb:11:in
`silence_warnings'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/requires.rb:5:in
`require_library_or_gem'
        from
/root/ruby-activeldap-read-only/examples/al-admin/../../rails/init.rb:1:in
`block in evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:146:in `eval'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:146:in `block
in evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/reporting.rb:11:in
`silence_warnings'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:142:in
`evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:48:in `load'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin/loader.rb:38:in
`block in load_plugins'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin/loader.rb:37:in
`each'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin/loader.rb:37:in
`load_plugins'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/initializer.rb:346:in
`load_plugins'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/initializer.rb:163:in `process'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/initializer.rb:113:in `run'
        from
/root/ruby-activeldap-read-only/examples/al-admin/config/environment.rb:13:in
`<top (required)>'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:156:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:156:in
`block in require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:521:in
`new_constants_in'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:156:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/commands/server.rb:84:in
`<top (required)>'
        from script/server:3:in `require'
        from script/server:3:in `<main>'
}}}

This can be fixed by:
{{{
# svn diff lib/active_ldap/user_password.rb
Index: lib/active_ldap/user_password.rb
===================================================================
--- lib/active_ldap/user_password.rb    (revision 837)
+++ lib/active_ldap/user_password.rb    (working copy)
@@ -1,6 +1,6 @@
 require 'English'
-require 'md5'
-require 'sha1'
+require 'digest/md5'
+require 'digest/sha1'

 module ActiveLdap
   module UserPassword
}}}

Trying to run server again:
{{{
[root al-admin]# script/server
=> Booting WEBrick
=> Rails 2.3.1 application starting on http://0.0.0.0:3000
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:81:in
`block in <module:Salt>': undefined method `to_a' for ".":String
(NoMethodError)
        from
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:80:in
`collect'
        from
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:80:in
`<module:Salt>'
        from
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:79:in
`<module:UserPassword>'
        from
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:6:in
`<module:ActiveLdap>'
        from
/root/ruby-activeldap-read-only/lib/active_ldap/user_password.rb:5:in `<top
(required)>'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from /root/ruby-activeldap-read-only/lib/active_ldap.rb:969:in
`<top (required)>'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:158:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/requires.rb:7:in
`block in require_library_or_gem'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/reporting.rb:11:in
`silence_warnings'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/requires.rb:5:in
`require_library_or_gem'
        from
/root/ruby-activeldap-read-only/examples/al-admin/../../rails/init.rb:1:in
`block in evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:146:in `eval'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:146:in `block
in evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/core_ext/ke
rnel/reporting.rb:11:in
`silence_warnings'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:142:in
`evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin.rb:48:in `load'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin/loader.rb:38:in
`block in load_plugins'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin/loader.rb:37:in
`each'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/rails/plugin/loader.rb:37:in
`load_plugins'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/initializer.rb:346:in
`load_plugins'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/initializer.rb:163:in `process'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/initializer.rb:113:in `run'
        from
/root/ruby-activeldap-read-only/examples/al-admin/config/environment.rb:13:in
`<top (required)>'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:156:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:156:in
`block in require'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:521:in
`new_constants_in'
        from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.1/lib/active_support/dependencie
s.rb:156:in
`require'
        from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.1/lib/commands/server.rb:84:in
`<top (required)>'
        from script/server:3:in `require'
        from script/server:3:in `<main>'
}}}

This can be fixed by:
{{{
# svn diff lib/active_ldap/user_password.rb
Index: lib/active_ldap/user_password.rb
===================================================================
--- lib/active_ldap/user_password.rb    (revision 837)
+++ lib/active_ldap/user_password.rb    (working copy)
@@ -78,7 +78,7 @@

     module Salt
       CHARS = ['.', '/', '0'..'9', 'A'..'Z', 'a'..'z'].collect do |x|
-        x.to_a
+        x.is_a?(Range) ? x.entries : x
       end.flatten

       module_function
}}}

Checked if it works in irb:
{{{
[root al-admin]# irb
>        CHARS = ['.', '/', '0'..'9', 'A'..'Z', 'a'..'z'].collect do |x|
*          x.is_a?(Range) ? x.entries : x
>        end.flatten
=> [".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B",
"C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q",
"R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
"v", "w", "x", "y", "z"]
}}}

Trying to run server again:
{{{
[root al-admin]# script/server
=> Booting WEBrick
=> Rails 2.3.1 application starting on http://0.0.0.0:3000
Missing these required gems:
  locale_rails

You're running:
  ruby 1.9.1.0 at /usr/bin/ruby
  rubygems 1.3.1 at /root/.gem/ruby/1.9.1, /usr/lib/ruby/gems/1.9.1

Run `rake gems:install` to install the missing gems.
}}}

After installing needed gem and running server - running hangs:
{{{
[root al-admin]# gem list
*** LOCAL GEMS ***
actionmailer (2.3.1)
actionpack (2.3.1)
activerecord (2.3.1)
activeresource (2.3.1)
activesupport (2.3.1)
daemons (1.0.10)
eventmachine (0.12.4)
locale (0.9.0)
locale_rails (0.1.0)
rack (0.9.1)
rails (2.3.1)
rake (0.8.4)
test-unit (2.0.2)
thin (1.0.0)

[root al-admin]# script/server
=> Booting WEBrick
=> Rails 2.3.1 application starting on http://0.0.0.0:3000
}}}

From other shell you can see CPU load by script/server:
{{{
[root al-admin]# top                                            
top - 14:42:09 up 3 days,  3:42,  3 users,  load average: 0.82, 0.43, 0.33
Tasks:  72 total,   3 running,  69 sleeping,   0 stopped,   0 zombie
Cpu(s): 99.7%us,  0.3%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    969284k total,   855808k used,   113476k free,   134720k buffers
Swap:  2104504k total,        0k used,  2104504k free,   566508k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND      


21294 root      20   0 34688  28m 3756 R 99.3  3.0   1:39.00 ruby         


}}}

And only kill -9 helps to stop server :(
Please help me.

Small info about migrating to Ruby 1.9:
- http://boga.wordpress.com/2008/04/15/ruby-19-porting-notes/
- http://www.scribd.com/doc/2589469/Migrating-to-Ruby-19

Original issue reported on code.google.com by [email protected] on 5 Mar 2009 at 1:57

validates_uniqueness_of not working?

What steps will reproduce the problem?
1. Write a validates_uniqueness_of validation in your model
   e.g.

class User < ActiveLdap::Base
     ldap_mapping   :dn_attribute => 'cn',
                    :prefix => 'ou=People',
                    :classes => ['top','posixAccount']
     validates_uniqueness_of :uid
end


2. Try to save, it'll fail with the following error message

>> u = User.new
=> #<User objectClass:<top, posixAccount>, must:<cn, gidNumber, homeDirectory, 
objectClass, uid, uidNumber>, may:<description, gecos, loginShell, 
userPassword>, cn: [], commonName: [], description: [], gecos: [], gidNumber: 
[], homeDirectory: [], loginShell: [], objectClass: ["top", "posixAccount"], 
uid: [], uidNumber: [], userPassword: [], userid: []>
>> u.uid = "test"
=> "test"
>> u.valid?
ArgumentError: one hash required
        from gems/gems/gettext-2.1.0/lib/gettext/core_ext/string.rb:78:in `%'
        from gems/gems/activeldap-1.2.2/lib/active_ldap/validations.rb:137:in `validate_dn'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:178:in `send'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:178:in `evaluate_method'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:166:in `call'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `run'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `each'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `send'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `run'
        from gems/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:276:in `run_validations_without_active_ldap_support'
        from gems/gems/activeldap-1.2.2/lib/active_ldap/validations.rb:65:in `run_callbacks'
        from gems/gems/activerecord-2.3.8/lib/active_record/validations.rb:1110:in `valid_without_callbacks?'
        from gems/gems/activerecord-2.3.8/lib/active_record/callbacks.rb:315:in `valid?'
        from (irb):3



What version of the product are you using? On what operating system?
  I'm using current SVN-HEAD as ruby gem with rails 2.3.8


Original issue reported on code.google.com by [email protected] on 17 Jun 2010 at 1:42

Problem loading the gem with latest ruby versions

What steps will reproduce the problem?

I have this class:

  class LdapUser < ActiveLdap::Base
    SAVE_ENVIROMENTS = %w(development test selenium staging)

    ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=Users', :scope => :one

    def self.authenticate(username, password)
      user = self.find(:first, :attribute => 'uid', :value => username)
unless username.blank?
      return user.nil? ? false : ActiveLdap::UserPassword.valid?(password,
user[:userPassword])
    rescue ActiveLdap::ConnectionNotEstablished, ActiveLdap::ConnectionError
      return SAFE_ENVIROMENTS.include?(RAILS_ENV) ? true : false
    end
  end # LdapUser

What is the expected output? What do you see instead?

It just raise a MissingSourceFile exception:

no such file to load: ldap

See attached exception.txt file

What version of the product are you using? On what operating system?

activeldap versions 1.0.1, 1.0.2

* ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
* Debian GNU/Linux lenny/sid

* ruby 1.8.6 (2008-08-08 patchlevel 286) [x86_64-linux]
* Debian GNU/Linux etch

tested with rails versions: 2.x

Please provide any additional information below.

It works fine with old ruby:

* ruby 1.8.5 (2006-08-25) [x86_64-linux]

Original issue reported on code.google.com by [email protected] on 16 Nov 2008 at 10:50

Attachments:

error when loading ldif files

What steps will reproduce the problem?

I'm trying to upload ldif to server. Code looks like this:

require 'active_ldap'
basedn="dc=test,dc=local"
ActiveLdap::Base.establish_connection(
  :host=>"127.0.0.1",
  :port=>9009,
  :base=>basedn,
  :binddn=>"cn=root,#{basedn}",
  :password_block=>Proc.new { 't4qra349' },
  :allow_anonymous=>false,
  :try_sasl=>false
)
ldiftxt=<<EOF
version: 1

dn: ou=users,#{basedn}
objectClass: top
objectClass: organizationUnit
ou: users
EOF
ldif=ActiveLdap::Ldif.parse(ldiftxt)


What is the expected output? What do you see instead?

It should parse object in given ldif. Intead I get:
/usr/lib/ruby/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/ldif.rb:27:in
`parse': version: 1 (ActiveLdap::LdifInvalid)

dn: ou=users,dc=test,dc=local
objectClass: top
objectClass: organizationUnit
ou: users
 is invalid LDIF: unsupported version: 1        from
/usr/lib/ruby/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/ldif.rb:46:in
`parse'
        from bin/test_ldap.rb:30


What version of the product are you using? On what operating system?
activeldap-0.9.0 on debian etch (ruby 1.8)

Please provide any additional information below.

Problem is in line 27 of ldif.rb - you compare integer against string. I
attached patch i diff format (it's my first patch ever :)

Original issue reported on code.google.com by [email protected] on 12 Jan 2008 at 6:52

Attachments:

[Ruby 1.9 Support

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


Please use labels and text to provide additional information.


Original issue reported on code.google.com by [email protected] on 10 Mar 2009 at 12:22

Problems with assotiations

What steps will reproduce the problem?
1. Define Objects in OpenLDAP:

class Employee < ActiveLdap::Base
ldap_mapping :dn_attribute => "uid",
:classes => ["inetOrgPerson", "posixAccount"],
:prefix => "ou=People"
belongs_to :groups, :class_name => 'Group', :many => 'uniqueMember',
:primary_key => 'dn'


class Group < ActiveLdap::Base
ldap_mapping :dn_attribute => "cn", :classes => ["groupOfUniqueNames"],
:prefix => "ou=Groups"
has_many :employees, :class_name => "Employee", :wrap => "uniqueMember",
:primary_key => 'dn'
has_many :externals, :class_name => "External", :wrap => 'uniqueMember',
:primary_key => 'dn'
has_many :nested_groups, :class_name => "Group", :extend => "uniqueMember",
:primary_key => 'dn'

class External < ActiveLdap::Base
ldap_mapping :dn_attribute => "cn",
:classes => ["inetOrgPerson"],
:prefix => "ou=People,ou=Externals,ou=Accounts"
belongs_to :clients, :class_name => 'Client', :primary_key => 'o'
belongs_to :groups, :class_name => 'Group', :many => 'uniqueMember',
:primary_key => 'dn'


class Client < ActiveLdap::Base
ldap_mapping :dn_attribute => "o", :classes => ["organization"],
:prefix => "ou=Clients,ou=Externals,ou=Accounts", :scope => :one
has_many :externals, :class_name => "External", :foreign_key => 'o'

2. Get groups employees (members):
Group.new("some_group_with_unique_members").employees


What is the expected output? What do you see instead?

I should get some employees (if defined) but what I'm getting is nil.
There is some issue with creating ldap query - openldap log give me:

Mar 18 13:59:35 tandetny slapd[9991]: conn=0 op=0 RESULT tag=97 err=0 text=
Mar 18 13:59:35 tandetny slapd[9991]: conn=0 op=1 SRCH
base="ou=Groups,dc=power,dc=com,dc=pl" scope=2 deref=0
filter="(&(&(objectClass=pmUser)(cn=admins*))(&(objectClass=groupOfUniqueNames))
)"
Mar 18 13:59:35 tandetny slapd[9991]: conn=0 op=1 SEARCH RESULT tag=101
err=0 nentries=1 text=
Mar 18 13:59:35 tandetny slapd[9991]: conn=0 op=2 SRCH
base="ou=People,dc=power,dc=com,dc=pl" scope=2 deref=0
filter="(&(uid=ktomczyk,ou=people,dc=som,dc=com=)(&(objectClass=inetOrgPerson)(o
bjectClass=posixAccount)))"
Mar 18 13:59:35 tandetny slapd[9991]: conn=0 op=2 SEARCH RESULT tag=101
err=0 nentries=0 text=

There are some '=' sign added at end of search query for employee

Original issue reported on code.google.com by [email protected] on 18 Mar 2010 at 1:07

Running console/server with Rubygems 1.3.2

Hello koutou. I found problem  with running console/server on Rubygems
1.3.2. I think it is problem of RubyGems but I'm not sure.

What steps will reproduce the problem?
1. gem update --system
2. # script/console

What is the expected output? What do you see instead?
Loading production environment (Rails 2.3.2)
/usr/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:293:in `search':
undefined method `empty?' for nil:NilClass (NoMethodError)
 from /usr/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:264:in `find_name'
 from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/vendor_gem_source_index.rb:1
14:in
`find_name'
 from /usr/lib/ruby/site_ruby/1.9.1/rubygems.rb:242:in `activate'
 from /usr/lib/ruby/site_ruby/1.9.1/rubygems.rb:50:in `gem'
 from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap.rb:914:in
`rescue in block in <top (required)>'
 from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap.rb:907:in
`block in <top (required)>'
 from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap.rb:943:in `call'
 from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap.rb:943:in
`<top (required)>'
 from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencie
s.rb:158:in
`require'
 from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencie
s.rb:158:in
`require'
 from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/ke
rnel/requires.rb:7:in
`block in require_library_or_gem'
 from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/ke
rnel/reporting.rb:11:in
`silence_warnings'
 from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/ke
rnel/requires.rb:5:in
`require_library_or_gem'
 from /var/onm/vendor/plugins/activeldap-trunk/rails/init.rb:1:in `block in
evaluate_init_rb'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:146:in
`eval'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:146:in
`block in evaluate_init_rb'
 from
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/ke
rnel/reporting.rb:11:in
`silence_warnings'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:142:in
`evaluate_init_rb'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin.rb:48:in
`load'
 from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:38:in
`block in load_plugins'
 from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in
`each'
 from
/usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in
`load_plugins'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:348:in
`load_plugins'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:163:in
`process'
 from /usr/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
 from /var/onm/config/environment.rb:12:in `<top (required)>'
 from /usr/lib/ruby/1.9.1/irb/init.rb:262:in `require'
 from /usr/lib/ruby/1.9.1/irb/init.rb:262:in `block in load_modules'
 from /usr/lib/ruby/1.9.1/irb/init.rb:260:in `each'
 from /usr/lib/ruby/1.9.1/irb/init.rb:260:in `load_modules'
 from /usr/lib/ruby/1.9.1/irb/init.rb:20:in `setup'
 from /usr/lib/ruby/1.9.1/irb.rb:53:in `start'
 from /usr/bin/irb:12:in `<main>'


Please use labels and text to provide additional information.
I've make patch for Rubygems. I need to send this patch to Rubygems developers?
===
--- source_index.rb     2009-04-29 16:16:19.000000000 +0200
+++ source_index.rb.orig 2009-04-28 09:13:00.000000000 +0200
@@ -290,7 +290,7 @@
version_requirement = gem_pattern.version_requirements
gem_pattern = if Regexp === gem_pattern.name then
  gem_pattern.name
-      elsif gem_pattern.name.nil? || gem_pattern.name.empty? then
+      elsif gem_pattern.name.empty? then
  //
else
  /^#{Regexp.escape gem_pattern.name}$/

===

Original issue reported on code.google.com by [email protected] on 29 Apr 2009 at 2:52

new_entry? on existing instantiated LDAP object always returns true

What steps will reproduce the problem?
1. create instance of existing entry in LDAP
class User < ActiveLdap::Base
  ldap_mapping :dn_attribute => "cn",
               :classes => ["inetOrgPerson"],
               :prefix => "ou=People"
end

2. create new entry (after connecting to LDAP of course)
  user = User.new("me")
  user.new_entry? # return true
  user.save
3. instantiate existing entry
  user = User.new("me")
  user.new_entry?("me") #returns true

At first new_entry? should return false, but more important is other issue.
For me it seems that instantiating new objects which already is in LDAP
must throw some exception - You can modify existing record in LDAP when
thinking that it is newly created one. For existing objects You should use
find method. 
I give You one example from my Rails app:

You try to create existing entry with cn=John. When you enter create
controller's method you want to use new method on that object (which should
create new unique object) but instead you are updating currently existing
one without that knowledge.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Oct 2009 at 10:17

to_xml should handle :except and :only options

What steps will reproduce the problem?
1. Create an user ActiveLdap mapping
2. user = User.find(:first)
3. user.to_xml(:except => [:objectClass, :userPassword])

What is the expected output? What do you see instead?
Expected:
<user>
  <dn>cn=Joe Bloggs,ou=people,dc=plop,dc=org</dn>
  <cn>Joe Bloggs</cn>
  <displayName>Mr J Bloggs</displayName>
  <gender>1</gender>
  <hgPersonUid>743</hgPersonUid>
  <mail>[email protected]</mail>
  <o>HealthGrid</o>
  <sn>Joe Bloggs</sn>
  <st>France</st>
  <uid>joe.bloggs</uid>
</user>

Actual output:
<user>
  <dn>cn=Joe Bloggs,ou=people,dc=plop,dc=org</dn>
  <cn>Joe Bloggs</cn>
  <displayName>Mr J Bloggs</displayName>
  <gender>1</gender>
  <hgPersonUid>743</hgPersonUid>
  <mail>[email protected]</mail>
  <o>HealthGrid</o>
  <objectClass>hgPerson</objectClass>
  <objectClass>inetOrgPerson</objectClass>
  <objectClass>organizationalPerson</objectClass>
  <objectClass>person</objectClass>
  <objectClass>top</objectClass>
  <sn>Joe Bloggs</sn>
  <st>France</st>
  <uid>joe.bloggs</uid>
  <userPassword>{SHA}ZPr10LHcMR/Q+Ur2T2wpagMEVXE=</userPassword>
</user>

What version of the product are you using? On what operating system?
- activeldap 1.0.1
- Rails 2.1.0
- archlinux and debian etch

Please provide any additional information below.
The way ActiveRecord does this:
- http://api.rubyonrails.org/classes/ActiveRecord/XmlSerialization.html#M000923
-
http://github.com/rails/rails/tree/master/activerecord/lib/active_record/seriali
zers/xml_serializer.rb

Thanks a lot for all you work.

Original issue reported on code.google.com by [email protected] on 7 Jul 2008 at 2:23

ActiveLdap::DistinguishedNameInvalid in method .id when RDN include '+', '=' or '#'

What steps will reproduce the problem?
1. Install ActiveLdap from trunk (r822)
2. Generate model (org_unit.rb)
class OrgUnit < ActiveLdap::Base
  ldap_mapping :dn_attribute => "ou", :prefix => "", :classes =>
['organizationalUnit']
end
3. # script/console
 Loading production environment (Rails 2.2.2)
>> o = OrgUnit.new
SASL/GSSAPI authentication started
SASL username: onm@__.com
SASL SSF: 56
SASL data security layer installed.
=> #<OrgUnit objectClass:<organizationalUnit>, must:<objectClass, ou>,
may:<businessCategory, description, destinationIndicator,
facsimileTelephoneNumber, internationaliSDNNumber, l,
physicalDeliveryOfficeName, postOfficeBox, postalAddress, postalCode,
preferredDeliveryMethod, registeredAddress, searchGuide, seeAlso, st,
street, telephoneNumber, teletexTerminalIdentifier, telexNumber,
userPassword, x121Address>, businessCategory: [], description: [],
destinationIndicator: [], facsimileTelephoneNumber: [], fax: [],
internationaliSDNNumber: [], l: [], localityName: [], objectClass:
["organizationalUnit"], organizationalUnitName: [], ou: [],
physicalDeliveryOfficeName: [], postOfficeBox: [], postalAddress: [],
postalCode: [], preferredDeliveryMethod: [], registeredAddress:
[],searchGuide: [], seeAlso: [], st: [], stateOrProvinceName: [], street:
[], streetAddress: [], telephoneNumber: [], teletexTerminalIdentifier: [],
telexNumber: [], userPassword: [], x121Address: []>
>> o.ou = "Test" => "Test"
>> o.id => "Test"
>> o.ou = "Test#" => "Test#"
>> o.id

What is the expected output? What do you see instead?
What steps will reproduce the problem?
1. Install ActiveLdap from trunk (r822)
2. Generate model (org_unit.rb)
class OrgUnit < ActiveLdap::Base
  ldap_mapping :dn_attribute => "ou", :prefix => "", :classes =>
['organizationalUnit']
end
3. # script/console
 Loading production environment (Rails 2.2.2)
>> o = OrgUnit.new
SASL/GSSAPI authentication started
SASL username: onm@__.com
SASL SSF: 56
SASL data security layer installed.
=> #<OrgUnit objectClass:<organizationalUnit>, must:<objectClass, ou>,
may:<businessCategory, description, destinationIndicator,
facsimileTelephoneNumber, internationaliSDNNumber, l,
physicalDeliveryOfficeName, postOfficeBox, postalAddress, postalCode,
preferredDeliveryMethod, registeredAddress, searchGuide, seeAlso, st,
street, telephoneNumber, teletexTerminalIdentifier, telexNumber,
userPassword, x121Address>, businessCategory: [], description: [],
destinationIndicator: [], facsimileTelephoneNumber: [], fax: [],
internationaliSDNNumber: [], l: [], localityName: [], objectClass:
["organizationalUnit"], organizationalUnitName: [], ou: [],
physicalDeliveryOfficeName: [], postOfficeBox: [], postalAddress: [],
postalCode: [], preferredDeliveryMethod: [], registeredAddress:
[],searchGuide: [], seeAlso: [], st: [], stateOrProvinceName: [], street:
[], streetAddress: [], telephoneNumber: [], teletexTerminalIdentifier: [],
telexNumber: [], userPassword: [], x121Address: []>
>> o.ou = "Test" => "Test"
>> o.id => "Test"
>> o.ou = "Test#" => "Test#"
>> o.id


What is the expected output? What do you see instead?
Must return "Test#" but raised

---
ActiveLdap::DistinguishedNameInvalid: ou=_,dc=_,dc=_,dc=com is invalid
distinguished name (DN): attribute type is missing
 from
/var/onm/vendor/activeldap-trunk/lib/active_ldap/distinguished_name.rb:55:in 
`scan_attribute_type'
 from
/var/onm/vendor/activeldap-trunk/lib/active_ldap/distinguished_name.rb:32:in 
`parse'
 from
/var/onm/vendor/activeldap-trunk/lib/active_ldap/distinguished_name.rb:157:in
`parse'
 from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:1219:in
`update_dn'
 from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:1268:in
`ensure_update_dn'
 from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:1266:in
`synchronize'
 from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:1266:in
`ensure_update_dn'
 from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:710:in
`dn_attribute'
 from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:695:in `id'
 from (irb):5

---

Original issue reported on code.google.com by [email protected] on 4 Feb 2009 at 4:11

Using activeldap-trunk's UserPassword class with ssha method

I'm trying to use the ssha method of the UserPassword class of ActiveLdap 
(trunk), on rails 2.1.2 
(since I couldn't get the models to generate with 2.2.2)

I've installed activeldap-trunk under my rails vendors dir, and have it 
appropriately included in 
my environment.rb .

From my rails root, I run:

# ./script/console development
Loading development environment (Rails 2.1.2)
>> require 'active_ldap'
=> []
>> pw = ActiveLdap::UserPassword.ssha('pw')
NameError: "Activeldap-trunk::Lib::ActiveLdap" is not a valid constant name!
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:116:in `qualified_const_defined?'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:339:in `new_constants_in'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:331:in `collect'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:331:in `new_constants_in'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:215:in `load_file'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:96:in `require_or_load'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:261:in `load_missing_constant'
    from /Library/Ruby/Gems/1.8/gems/activesupport-
2.1.2/lib/active_support/dependencies.rb:468:in `const_missing'
    from (irb):2

I have a current copy of trunk:

[%RAILS_ROOT/vendor/activeldap-trunk]: svn up

Fetching external item into 'test-unit'
External at revision 184.

At revision 796.

Is there any way around this?  I'm simply trying to hash a password to save it.

Thanks

Original issue reported on code.google.com by [email protected] on 6 Jan 2009 at 8:46

Connection hangs on timeout

What steps will reproduce the problem?
1. Enable :timeout for the activeldap configuration
2. script/console in RoR

What is the expected output? What do you see instead?

I expect no error.  Instead I get an exception like the following:

/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/timeout.rb:63:in
`waitpid': SIGALRM (SignalException)
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/timeout.rb:63:in
`alarm'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/base.rb:253:in
`with_timeout'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/ldap.rb:149:in
`with_timeout'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/base.rb:208:in
`operation'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/ldap.rb:127:in
`prepare_connection'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/base.rb:33:in
`connect'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/ldap.rb:36:in
`connect'
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/adapter/base.rb:492:in
`reconnect'
         ... 11 levels...
        from
/var/lib/gems/1.8/gems/activeldap-0.9.0/lib/active_ldap/operations.rb:185:in
`find'
        from (irb):1:in `irb_binding'
        from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
        from /usr/lib/ruby/1.8/irb/workspace.rb:52

What version of the product are you using? On what operating system?

ActiveLdap 0.9.0 gem
Rails 1.99.0 (2.0RC1)

Please provide any additional information below.

Configuration is actually embedded in a module, rather than with other
activerecord models, which are connected to a mysql database.  I wanted to
use activeldap just to import information from an external ldap database
and then only if the ldap database is available.  I was hoping that I could
catch failed connection exception and skip the ldap import when that
happens.  Advice on how to achieve that another way would be appreciated if
what I'm trying to do here is not the simplest approach.

Original issue reported on code.google.com by [email protected] on 19 Nov 2007 at 4:23

[Ruby 1.9 Support] :: Running Tests

What steps will reproduce the problem?
1. svn checkout http://ruby-activeldap.googlecode.com/svn/trunk/
ruby-activeldap-read-only
2. cd ruby-activeldap-read-only
3. generate test/config.yaml
----
test:
  host: 127.0.0.1
  port: 389
  base: dc=127.0.0.1,dc=com
  bind_dn: ""
  try_sasl: true
  method: :tls
  sasl_mechanisms: ["GSSAPI"]
  allow_anonymous: false
----
4. run ruby test/run-test.rb

What is the expected output? What do you see instead?

Please see attached log.

Original issue reported on code.google.com by [email protected] on 10 Mar 2009 at 12:45

Attachments:

Modifing array

What steps will reproduce the problem?
1. Load an entry from ldap, using ActiveLdap - find method. You get
ActiveLdap object.
2. Modify object's attribute which is mapped array with multiple elements
from LDAP. Add or remove array element, operating still on the same array.
3. Save the object. 

Changes in array LDAP attribute are expected but there aren't. The problem
disappears when the process of modification ActiveLDAP object's attribute
is made by creating new array variable, copying proper elements from
"ancestor" array to it, and then modifing object's attribute with created
new array. 

I guess the problem is with ActiveLdap just before save algorithm. It
decides which attributes are going to be saved by comparing old values with
new one of ActiveLdap object's attributes using reference not actual value. 

I hope the problem was described well. If not, please contact me at
wpiatkowski < at > power.com.pl.

I used 37513 revision from trunk.

Regards



Original issue reported on code.google.com by [email protected] on 11 Mar 2009 at 2:59

Raised when RDN - blank (DistinguishedNameNotSetError)

What steps will reproduce the problem?
1. Install ActiveLdap from trunk (r830)
2. Generate model (org_unit.rb)
class OrgUnit < ActiveLdap::Base
  ldap_mapping :dn_attribute => "ou", :prefix => "", :classes =>
['organizationalUnit']
end
3. # script/console
 Loading production environment (Rails 2.2.2)
>> OrgUnit.create

What is the expected output? What do you see instead?
Must return false and add error ("ou" => "can't be blank") but raised:

---
SASL/GSSAPI authentication started
SASL username: onm@__.__.com
SASL SSF: 56
SASL data security layer installed.
ActiveLdap::DistinguishedNameNotSetError: #<OrgUnit
objectClass:<organizationalUnit>, must:<objectClass, ou>,
may:<businessCategory, description, destinationIndicator,
facsimileTelephoneNumber, internationaliSDNNumber, l,
physicalDeliveryOfficeName, postOfficeBox, postalAddress, postalCode,
preferredDeliveryMethod, registeredAddress, searchGuide, seeAlso, st,
street, telephoneNumber, teletexTerminalIdentifier, telexNumber,
userPassword, x121Address>, businessCategory: [], description: [],
destinationIndicator: [], facsimileTelephoneNumber: [], fax: [],
internationaliSDNNumber: [], l: [], localityName: [], objectClass:
["organizationalUnit"], organizationalUnitName: [], ou: [],
physicalDeliveryOfficeName: [], postOfficeBox: [], postalAddress: [],
postalCode: [], preferredDeliveryMethod: [], registeredAddress: [],
searchGuide: [], seeAlso: [], st: [], stateOrProvinceName: [], street: [],
streetAddress: [], telephoneNumber: [], teletexTerminalIdentifier: [],
telexNumber: [], userPassword: [], x121Address: []>'s DN attribute (ou)
isn't set

from /var/onm/vendor/activeldap-trunk/lib/active_ldapbase.rb:1293:in
`compute_dn'
from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:691:in `dn'
from /var/onm/vendor/activeldap-trunk/lib/active_ldap/validations.rb:93:in
`validate_dn'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
178:in
`send'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
178:in
`evaluate_method'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
166:in
`call'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
90:in
`run'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
90:in
`each'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
90:in
`send'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
90:in
`run'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:
277:in
`run_validations_without_active_ldap_support'
from /var/onm/vendor/activeldap-trunk/lib/active_ldap/validations.rb:62:in
`run_callbacks'
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/validations.rb:
1029:in
`valid_without_callbacks?'
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:28
6:in
`valid?'
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/validations.rb:
1008:in
`save'
from /var/onm/vendor/activeldap-trunk/lib/active_ldap/base.rb:355:in `create'
from (irb):1>>

---

Original issue reported on code.google.com by [email protected] on 16 Feb 2009 at 4:14

Modify RDN does not work in update_attributes for dn_attribute

What steps will reproduce the problem?
1. create model org_unit.rb
class OrgUnit < ActiveLdap::Base
  ldap_mapping :dn_attribute => "ou", :prefix => "", :classes => ['top', 
'organizationalUnit']
end
2. run script/console
3. create new record and try update ou via update_attibutes method:

ou = OrgUnit.create("test")

method .update_attribute works normal:

ou.update_attribute("ou", "test2")
=> true
ou.ou
=> "test2"
ou.update_attribute("id", "test4")
=> true
ou.ou
=> "test4"

What do you see instead?

>> ou.update_attributes({:id => "test3"})
=> true
>> ou.dc
>> ou.ou
=> "test3"

>> ou.update_attributes({:ou => "test4", :description => "test"})
=> true
>> ou.ou
=> "test3"
>> ou.description
=> "test"

What is the expected output?
RDN should be modified to "test4"

Please use labels and text to provide additional information.
I would suggest: .update_attributes should made modify_rnd and then update 
other attributes.

Original issue reported on code.google.com by [email protected] on 10 Oct 2009 at 9:34

undefined method `search_with_limit' for #<LDAP::Conn:0x2aaab0227920>

activeldap-1.2.2

I was retrofitting some older code using ActiveLDAP.  I was doing searches such 
as:

mg = MailGroup.find(
  :first,
  :base => '',
  :scope => :sub,
  :filter => "(mail=#{addr})",
  :attributes => [ 'dn', 'mail' ]
)

Instead of receiving a result, as used occur, I am instead getting a stack 
trace.

I am noticing that the search_with_limit function is not defined in ldap.rb, 
but only in ldap_ext.rb

undefined method `search_with_limit' for #<LDAP::Conn:0x2aaab0227920>
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/ldap.rb:178
:in `send'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/ldap.rb:178
:in `execute'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:659
:in `log'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benc
hmark.rb:10:in `realtime'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:659
:in `log'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/ldap.rb:178
:in `execute'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/ldap.rb:89:
in `search'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:170
:in `search'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:275
:in `operation'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/timeout.rb:15:in 
`call'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/timeout.rb:15:in 
`alarm'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:321
:in `with_timeout'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:274
:in `operation'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:169
:in `search'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/ldap.rb:83:
in `search'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:637
:in `root_dse'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:625
:in `root_dse_values'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/adapter/base.rb:143
:in `naming_contexts'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/base.rb:647:in 
`compute_base'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/base.rb:434:in 
`base'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:203:i
n `split_search_value'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:40:in
 `search'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:284:i
n `find_every'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:257:i
n `find_initial'
/usr/lib/ruby/gems/1.8/gems/activeldap-1.2.2/lib/active_ldap/operations.rb:222:i
n `find'

<snipped>

Original issue reported on code.google.com by [email protected] on 29 Jul 2010 at 3:53

Provide SASL-option support, primarily for authzid

The attached patches for ruby-ldap and ruby-activeldap provide for passing
SASL authzid options, useful when GSSAPI is being used.

Example usage:
irb> require "active_ldap"
=> true
irb> ActiveLdap::Base.setup_connection(:host => 'ldap-test', :port => 636,
:method => :ssl :base => 'dc=test', :bind_dn =>
"uid=twopir,ou=accounts,dc=test", :allow_anonymous => false, :try_sasl =>
true, :sasl_options => {:authzid => "dn:cn=Manager,dc=test"}, :sasl_quiet
=> false)
=> nil
irb> class Account < ActiveLdap::Base ; ldap_mapping ; end
SASL/GSSAPI authentication started
SASL username: dn:cn=Manager,dc=test
SASL SSF: 56
SASL data security layer installed.
=> Account(objectClass:<top>, must:<objectClass: OID>, may:<>)
irb> k = Account.find("uid=demo");
irb* k.gecos
=> "Demo Account"
irb> k.gecos = "Testing gssapi-authenticated writes"
=> "Testing gssapi-authenticated writes"
irb> k.save
=> true

Original issue reported on code.google.com by [email protected] on 5 Mar 2010 at 11:01

Attachments:

Rails2.3.2 support

What steps will reproduce the problem?
1. downoad activeldap gems
2. gem install activeldap --local
3. irb -rubygems
4. require 'active_ldap'

What is the expected output? What do you see instead?
irb(main):001:0> require 'active_ldap'
NameError: uninitialized constant ActiveRecord::Validations
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:440:in
`load_missing_constant'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:80:in
`const_missing'
    from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3139
    from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3137:in
`class_eval'
    from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3137
    from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:
9
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:156:in
`require'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:521:in
`new_constants_in'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:156:in
`require'
    from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.2/lib/active_ldap/validations.rb:1
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:156:in
`require'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:521:in
`new_constants_in'
    from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.
rb:156:in
`require'
    from /usr/lib/ruby/gems/1.8/gems/activeldap-1.0.2/lib/active_ldap.rb:972
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in
`gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
irb(main):002:0> 


What version of the product are you using? On what operating system?
activeldap version: 1.0.2
OS: ubuntu8.10


Original issue reported on code.google.com by [email protected] on 23 Mar 2009 at 5:45

Raise when rdn include symbols like '=' or '#'

What steps will reproduce the problem?
1. Generate model (user.rb)
class User < ActiveLdap::Base
  ldap_mapping :dn_attribute => "uid", :prefix => "ou=users", :classes =>
['posixAccount', 'krb5Principal']
end
2. script/console
3. user = User.new "="

What is the expected output? What do you see instead?
ActiveLdap::DistinguishedNameInvalid: uid== is invalid distinguished name
(DN): attribute value is missing
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/distinguished_name.
rb:77:in
`scan_attribute_value'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/distinguished_name.
rb:34:in
`parse'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/distinguished_name.
rb:157:in
`parse'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/base.rb:1159:in 
`split_dn_value'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/base.rb:1134:in 
`update_dn'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/base.rb:1123:in 
`set_attribute'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/base.rb:659:in
`dn='
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/base.rb:565:in
`initialize_without_callbacks'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/callbacks.rb:44:in
`initialize'
        from (irb):2:in `new'
        from (irb):2

What version of the product are you using? On what operating system?
v1.0.1. Gentoo Linux 2.6.27 (or Arch Linux 2.6.25)

Please provide any additional information below.
Can you please put this message into user.errors ?

Original issue reported on code.google.com by [email protected] on 26 Dec 2008 at 3:04

Binding with username and password fails

What steps will reproduce the problem?
1. Try to bind to an LDAP server using a username and password

What is the expected output? What do you see instead?

Expect the bind to succeed.  Instead, get this exception (net-ldap)

NoMethodError (undefined method `to_ber' for 
#<ActiveLdap::DistinguishedName:0x67b0bfb2>):
  /Users/andy/torquebox/jruby/lib/ruby/gems/1.8/gems/net-ldap-
0.0.5/lib/net/ldap.rb:1295:in `bind_simple'
  /Users/andy/torquebox/jruby/lib/ruby/gems/1.8/gems/net-ldap-
0.0.5/lib/net/ldap.rb:1270:in `bind'
  activeldap (1.2.0) lib/active_ldap/adapter/net_ldap.rb:135:in `execute'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:654:in `log'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:654:in `log'
  activeldap (1.2.0) lib/active_ldap/adapter/net_ldap.rb:135:in `execute'
  activeldap (1.2.0) lib/active_ldap/adapter/net_ldap.rb:269:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:368:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/net_ldap.rb:263:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:85:in `bind'
  activeldap (1.2.0) lib/active_ldap/adapter/net_ldap.rb:52:in `bind'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:53:in `connect'
  activeldap (1.2.0) lib/active_ldap/adapter/net_ldap.rb:24:in `connect'
  activeldap (1.2.0) lib/active_ldap/base.rb:1014:in `bind'

Or this exception (JRuby)

NativeException (java.lang.ClassCastException: org.jruby.RubyObject cannot be 
cast to 
java.lang.String):
  com/sun/jndi/ldap/LdapCtx.java:2624:in `connect'
  com/sun/jndi/ldap/LdapCtx.java:2602:in `ensureOpen'
  com/sun/jndi/ldap/LdapCtx.java:2576:in `ensureOpen'
  com/sun/jndi/ldap/LdapCtx.java:2572:in `reconnect'
  javax/naming/ldap/InitialLdapContext.java:173:in `reconnect'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi_connection.rb:164:in `setup_context'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi_connection.rb:99:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi.rb:88:in `execute'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:654:in `log'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:654:in `log'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi.rb:88:in `execute'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi.rb:147:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:368:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi.rb:145:in `simple_bind'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:85:in `bind'
  activeldap (1.2.0) lib/active_ldap/adapter/base.rb:53:in `connect'
  activeldap (1.2.0) lib/active_ldap/adapter/jndi.rb:22:in `connect'
  activeldap (1.2.0) lib/active_ldap/base.rb:1014:in `bind'


What version of the product are you using? On what operating system?

1.2.0, 1.2.1 (svn trunk) on Mac OS X Snow Leopard

Please provide any additional information below.

I have been able to fix this by editing line 1007 in lib/active_ldap/base.rb.  
It currently reads

config = {:bind_dn => dn, :allow_anonymous => false}.merge(config)

I changed it so dn (which is an instance of ActiveLdap::DistinguishedName) is 
converted to a 
String:

config = {:bind_dn => dn.to_s, :allow_anonymous => false}.merge(config)

Original issue reported on code.google.com by [email protected] on 24 Nov 2009 at 5:04

Rails 2.2.2 Support

What steps will reproduce the problem?
1. gem install rails -v 2.2.2
2. gem uninstall gettext
3. Update old project to rails 2.2.2
4. Run script/server

What is the expected output? What do you see instead?

---
# script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with production environment...
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/modu
le/aliasing.rb:33:in
`alias_method': undefined method `rendering_runtime' for class
`ActionController::Base' (NameError)
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/modu
le/aliasing.rb:33:in
`alias_method_chain'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/action_controller/l
dap_benchmarking.rb:7:in
`included'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/action_controller/l
dap_benchmarking.rb:5:in
`class_eval'
        from
/usr/lib/ruby/gems/1.8/gems/activeldap-1.0.1/lib/active_ldap/action_controller/l
dap_benchmarking.rb:5:in
`included'
        from /var/iVOCS/onm/vendor/plugins/active_ldap/init.rb:31:in `include'
        from /var/iVOCS/onm/vendor/plugins/active_ldap/init.rb:31:in
`evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails/plugin.rb:103:in
`evaluate_init_rb'
        from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/core_ext/kern
el/reporting.rb:11:in
`silence_warnings'
         ... 36 levels...
        from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
        from script/server:3

---

What version of the product are you using? On what operating system?
Version activeldap-1.0.1, Linux

Please provide any additional information below.
This bug arose due following change in actionpack:

Change log for ActionPack-*2.2.0 [RC1] (October 24th, 2008)*
...
* Changed BenchmarkHelper#benchmark to report in milliseconds [DHH]
* Changed logging format to be millisecond based and skip misleading stats
[DHH]. Went from:
    Completed in 0.10000 (4 reqs/sec) | Rendering: 0.04000 (40%) | DB:
0.00400 (4%) | 200 OK [http://example.com]
  ...to:
    Completed in 100ms (View: 40, DB: 4) | 200 OK [http://example.com]
...

Patch that solves the problem is attached.

Original issue reported on code.google.com by [email protected] on 28 Nov 2008 at 9:48

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.