From codesite-noreply at google.com Sat Mar 6 01:24:12 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 06 Mar 2010 06:24:12 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1126 committed - * Ruby/LDAP adapter: use search_ext if available. Message-ID: <0016361e7a6e6b482504811be111@google.com> Revision: 1126 Author: koutou Date: Fri Mar 5 22:23:18 2010 Log: * Ruby/LDAP adapter: use search_ext if available. http://code.google.com/p/ruby-activeldap/source/detail?r=1126 Modified: /trunk/lib/active_ldap/adapter/ldap.rb /trunk/lib/active_ldap/adapter/ldap_ext.rb ======================================= --- /trunk/lib/active_ldap/adapter/ldap.rb Tue Aug 4 07:28:49 2009 +++ /trunk/lib/active_ldap/adapter/ldap.rb Fri Mar 5 22:23:18 2010 @@ -82,19 +82,17 @@ def search(options={}, &block) super(options) do |base, scope, filter, attrs, limit, callback| begin - i = 0 info = { :base => base, :scope => scope_name(scope), - :filter => filter, :attributes => attrs, - } - execute(:search, info, base, scope, filter, attrs) do |entry| - i += 1 + :filter => filter, :attributes => attrs, :limit => limit, + } + execute(:search_with_limit, + info, base, scope, filter, attrs, limit) do |entry| attributes = {} entry.attrs.each do |attr| attributes[attr] = entry.vals(attr) end callback.call([entry.dn, attributes], block) - break if limit and limit <= i end rescue RuntimeError begin ======================================= --- /trunk/lib/active_ldap/adapter/ldap_ext.rb Wed Jan 16 23:23:23 2008 +++ /trunk/lib/active_ldap/adapter/ldap_ext.rb Fri Mar 5 22:23:18 2010 @@ -50,6 +50,27 @@ end class Conn + begin + instance_method(:search_ext) + @@have_search_ext = true + rescue NameError + @@have_search_ext = false + end + + def search_with_limit(base, scope, filter, attributes, limit, &block) + if @@have_search_ext + search_ext(base, scope, filter, attributes, + false, nil, nil, 0, 0, limit || 0, &block) + else + i = 0 + search(base, scope, filter, attributes) do |entry| + i += 1 + block.call(entry) + break if limit and limit <= i + end + end + end + def failed? not error_code.zero? end From codesite-noreply at google.com Sat Mar 6 01:32:14 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 06 Mar 2010 06:32:14 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1128 committed - * JNDI adapter: log limit in search. Message-ID: <001636c927141cc3b904811bfeb1@google.com> Revision: 1128 Author: koutou Date: Fri Mar 5 22:27:48 2010 Log: * JNDI adapter: log limit in search. http://code.google.com/p/ruby-activeldap/source/detail?r=1128 Modified: /trunk/lib/active_ldap/adapter/jndi.rb ======================================= --- /trunk/lib/active_ldap/adapter/jndi.rb Mon Sep 21 18:15:52 2009 +++ /trunk/lib/active_ldap/adapter/jndi.rb Fri Mar 5 22:27:48 2010 @@ -45,7 +45,7 @@ super(options) do |base, scope, filter, attrs, limit, callback| info = { :base => base, :scope => scope_name(scope), :filter => filter, - :attributes => attrs, + :attributes => attrs, :limit => limit, } execute(:search, info, base, scope, filter, attrs, limit, callback, &block) From codesite-noreply at google.com Sat Mar 6 01:36:14 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 06 Mar 2010 06:36:14 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1129 committed - * JNDI adapter: use count_limit search control. Message-ID: <0016e64640dc6fe2b304811c0c88@google.com> Revision: 1129 Author: koutou Date: Fri Mar 5 22:34:42 2010 Log: * JNDI adapter: use count_limit search control. http://code.google.com/p/ruby-activeldap/source/detail?r=1129 Modified: /trunk/lib/active_ldap/adapter/jndi_connection.rb ======================================= --- /trunk/lib/active_ldap/adapter/jndi_connection.rb Mon Jun 1 07:27:18 2009 +++ /trunk/lib/active_ldap/adapter/jndi_connection.rb Fri Mar 5 22:34:42 2010 @@ -109,13 +109,12 @@ controls = SearchControls.new controls.search_scope = scope + controls.count_limit = limit if limit unless attrs.blank? controls.returning_attributes = attrs.to_java(:string) end - i = 0 @context.search(base, filter, controls).each do |result| - i += 1 attributes = {} result.attributes.get_all.each do |attribute| attributes[attribute.get_id] = attribute.get_all.collect do | value| @@ -123,7 +122,6 @@ end end callback.call([result.name_in_namespace, attributes], block) - break if limit and limit <= i end end From codesite-noreply at google.com Sat Mar 6 01:28:13 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sat, 06 Mar 2010 06:28:13 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1127 committed - * Net::LDAP adapter: log limit in search. Message-ID: <001636c92bbcbf6c9f04811bef97@google.com> Revision: 1127 Author: koutou Date: Fri Mar 5 22:27:23 2010 Log: * Net::LDAP adapter: log limit in search. http://code.google.com/p/ruby-activeldap/source/detail?r=1127 Modified: /trunk/lib/active_ldap/adapter/net_ldap.rb ======================================= --- /trunk/lib/active_ldap/adapter/net_ldap.rb Mon Sep 21 18:15:17 2009 +++ /trunk/lib/active_ldap/adapter/net_ldap.rb Fri Mar 5 22:27:23 2010 @@ -73,7 +73,7 @@ } info = { :base => base, :scope => scope_name(scope), - :filter => filter, :attributes => attrs, + :filter => filter, :attributes => attrs, :limit => limit } execute(:search, info, args) do |entry| attributes = {} From codesite-noreply at google.com Sun Mar 21 06:46:41 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 21 Mar 2010 10:46:41 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1130 committed - * change default log level to ERROR from UNKNOWN. Message-ID: <001485f9a4b2b5725604824d4b64@google.com> Revision: 1130 Author: koutou Date: Sun Mar 21 03:46:18 2010 Log: * change default log level to ERROR from UNKNOWN. http://code.google.com/p/ruby-activeldap/source/detail?r=1130 Modified: /trunk/lib/active_ldap/base.rb ======================================= --- /trunk/lib/active_ldap/base.rb Fri Dec 18 03:53:08 2009 +++ /trunk/lib/active_ldap/base.rb Sun Mar 21 03:46:18 2010 @@ -588,7 +588,7 @@ require 'logger' @@logger = Logger.new(STDERR) @@logger.progname = 'ActiveLdap' - @@logger.level = Logger::UNKNOWN + @@logger.level = Logger::ERROR end configuration[:logger] ||= @@logger end From codesite-noreply at google.com Sun Mar 21 07:02:44 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 21 Mar 2010 11:02:44 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1131 committed - * add net-ldap as extra dependencies in COMMENT. Message-ID: <001636c928c01af60f04824d855b@google.com> Revision: 1131 Author: koutou Date: Sun Mar 21 04:02:06 2010 Log: * add net-ldap as extra dependencies in COMMENT. http://code.google.com/p/ruby-activeldap/source/detail?r=1131 Modified: /trunk/Rakefile ======================================= --- /trunk/Rakefile Wed Dec 16 03:34:41 2009 +++ /trunk/Rakefile Sun Mar 21 04:02:06 2010 @@ -65,6 +65,7 @@ self.changes = self.paragraphs_of('CHANGES', 1..2).join("\n\n") self.extra_deps = [ # ['ruby-ldap', '= 0.9.9'], + # ['net-ldap', '= 0.1.1'], ['activerecord', '= 2.3.5'], ['locale', '= 2.0.5'], ['gettext', '= 2.1.0'], From codesite-noreply at google.com Sun Mar 21 07:33:58 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 21 Mar 2010 11:33:58 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1132 committed - * fix LDAP error class case conversion:... Message-ID: <0016e68dec19d13d6c04824df405@google.com> Revision: 1132 Author: koutou Date: Sun Mar 21 04:33:41 2010 Log: * fix LDAP error class case conversion: * SizelimitExceed -> SizeLimitExceed * TimelimitExceed -> TimeLimitExceed * AdminlimitExceed -> AdminLimitExceed http://code.google.com/p/ruby-activeldap/source/detail?r=1132 Modified: /trunk/lib/active_ldap/ldap_error.rb ======================================= --- /trunk/lib/active_ldap/ldap_error.rb Sun May 6 23:18:41 2007 +++ /trunk/lib/active_ldap/ldap_error.rb Sun Mar 21 04:33:41 2010 @@ -20,8 +20,8 @@ 0x00 => "SUCCESS", 0x01 => "OPERATIONS_ERROR", 0x02 => "PROTOCOL_ERROR", - 0x03 => "TIMELIMIT_EXCEEDED", - 0x04 => "SIZELIMIT_EXCEEDED", + 0x03 => "TIME_LIMIT_EXCEEDED", + 0x04 => "SIZE_LIMIT_EXCEEDED", 0x05 => "COMPARE_FALSE", 0x06 => "COMPARE_TRUE", 0x07 => "AUTH_METHOD_NOT_SUPPORTED", @@ -29,7 +29,7 @@ 0x09 => "PARTIAL_RESULTS", # LDAPv2+ (not LDAPv3) 0x0a => "REFERRAL", - 0x0b => "ADMINLIMIT_EXCEEDED", + 0x0b => "ADMIN_LIMIT_EXCEEDED", 0x0c => "UNAVAILABLE_CRITICAL_EXTENSION", 0x0d => "CONFIDENTIALITY_REQUIRED", 0x0e => "LDAP_SASL_BIND_IN_PROGRESS", From codesite-noreply at google.com Sun Mar 21 07:38:59 2010 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 21 Mar 2010 11:38:59 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1133 committed - * fix LDAP server reconnection is broken.... Message-ID: <0016368e1b0dc1564b04824e066c@google.com> Revision: 1133 Author: koutou Date: Sun Mar 21 04:38:18 2010 Log: * fix LDAP server reconnection is broken. Reported by syrius.ml at no-log.org. Thanks!!! http://code.google.com/p/ruby-activeldap/source/detail?r=1133 Modified: /trunk/README /trunk/lib/active_ldap/adapter/base.rb /trunk/lib/active_ldap/adapter/ldap.rb /trunk/lib/active_ldap/adapter/ldap_ext.rb /trunk/lib/active_ldap/adapter/net_ldap.rb ======================================= --- /trunk/README Tue Jan 26 05:15:11 2010 +++ /trunk/README Sun Mar 21 04:38:18 2010 @@ -141,3 +141,4 @@ * brad at lucky-dip.net: A bug report. * Hideyuki Yasuda: Bug reports. * zachwily: A bug report. +* syrius.ml at no-log.org: A bug report. ======================================= --- /trunk/lib/active_ldap/adapter/base.rb Mon Sep 21 17:54:49 2009 +++ /trunk/lib/active_ldap/adapter/base.rb Sun Mar 21 04:38:18 2010 @@ -169,7 +169,7 @@ operation(options) do yield(base, scope, filter, attrs, limit, callback) end - rescue LdapError + rescue LdapError::NoSuchObject, LdapError::InvalidDnSyntax # Do nothing on failure @logger.info do args = [$!.class, $!.message, filter, attrs.inspect] @@ -274,7 +274,7 @@ with_timeout(try_reconnect, options) do yield end - rescue Errno::EPIPE, ConnectionError + rescue ConnectionError if try_reconnect and !retried retried = true @disconnected = true ======================================= --- /trunk/lib/active_ldap/adapter/ldap.rb Fri Mar 5 22:23:18 2010 +++ /trunk/lib/active_ldap/adapter/ldap.rb Sun Mar 21 04:38:18 2010 @@ -95,11 +95,6 @@ callback.call([entry.dn, attributes], block) end rescue RuntimeError - begin - @connection.assert_error_code - rescue LDAP::ServerDown - raise ConnectionError, $!.message - end if $!.message == "no result returned by search" @logger.debug do args = [filter, attrs.inspect] ======================================= --- /trunk/lib/active_ldap/adapter/ldap_ext.rb Fri Mar 5 22:23:18 2010 +++ /trunk/lib/active_ldap/adapter/ldap_ext.rb Sun Mar 21 04:38:18 2010 @@ -92,13 +92,14 @@ def assert_error_code return unless failed? code = error_code + message = error_message klass = ActiveLdap::LdapError::ERRORS[code] klass ||= IMPLEMENT_SPECIFIC_ERRORS[code] - if klass.nil? and error_message == "Can't contact LDAP server" - klass = LDAP::ServerDown + if klass.nil? and message == "Can't contact LDAP server" + klass = ActiveLdap::ConnectionError end klass ||= ActiveLdap::LdapError - raise klass, LDAP.err2string(code) + raise klass, message end end end ======================================= --- /trunk/lib/active_ldap/adapter/net_ldap.rb Fri Mar 5 22:27:23 2010 +++ /trunk/lib/active_ldap/adapter/net_ldap.rb Sun Mar 21 04:38:18 2010 @@ -138,7 +138,13 @@ private def execute(method, info=nil, *args, &block) name = (info || {}).delete(:name) || method - result = log(name, info) {@connection.send(method, *args, &block)} + result = log(name, info) do + begin + @connection.send(method, *args, &block) + rescue Errno::EPIPE + raise ConnectionError, "#{$!.class}: #{$!.message}" + end + end message = nil if result.is_a?(Hash) message = result[:errorMessage] @@ -147,6 +153,7 @@ unless result.zero? klass = LdapError::ERRORS[result] klass ||= LdapError + return if klass == LdapError::SizeLimitExceeded message = [Net::LDAP.result2string(result), message].compact.join(": ") raise klass, message end