net-ldap 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of net-ldap might be problematic. Click here for more details.
- data/History.rdoc +10 -0
- data/Rakefile +1 -1
- data/lib/net/ber.rb +3 -1
- data/lib/net/ber/core_ext/string.rb +13 -1
- data/lib/net/ldap.rb +26 -11
- data/lib/net/ldap/dataset.rb +2 -2
- data/lib/net/ldap/pdu.rb +1 -0
- data/lib/net/snmp.rb +1 -1
- data/net-ldap.gemspec +4 -3
- data/spec/unit/ber/ber_spec.rb +16 -1
- data/test/test_filter.rb +71 -71
- data/test/test_ldif.rb +14 -2
- metadata +106 -130
data/History.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== Net::LDAP 0.3.0 / 2012-02-14
|
2
|
+
* Major changes:
|
3
|
+
* Now uses UTF-8 strings instead of ASCII-8 per the LDAP RFC
|
4
|
+
Major Enhancements:
|
5
|
+
* Adding continuation reference processing
|
6
|
+
* Bug Fixes:
|
7
|
+
* Fixes usupported object type #139
|
8
|
+
* Fixes Net::LDAP namespace errors
|
9
|
+
* Return nil instead of an empty array if the search fails
|
10
|
+
|
1
11
|
=== Net::LDAP 0.2.2 / 2011-03-26
|
2
12
|
* Bug Fixes:
|
3
13
|
* Fixed the call to Net::LDAP.modify_ops from Net::LDAP#modify.
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ Hoe.spec 'net-ldap' do |spec|
|
|
20
20
|
spec.remote_rdoc_dir = ''
|
21
21
|
spec.rsync_args << ' --exclude=statsvn/'
|
22
22
|
|
23
|
-
spec.url = %W(http://
|
23
|
+
spec.url = %W(http://rubyldap.com/ https://github.com/ruby-ldap/ruby-net-ldap)
|
24
24
|
|
25
25
|
spec.history_file = 'History.rdoc'
|
26
26
|
spec.readme_file = 'README.rdoc'
|
data/lib/net/ber.rb
CHANGED
@@ -106,7 +106,7 @@ module Net # :nodoc:
|
|
106
106
|
# <tr><th>BMPString</th><th>C</th><td>30: 62 (0x3e, 0b00111110)</td></tr>
|
107
107
|
# </table>
|
108
108
|
module BER
|
109
|
-
VERSION = '0.
|
109
|
+
VERSION = '0.3.0'
|
110
110
|
|
111
111
|
##
|
112
112
|
# Used for BER-encoding the length and content bytes of a Fixnum integer
|
@@ -295,6 +295,8 @@ class Net::BER::BerIdentifiedString < String
|
|
295
295
|
attr_accessor :ber_identifier
|
296
296
|
def initialize args
|
297
297
|
super args
|
298
|
+
# LDAP uses UTF-8 encoded strings
|
299
|
+
force_encoding('UTF-8') if respond_to?(:encoding)
|
298
300
|
end
|
299
301
|
end
|
300
302
|
|
@@ -12,9 +12,21 @@ module Net::BER::Extensions::String
|
|
12
12
|
# User code should call either #to_ber_application_string or
|
13
13
|
# #to_ber_contextspecific.
|
14
14
|
def to_ber(code = 0x04)
|
15
|
-
|
15
|
+
raw_string = raw_utf8_encoded
|
16
|
+
[code].pack('C') + raw_string.length.to_ber_length_encoding + raw_string
|
16
17
|
end
|
17
18
|
|
19
|
+
def raw_utf8_encoded
|
20
|
+
if self.respond_to?(:encode)
|
21
|
+
# Strings should be UTF-8 encoded according to LDAP.
|
22
|
+
# However, the BER code is not necessarily valid UTF-8
|
23
|
+
self.encode('UTF-8').force_encoding('ASCII-8BIT')
|
24
|
+
else
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
private :raw_utf8_encoded
|
29
|
+
|
18
30
|
##
|
19
31
|
# Creates an application-specific BER string encoded value with the
|
20
32
|
# provided syntax code value.
|
data/lib/net/ldap.rb
CHANGED
@@ -241,7 +241,7 @@ require 'net/ldap/entry'
|
|
241
241
|
# and then keeps it open while it executes a user-supplied block.
|
242
242
|
# Net::LDAP#open closes the connection on completion of the block.
|
243
243
|
class Net::LDAP
|
244
|
-
VERSION = "0.
|
244
|
+
VERSION = "0.3.0"
|
245
245
|
|
246
246
|
class LdapError < StandardError; end
|
247
247
|
|
@@ -317,6 +317,7 @@ class Net::LDAP
|
|
317
317
|
2 => "Protocol Error",
|
318
318
|
3 => "Time Limit Exceeded",
|
319
319
|
4 => "Size Limit Exceeded",
|
320
|
+
10 => "Referral",
|
320
321
|
12 => "Unavailable crtical extension",
|
321
322
|
14 => "saslBindInProgress",
|
322
323
|
16 => "No Such Attribute",
|
@@ -619,7 +620,8 @@ class Net::LDAP
|
|
619
620
|
end
|
620
621
|
|
621
622
|
args[:base] ||= @base
|
622
|
-
|
623
|
+
return_result_set = args[:return_result] != false
|
624
|
+
result_set = return_result_set ? [] : nil
|
623
625
|
|
624
626
|
if @open_connection
|
625
627
|
@result = @open_connection.search(args) { |entry|
|
@@ -642,7 +644,11 @@ class Net::LDAP
|
|
642
644
|
end
|
643
645
|
end
|
644
646
|
|
645
|
-
|
647
|
+
if return_result_set
|
648
|
+
@result == 0 ? result_set : nil
|
649
|
+
else
|
650
|
+
@result == 0
|
651
|
+
end
|
646
652
|
end
|
647
653
|
|
648
654
|
# #bind connects to an LDAP server and requests authentication based on
|
@@ -1320,7 +1326,7 @@ class Net::LDAP::Connection #:nodoc:
|
|
1320
1326
|
# in the protocol.
|
1321
1327
|
#++
|
1322
1328
|
def search(args = {})
|
1323
|
-
search_filter = (args && args[:filter]) ||
|
1329
|
+
search_filter = (args && args[:filter]) ||
|
1324
1330
|
Net::LDAP::Filter.eq("objectclass", "*")
|
1325
1331
|
search_filter = Net::LDAP::Filter.construct(search_filter) if search_filter.is_a?(String)
|
1326
1332
|
search_base = (args && args[:base]) || "dc=example, dc=com"
|
@@ -1389,9 +1395,9 @@ class Net::LDAP::Connection #:nodoc:
|
|
1389
1395
|
false.to_ber,
|
1390
1396
|
rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber
|
1391
1397
|
].to_ber_sequence if paged_searches_supported
|
1392
|
-
controls = controls.to_ber_contextspecific(0)
|
1398
|
+
controls = controls.empty? ? nil : controls.to_ber_contextspecific(0)
|
1393
1399
|
|
1394
|
-
pkt = [next_msgid.to_ber, request, controls].to_ber_sequence
|
1400
|
+
pkt = [next_msgid.to_ber, request, controls].compact.to_ber_sequence
|
1395
1401
|
@conn.write pkt
|
1396
1402
|
|
1397
1403
|
result_code = 0
|
@@ -1413,6 +1419,13 @@ class Net::LDAP::Connection #:nodoc:
|
|
1413
1419
|
when 5 # search-result
|
1414
1420
|
result_code = pdu.result_code
|
1415
1421
|
controls = pdu.result_controls
|
1422
|
+
if return_referrals && result_code == 10
|
1423
|
+
if block_given?
|
1424
|
+
se = Net::LDAP::Entry.new
|
1425
|
+
se[:search_referrals] = (pdu.search_referrals || [])
|
1426
|
+
yield se
|
1427
|
+
end
|
1428
|
+
end
|
1416
1429
|
break
|
1417
1430
|
else
|
1418
1431
|
raise Net::LDAP::LdapError, "invalid response-type in search: #{pdu.app_tag}"
|
@@ -1521,15 +1534,17 @@ class Net::LDAP::Connection #:nodoc:
|
|
1521
1534
|
old_dn = args[:olddn] or raise "Unable to rename empty DN"
|
1522
1535
|
new_rdn = args[:newrdn] or raise "Unable to rename to empty RDN"
|
1523
1536
|
delete_attrs = args[:delete_attributes] ? true : false
|
1524
|
-
|
1537
|
+
new_superior = args[:new_superior]
|
1538
|
+
|
1539
|
+
request = [old_dn.to_ber, new_rdn.to_ber, delete_attrs.to_ber]
|
1540
|
+
request << new_superior.to_ber unless new_superior == nil
|
1525
1541
|
|
1526
|
-
request = [old_dn.to_ber, new_rdn.to_ber, delete_attrs.to_ber]
|
1527
|
-
request << new_superior.to_ber unless new_superior == nil
|
1528
|
-
|
1529
1542
|
pkt = [next_msgid.to_ber, request.to_ber_appsequence(12)].to_ber_sequence
|
1530
1543
|
@conn.write pkt
|
1531
1544
|
|
1532
|
-
(be = @conn.read_ber(AsnSyntax)) &&
|
1545
|
+
(be = @conn.read_ber(Net::LDAP::AsnSyntax)) &&
|
1546
|
+
(pdu = Net::LDAP::PDU.new( be )) && (pdu.app_tag == 13) or
|
1547
|
+
raise Net::LDAP::LdapError.new( "response missing or invalid" )
|
1533
1548
|
pdu.result_code
|
1534
1549
|
end
|
1535
1550
|
|
data/lib/net/ldap/dataset.rb
CHANGED
data/lib/net/ldap/pdu.rb
CHANGED
data/lib/net/snmp.rb
CHANGED
data/net-ldap.gemspec
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift './lib'
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = %q{net-ldap}
|
5
|
-
s.version =
|
6
|
+
s.version = Net::LDAP::VERSION
|
6
7
|
|
7
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
9
|
s.authors = ["Francis Cianfrocca", "Emiel van de Laar", "Rory O'Connell", "Kaspar Schiess", "Austin Ziegler"]
|
@@ -20,8 +21,8 @@ Our roadmap for Net::LDAP 1.0 is to gain full <em>client</em> compliance with
|
|
20
21
|
the most recent LDAP RFCs (4510–4519, plutions of 4520–4532).}
|
21
22
|
s.email = ["blackhedd@rubyforge.org", "gemiel@gmail.com", "rory.ocon@gmail.com", "kaspar.schiess@absurd.li", "austin@rubyforge.org"]
|
22
23
|
s.extra_rdoc_files = ["Manifest.txt", "Contributors.rdoc", "Hacking.rdoc", "History.rdoc", "License.rdoc", "README.rdoc"]
|
23
|
-
s.files = [".autotest", ".rspec", "Contributors.rdoc", "Hacking.rdoc", "History.rdoc", "License.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "autotest/discover.rb", "lib/net-ldap.rb", "lib/net/ber.rb", "lib/net/ber/ber_parser.rb", "lib/net/ber/core_ext.rb", "lib/net/ber/core_ext/array.rb", "lib/net/ber/core_ext/bignum.rb", "lib/net/ber/core_ext/false_class.rb", "lib/net/ber/core_ext/fixnum.rb", "lib/net/ber/core_ext/string.rb", "lib/net/ber/core_ext/true_class.rb", "lib/net/ldap.rb", "lib/net/ldap/dataset.rb", "lib/net/ldap/dn.rb", "lib/net/ldap/entry.rb", "lib/net/ldap/filter.rb", "lib/net/ldap/password.rb", "lib/net/ldap/pdu.rb", "lib/net/snmp.rb", "net-ldap.gemspec", "spec/integration/ssl_ber_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/unit/ber/ber_spec.rb", "spec/unit/ber/core_ext/string_spec.rb", "spec/unit/ldap/dn_spec.rb", "spec/unit/ldap/entry_spec.rb", "spec/unit/ldap/filter_spec.rb", "spec/unit/ldap_spec.rb", "test/common.rb", "test/test_entry.rb", "test/test_filter.rb", "test/test_ldap_connection.rb", "test/test_ldif.rb", "test/test_password.rb", "test/test_rename.rb", "test/test_snmp.rb", "test/testdata.ldif", "testserver/ldapserver.rb", "testserver/testdata.ldif"
|
24
|
-
s.homepage = %q{http://
|
24
|
+
s.files = [".autotest", ".rspec", "Contributors.rdoc", "Hacking.rdoc", "History.rdoc", "License.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "autotest/discover.rb", "lib/net-ldap.rb", "lib/net/ber.rb", "lib/net/ber/ber_parser.rb", "lib/net/ber/core_ext.rb", "lib/net/ber/core_ext/array.rb", "lib/net/ber/core_ext/bignum.rb", "lib/net/ber/core_ext/false_class.rb", "lib/net/ber/core_ext/fixnum.rb", "lib/net/ber/core_ext/string.rb", "lib/net/ber/core_ext/true_class.rb", "lib/net/ldap.rb", "lib/net/ldap/dataset.rb", "lib/net/ldap/dn.rb", "lib/net/ldap/entry.rb", "lib/net/ldap/filter.rb", "lib/net/ldap/password.rb", "lib/net/ldap/pdu.rb", "lib/net/snmp.rb", "net-ldap.gemspec", "spec/integration/ssl_ber_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/unit/ber/ber_spec.rb", "spec/unit/ber/core_ext/string_spec.rb", "spec/unit/ldap/dn_spec.rb", "spec/unit/ldap/entry_spec.rb", "spec/unit/ldap/filter_spec.rb", "spec/unit/ldap_spec.rb", "test/common.rb", "test/test_entry.rb", "test/test_filter.rb", "test/test_ldap_connection.rb", "test/test_ldif.rb", "test/test_password.rb", "test/test_rename.rb", "test/test_snmp.rb", "test/testdata.ldif", "testserver/ldapserver.rb", "testserver/testdata.ldif"]
|
25
|
+
s.homepage = %q{http://github.com.org/ruby-ldap/ruby-net-ldap}
|
25
26
|
s.rdoc_options = ["--main", "README.rdoc"]
|
26
27
|
s.require_paths = ["lib"]
|
27
28
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
data/spec/unit/ber/ber_spec.rb
CHANGED
@@ -75,6 +75,21 @@ describe "BER encoding of" do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
|
+
if "Ruby 1.9".respond_to?(:encoding)
|
79
|
+
context "strings" do
|
80
|
+
it "should properly encode UTF-8 strings" do
|
81
|
+
"\u00e5".force_encoding("UTF-8").to_ber.should ==
|
82
|
+
"\x04\x02\xC3\xA5"
|
83
|
+
end
|
84
|
+
it "should properly encode strings encodable as UTF-8" do
|
85
|
+
"teststring".encode("US-ASCII").to_ber.should == "\x04\nteststring"
|
86
|
+
end
|
87
|
+
it "should fail on strings that can not be converted to UTF-8" do
|
88
|
+
error = Encoding::UndefinedConversionError
|
89
|
+
lambda {"\x81".to_ber }.should raise_exception(error)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
78
93
|
end
|
79
94
|
|
80
95
|
describe "BER decoding of" do
|
@@ -91,4 +106,4 @@ describe "BER decoding of" do
|
|
91
106
|
[1, [3, "Administrator", "ad_is_bogus"]]
|
92
107
|
end
|
93
108
|
end
|
94
|
-
end
|
109
|
+
end
|
data/test/test_filter.rb
CHANGED
@@ -31,92 +31,92 @@ class TestFilter < Test::Unit::TestCase
|
|
31
31
|
assert_equal("(uid=*\\5C*)", Filter.contains("uid", "\\").to_s)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
def test_c2
|
35
35
|
assert_equal("(uid=george *)",
|
36
36
|
Filter.from_rfc2254("uid=george *").to_rfc2254)
|
37
37
|
assert_equal("(uid:=george *)",
|
38
38
|
Filter.from_rfc2254("uid:=george *").to_rfc2254)
|
39
39
|
assert_equal("(uid=george*)",
|
40
40
|
Filter.from_rfc2254(" ( uid = george* ) ").to_rfc2254)
|
41
|
-
|
41
|
+
assert_equal("(!(uid=george*))",
|
42
42
|
Filter.from_rfc2254("uid!=george*").to_rfc2254)
|
43
|
-
|
43
|
+
assert_equal("(uid<=george*)",
|
44
44
|
Filter.from_rfc2254("uid <= george*").to_rfc2254)
|
45
|
-
|
45
|
+
assert_equal("(uid>=george*)",
|
46
46
|
Filter.from_rfc2254("uid>=george*").to_rfc2254)
|
47
|
-
|
47
|
+
assert_equal("(&(uid=george*)(mail=*))",
|
48
48
|
Filter.from_rfc2254("(& (uid=george* ) (mail=*))").to_rfc2254)
|
49
|
-
|
49
|
+
assert_equal("(|(uid=george*)(mail=*))",
|
50
50
|
Filter.from_rfc2254("(| (uid=george* ) (mail=*))").to_rfc2254)
|
51
|
-
|
51
|
+
assert_equal("(!(mail=*))",
|
52
52
|
Filter.from_rfc2254("(! (mail=*))").to_rfc2254)
|
53
|
-
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
def test_filter_with_single_clause
|
56
|
+
assert_equal("(cn=name)", Net::LDAP::Filter.construct("(&(cn=name))").to_s)
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
def test_filters_from_ber
|
60
|
+
[
|
61
|
+
Net::LDAP::Filter.eq("objectclass", "*"),
|
62
|
+
Net::LDAP::Filter.pres("objectclass"),
|
63
|
+
Net::LDAP::Filter.eq("objectclass", "ou"),
|
64
|
+
Net::LDAP::Filter.ge("uid", "500"),
|
65
|
+
Net::LDAP::Filter.le("uid", "500"),
|
66
|
+
(~ Net::LDAP::Filter.pres("objectclass")),
|
67
|
+
(Net::LDAP::Filter.pres("objectclass") & Net::LDAP::Filter.pres("ou")),
|
68
|
+
(Net::LDAP::Filter.pres("objectclass") & Net::LDAP::Filter.pres("ou") & Net::LDAP::Filter.pres("sn")),
|
69
|
+
(Net::LDAP::Filter.pres("objectclass") | Net::LDAP::Filter.pres("ou") | Net::LDAP::Filter.pres("sn")),
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
71
|
+
Net::LDAP::Filter.eq("objectclass", "*aaa"),
|
72
|
+
Net::LDAP::Filter.eq("objectclass", "*aaa*bbb"),
|
73
|
+
Net::LDAP::Filter.eq("objectclass", "*aaa*bbb*ccc"),
|
74
|
+
Net::LDAP::Filter.eq("objectclass", "aaa*bbb"),
|
75
|
+
Net::LDAP::Filter.eq("objectclass", "aaa*bbb*ccc"),
|
76
|
+
Net::LDAP::Filter.eq("objectclass", "abc*def*1111*22*g"),
|
77
|
+
Net::LDAP::Filter.eq("objectclass", "*aaa*"),
|
78
|
+
Net::LDAP::Filter.eq("objectclass", "*aaa*bbb*"),
|
79
|
+
Net::LDAP::Filter.eq("objectclass", "*aaa*bbb*ccc*"),
|
80
|
+
Net::LDAP::Filter.eq("objectclass", "aaa*"),
|
81
|
+
Net::LDAP::Filter.eq("objectclass", "aaa*bbb*"),
|
82
|
+
Net::LDAP::Filter.eq("objectclass", "aaa*bbb*ccc*"),
|
83
|
+
].each do |ber|
|
84
|
+
f = Net::LDAP::Filter.parse_ber(ber.to_ber.read_ber(Net::LDAP::AsnSyntax))
|
85
|
+
assert(f == ber)
|
86
|
+
assert_equal(f.to_ber, ber.to_ber)
|
87
|
+
end
|
88
|
+
end
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
90
|
+
def test_ber_from_rfc2254_filter
|
91
|
+
[
|
92
|
+
Net::LDAP::Filter.construct("objectclass=*"),
|
93
|
+
Net::LDAP::Filter.construct("objectclass=ou"),
|
94
|
+
Net::LDAP::Filter.construct("uid >= 500"),
|
95
|
+
Net::LDAP::Filter.construct("uid <= 500"),
|
96
|
+
Net::LDAP::Filter.construct("(!(uid=*))"),
|
97
|
+
Net::LDAP::Filter.construct("(&(uid=*)(objectclass=*))"),
|
98
|
+
Net::LDAP::Filter.construct("(&(uid=*)(objectclass=*)(sn=*))"),
|
99
|
+
Net::LDAP::Filter.construct("(|(uid=*)(objectclass=*))"),
|
100
|
+
Net::LDAP::Filter.construct("(|(uid=*)(objectclass=*)(sn=*))"),
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
102
|
+
Net::LDAP::Filter.construct("objectclass=*aaa"),
|
103
|
+
Net::LDAP::Filter.construct("objectclass=*aaa*bbb"),
|
104
|
+
Net::LDAP::Filter.construct("objectclass=*aaa bbb"),
|
105
|
+
Net::LDAP::Filter.construct("objectclass=*aaa bbb"),
|
106
|
+
Net::LDAP::Filter.construct("objectclass=*aaa*bbb*ccc"),
|
107
|
+
Net::LDAP::Filter.construct("objectclass=aaa*bbb"),
|
108
|
+
Net::LDAP::Filter.construct("objectclass=aaa*bbb*ccc"),
|
109
|
+
Net::LDAP::Filter.construct("objectclass=abc*def*1111*22*g"),
|
110
|
+
Net::LDAP::Filter.construct("objectclass=*aaa*"),
|
111
|
+
Net::LDAP::Filter.construct("objectclass=*aaa*bbb*"),
|
112
|
+
Net::LDAP::Filter.construct("objectclass=*aaa*bbb*ccc*"),
|
113
|
+
Net::LDAP::Filter.construct("objectclass=aaa*"),
|
114
|
+
Net::LDAP::Filter.construct("objectclass=aaa*bbb*"),
|
115
|
+
Net::LDAP::Filter.construct("objectclass=aaa*bbb*ccc*"),
|
116
|
+
].each do |ber|
|
117
|
+
f = Net::LDAP::Filter.parse_ber(ber.to_ber.read_ber(Net::LDAP::AsnSyntax))
|
118
|
+
assert(f == ber)
|
119
|
+
assert_equal(f.to_ber, ber.to_ber)
|
120
|
+
end
|
121
|
+
end
|
122
122
|
end
|
data/test/test_ldif.rb
CHANGED
@@ -31,8 +31,20 @@ class TestLdif < Test::Unit::TestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_ldif_with_continuation_lines
|
34
|
-
ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n
|
35
|
-
assert_equal(true, ds.has_key?("
|
34
|
+
ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hijklmn\r\n\r\n"))
|
35
|
+
assert_equal(true, ds.has_key?("abcdefghijklmn"))
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_ldif_with_continuation_lines_and_extra_whitespace
|
39
|
+
ds1 = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hijklmn\r\n\r\n"))
|
40
|
+
assert_equal(true, ds1.has_key?("abcdefg hijklmn"))
|
41
|
+
ds2 = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: abcdefg\r\n hij klmn\r\n\r\n"))
|
42
|
+
assert_equal(true, ds2.has_key?("abcdefghij klmn"))
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_ldif_tab_is_not_continuation
|
46
|
+
ds = Net::LDAP::Dataset::read_ldif(StringIO.new("dn: key\r\n\tnotcontinued\r\n\r\n"))
|
47
|
+
assert_equal(true, ds.has_key?("key"))
|
36
48
|
end
|
37
49
|
|
38
50
|
# TODO, INADEQUATE. We need some more tests
|
metadata
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ldap
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 2
|
10
|
-
version: 0.2.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Francis Cianfrocca
|
14
9
|
- Emiel van de Laar
|
15
10
|
- Rory O'Connell
|
@@ -18,143 +13,133 @@ authors:
|
|
18
13
|
autorequire:
|
19
14
|
bindir: bin
|
20
15
|
cert_chain: []
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
dependencies:
|
25
|
-
- !ruby/object:Gem::Dependency
|
16
|
+
date: 2012-02-15 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
26
19
|
name: rubyforge
|
27
|
-
|
28
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
requirement: &70157176040280 !ruby/object:Gem::Requirement
|
29
21
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
hash: 7
|
34
|
-
segments:
|
35
|
-
- 2
|
36
|
-
- 0
|
37
|
-
- 4
|
22
|
+
requirements:
|
23
|
+
- - ! '>='
|
24
|
+
- !ruby/object:Gem::Version
|
38
25
|
version: 2.0.4
|
39
26
|
type: :development
|
40
|
-
version_requirements: *id001
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: hoe-git
|
43
27
|
prerelease: false
|
44
|
-
|
28
|
+
version_requirements: *70157176040280
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: hoe-git
|
31
|
+
requirement: &70157176059420 !ruby/object:Gem::Requirement
|
45
32
|
none: false
|
46
|
-
requirements:
|
33
|
+
requirements:
|
47
34
|
- - ~>
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
50
|
-
segments:
|
51
|
-
- 1
|
52
|
-
version: "1"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '1'
|
53
37
|
type: :development
|
54
|
-
version_requirements: *id002
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: hoe-gemspec
|
57
38
|
prerelease: false
|
58
|
-
|
39
|
+
version_requirements: *70157176059420
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: hoe-gemspec
|
42
|
+
requirement: &70157176053340 !ruby/object:Gem::Requirement
|
59
43
|
none: false
|
60
|
-
requirements:
|
44
|
+
requirements:
|
61
45
|
- - ~>
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 1
|
66
|
-
version: "1"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1'
|
67
48
|
type: :development
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: metaid
|
71
49
|
prerelease: false
|
72
|
-
|
50
|
+
version_requirements: *70157176053340
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: metaid
|
53
|
+
requirement: &70157176052240 !ruby/object:Gem::Requirement
|
73
54
|
none: false
|
74
|
-
requirements:
|
55
|
+
requirements:
|
75
56
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
segments:
|
79
|
-
- 1
|
80
|
-
version: "1"
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '1'
|
81
59
|
type: :development
|
82
|
-
version_requirements: *id004
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: flexmock
|
85
60
|
prerelease: false
|
86
|
-
|
61
|
+
version_requirements: *70157176052240
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: flexmock
|
64
|
+
requirement: &70157176069980 !ruby/object:Gem::Requirement
|
87
65
|
none: false
|
88
|
-
requirements:
|
66
|
+
requirements:
|
89
67
|
- - ~>
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
hash: 59
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
- 9
|
95
|
-
- 0
|
68
|
+
- !ruby/object:Gem::Version
|
96
69
|
version: 0.9.0
|
97
70
|
type: :development
|
98
|
-
|
99
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: *70157176069980
|
73
|
+
- !ruby/object:Gem::Dependency
|
100
74
|
name: rspec
|
75
|
+
requirement: &70157176078680 !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ~>
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2.0'
|
81
|
+
type: :development
|
101
82
|
prerelease: false
|
102
|
-
|
83
|
+
version_requirements: *70157176078680
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rdoc
|
86
|
+
requirement: &70157176091860 !ruby/object:Gem::Requirement
|
103
87
|
none: false
|
104
|
-
requirements:
|
88
|
+
requirements:
|
105
89
|
- - ~>
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
segments:
|
109
|
-
- 2
|
110
|
-
- 0
|
111
|
-
version: "2.0"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '3.10'
|
112
92
|
type: :development
|
113
|
-
version_requirements: *id006
|
114
|
-
- !ruby/object:Gem::Dependency
|
115
|
-
name: hoe
|
116
93
|
prerelease: false
|
117
|
-
|
94
|
+
version_requirements: *70157176091860
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: hoe
|
97
|
+
requirement: &70157176087000 !ruby/object:Gem::Requirement
|
118
98
|
none: false
|
119
|
-
requirements:
|
120
|
-
- -
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
|
123
|
-
segments:
|
124
|
-
- 2
|
125
|
-
- 9
|
126
|
-
- 1
|
127
|
-
version: 2.9.1
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.13'
|
128
103
|
type: :development
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: *70157176087000
|
106
|
+
description: ! 'Net::LDAP for Ruby (also called net-ldap) implements client access
|
107
|
+
for the
|
108
|
+
|
109
|
+
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for
|
110
|
+
|
111
|
+
accessing distributed directory services. Net::LDAP is written completely in
|
112
|
+
|
113
|
+
Ruby with no external dependencies. It supports most LDAP client features and a
|
114
|
+
|
115
|
+
subset of server features as well.
|
116
|
+
|
117
|
+
|
118
|
+
Net::LDAP has been tested against modern popular LDAP servers including
|
119
|
+
|
120
|
+
OpenLDAP and Active Directory. The current release is mostly compliant with
|
121
|
+
|
122
|
+
earlier versions of the IETF LDAP RFCs (2251–2256, 2829–2830, 3377, and 3771).
|
123
|
+
|
124
|
+
Our roadmap for Net::LDAP 1.0 is to gain full <em>client</em> compliance with
|
125
|
+
|
126
|
+
the most recent LDAP RFCs (4510–4519, plus portions of 4520–4532).'
|
127
|
+
email:
|
141
128
|
- blackhedd@rubyforge.org
|
142
129
|
- gemiel@gmail.com
|
143
130
|
- rory.ocon@gmail.com
|
144
131
|
- kaspar.schiess@absurd.li
|
145
132
|
- austin@rubyforge.org
|
146
133
|
executables: []
|
147
|
-
|
148
134
|
extensions: []
|
149
|
-
|
150
|
-
extra_rdoc_files:
|
135
|
+
extra_rdoc_files:
|
151
136
|
- Manifest.txt
|
152
137
|
- Contributors.rdoc
|
153
138
|
- Hacking.rdoc
|
154
139
|
- History.rdoc
|
155
140
|
- License.rdoc
|
156
141
|
- README.rdoc
|
157
|
-
files:
|
142
|
+
files:
|
158
143
|
- .autotest
|
159
144
|
- .rspec
|
160
145
|
- Contributors.rdoc
|
@@ -205,44 +190,35 @@ files:
|
|
205
190
|
- testserver/ldapserver.rb
|
206
191
|
- testserver/testdata.ldif
|
207
192
|
- .gemtest
|
208
|
-
|
209
|
-
homepage: http://net-ldap.rubyforge.org/
|
193
|
+
homepage: http://rubyldap.com/
|
210
194
|
licenses: []
|
211
|
-
|
212
195
|
post_install_message:
|
213
|
-
rdoc_options:
|
196
|
+
rdoc_options:
|
214
197
|
- --main
|
215
198
|
- README.rdoc
|
216
|
-
require_paths:
|
199
|
+
require_paths:
|
217
200
|
- lib
|
218
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
219
202
|
none: false
|
220
|
-
requirements:
|
221
|
-
- -
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
hash: 57
|
224
|
-
segments:
|
225
|
-
- 1
|
226
|
-
- 8
|
227
|
-
- 7
|
203
|
+
requirements:
|
204
|
+
- - ! '>='
|
205
|
+
- !ruby/object:Gem::Version
|
228
206
|
version: 1.8.7
|
229
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
208
|
none: false
|
231
|
-
requirements:
|
232
|
-
- -
|
233
|
-
- !ruby/object:Gem::Version
|
234
|
-
|
235
|
-
segments:
|
236
|
-
- 0
|
237
|
-
version: "0"
|
209
|
+
requirements:
|
210
|
+
- - ! '>='
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
238
213
|
requirements: []
|
239
|
-
|
240
214
|
rubyforge_project: net-ldap
|
241
|
-
rubygems_version: 1.
|
215
|
+
rubygems_version: 1.8.10
|
242
216
|
signing_key:
|
243
217
|
specification_version: 3
|
244
|
-
summary: Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
245
|
-
|
218
|
+
summary: Net::LDAP for Ruby (also called net-ldap) implements client access for the
|
219
|
+
Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing
|
220
|
+
distributed directory services
|
221
|
+
test_files:
|
246
222
|
- test/test_entry.rb
|
247
223
|
- test/test_filter.rb
|
248
224
|
- test/test_ldap_connection.rb
|