From 8a106ca64f34ac51e4d4749a3d61881c7eaffd85 Mon Sep 17 00:00:00 2001 From: Oleg Barenboim Date: Wed, 28 Dec 2011 15:29:40 -0500 Subject: [PATCH] Added Continuation Reference Processing as defined in section 4.5.3 of RFC 2251 (http://www.ietf.org/rfc/rfc2251.txt) --- lib/net/ldap.rb | 8 ++++++++ lib/net/ldap/pdu.rb | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/net/ldap.rb b/lib/net/ldap.rb index 449e3ef..96e6bf5 100644 --- a/lib/net/ldap.rb +++ b/lib/net/ldap.rb @@ -317,6 +317,7 @@ class Net::LDAP 2 => "Protocol Error", 3 => "Time Limit Exceeded", 4 => "Size Limit Exceeded", + 10 => "Referral", 12 => "Unavailable crtical extension", 14 => "saslBindInProgress", 16 => "No Such Attribute", @@ -1418,6 +1419,13 @@ class Net::LDAP::Connection #:nodoc: when 5 # search-result result_code = pdu.result_code controls = pdu.result_controls + if return_referrals && result_code == 10 + if block_given? + se = Net::LDAP::Entry.new + se[:search_referrals] = (pdu.search_referrals || []) + yield se + end + end break else raise Net::LDAP::LdapError, "invalid response-type in search: #{pdu.app_tag}" diff --git a/lib/net/ldap/pdu.rb b/lib/net/ldap/pdu.rb index bdde92c..3bd1f48 100644 --- a/lib/net/ldap/pdu.rb +++ b/lib/net/ldap/pdu.rb @@ -136,6 +136,7 @@ class Net::LDAP::PDU :matchedDN => sequence[1], :errorMessage => sequence[2] } + parse_search_referral(sequence[3]) if @ldap_result[:resultCode] == 10 end private :parse_ldap_result