Skip to content

Commit 7b5ab42

Browse files
author
Phil Toland
committed
Committed differences between official repo and the published 0.5 gem.
1 parent 36c2d4b commit 7b5ab42

File tree

13 files changed

+606
-169
lines changed

13 files changed

+606
-169
lines changed

History.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Added [preliminary (still undocumented) support for SASL authentication.
77
* Supported several constructs from the server side of the LDAP protocol.
88
* Added a "consuming" String#read_ber! method.
9+
* Added some support for SNMP data-handling.
910
* Belatedly added a patch contributed by Kouhei Sutou last October.
1011
The patch adds start_tls support.
1112
* Added Net::LDAP#search_subschema_entry
@@ -43,8 +44,6 @@
4344
* 04Sep07, Changed four error classes to inherit from StandardError rather
4445
Exception, in order to be friendlier to irb. Suggested by Kouhei.
4546
* Ensure connections are closed. Thanks to Kristian Meier.
46-
* An LDAP::Entry should return an empty array when accessing a nonexistent
47-
attribute via a method call. Mirrors index lookup behaviour.
4847
* Minor bug fixes here and there.
4948

5049
=== Net::LDAP 0.0.4 / 2006-08-15

Manifest.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ LICENSE
44
Manifest.txt
55
README.txt
66
Rakefile
7+
Release-Announcement
78
lib/net/ber.rb
89
lib/net/ldap.rb
910
lib/net/ldap/dataset.rb
@@ -12,6 +13,7 @@ lib/net/ldap/filter.rb
1213
lib/net/ldap/pdu.rb
1314
lib/net/ldap/psw.rb
1415
lib/net/ldif.rb
16+
lib/net/snmp.rb
1517
pre-setup.rb
1618
setup.rb
1719
test/common.rb
@@ -20,6 +22,7 @@ test/test_entry.rb
2022
test/test_filter.rb
2123
test/test_ldif.rb
2224
test/test_password.rb
25+
test/test_snmp.rb
2326
test/testdata.ldif
2427
tests/NOTICE.txt
2528
tests/testldap.rb

README.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66

77
Pure Ruby LDAP library.
88

9-
A LDAP client library written in pure Ruby.
10-
119
== FEATURES/PROBLEMS:
1210

1311
The Lightweight Directory Access Protocol (LDAP) is an Internet protocol
1412
for accessing distributed directory services.
1513

16-
Net::LDAP is a feature-complete LDAP support library written in pure Ruby.
17-
It supports most LDAP client features and a subset of server features as
18-
well.
14+
Net::LDAP is an LDAP support library written in pure Ruby. It supports
15+
most LDAP client features and a subset of server features as well.
1916

2017
* Standards-based (going for RFC 4511)
2118
* Portable: 100% Ruby
@@ -26,7 +23,7 @@ See Net::LDAP for documentation and usage samples.
2623

2724
== REQUIREMENTS:
2825

29-
Net::LDAP requires Ruby 1.8.6 or better. Note that 1.9 is not yet supported.
26+
Net::LDAP requires Ruby 1.8.2 or better.
3027

3128
== INSTALL:
3229

@@ -36,7 +33,7 @@ libraries.
3633
You can install the RubyGems version of Net::LDAP available from the
3734
usual sources.
3835

39-
* gem install ruby-net-ldap
36+
* gem install net-ldap
4037

4138
If using the packaged (.tgz) version; it can be installed with:
4239

Rakefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ $LOAD_PATH.unshift( "#{File.dirname(__FILE__)}/lib" )
99
# Pull in local 'net/ldap' as opposed to an installed version.
1010
require 'net/ldap'
1111

12-
Hoe.spec 'ruby-net-ldap' do
13-
developer 'Emiel van de Laar', '[email protected]'
14-
developer 'Francis Cianfrocca', '[email protected]'
12+
Hoe.new('net-ldap', Net::LDAP::VERSION) do |p|
13+
p.rubyforge_name = 'net-ldap'
14+
p.developer('Francis Cianfrocca', '[email protected]')
15+
p.developer('Emiel van de Laar', '[email protected]')
1516
end
1617

17-
# vim: syntax=ruby
18+
# vim: syntax=Ruby

Release-Announcement

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
We're pleased to announce version 0.0.4 of Net::LDAP, the pure-Ruby LDAP library.
2+
3+
This version adds an implementation of Net::LDAP#bind_as, which allows
4+
you to authenticate users who log into your applications using simple
5+
identifiers like email addresses and simple usernames. Thanks to Simon Claret
6+
for suggesting the original implementation in his page on the Rails-Wiki,
7+
and for valuable comments and help with testing.
8+
9+
We have un-deprecated Net::LDAP#modify, which can be useful with
10+
LDAP servers that observe non-standard transactional and concurrency
11+
semantics in LDAP Modify operations. Note: this is a documentation change,
12+
not a code change. Thanks to Justin Forder for providing the rationale
13+
for this change.
14+
15+
We added a larger set of special characters which may appear in RFC-2254
16+
standard search filters. Thanks to Andre Nathan for this patch.
17+
18+
We fixed a bug that was preventing Net::LDAP#open from being called more
19+
than once on the same object.
20+
21+
22+
Net::LDAP is a feature-complete LDAP client which can access as much as
23+
possible of the functionality of the most-used LDAP server implementations.
24+
This library does not wrap any existing native-code LDAP libraries, creates no
25+
Ruby extensions, and has no dependencies external to Ruby.
26+
27+
If anyone wants to contribute suggestions, insights or (especially)
28+
code, please email me at garbagecat10 .. .. gmail.com.
29+
30+
= What is Net::LDAP for Ruby?
31+
This library provides a pure-Ruby implementation of an LDAP client.
32+
It can be used to access any server which implements the LDAP protocol.
33+
34+
Net::LDAP is intended to provide full LDAP functionality while hiding
35+
the more arcane aspects of the LDAP protocol itself, so as to make the
36+
programming interface as Ruby-like as possible.
37+
38+
In particular, this means that there is no direct dependence on the
39+
structure of the various "traditional" LDAP clients. This is a ground-up
40+
rethinking of the LDAP API.
41+
42+
Net::LDAP is based on RFC-2251, which specifies the Lightweight Directory
43+
Access Protocol, as amended and extended by subsequent RFCs and by the more
44+
widely-used directory implementations.
45+
46+
Homepage:: http://rubyforge.org/projects/net-ldap/
47+
Download:: http://rubyforge.org/frs/?group_id=143
48+
Copyright:: 2006 by Francis Cianfrocca
49+
50+
== LICENCE NOTES
51+
Please read the file LICENCE for licensing restrictions on this library. In
52+
the simplest terms, this library is available under the same terms as Ruby
53+
itself.
54+
55+
== Requirements and Installation
56+
Net::LDAP requires Ruby 1.8.2 or better.
57+
58+
Net::LDAP can be installed with:
59+
60+
% ruby setup.rb
61+
62+
Alternatively, you can use the RubyGems version of Net::LDAP available
63+
as ruby-net-ldap-0.0.2.gem from the usual sources.
64+
65+
== Whet your appetite:
66+
require 'net/ldap'
67+
68+
ldap = Net::LDAP.new :host => server_ip_address,
69+
:port => 389,
70+
:auth => {
71+
:method => :simple,
72+
:username => "cn=manager,dc=example,dc=com",
73+
:password => "opensesame"
74+
}
75+
76+
filter = Net::LDAP::Filter.eq( "cn", "George*" )
77+
treebase = "dc=example,dc=com"
78+
79+
ldap.search( :base => treebase, :filter => filter ) do |entry|
80+
puts "DN: #{entry.dn}"
81+
entry.each do |attribute, values|
82+
puts " #{attribute}:"
83+
values.each do |value|
84+
puts " --->#{value}"
85+
end
86+
end
87+
end
88+
89+
p ldap.get_operation_result
90+
91+
== Net::LDAP 0.0.2: May 3, 2006
92+
* Fixed malformation in distro tarball and gem.
93+
* Improved documentation.
94+
* Supported "paged search control."
95+

lib/net/ber.rb

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,35 +145,27 @@ module BERParser
145145
# of this one.
146146
#
147147
def read_ber syntax=nil
148-
# don't bother with this line, since IO#getc by definition returns nil on eof.
148+
# don't bother with this line, since IO#getbyte by definition returns nil on eof.
149149
#return nil if eof?
150150

151-
id = getc or return nil # don't trash this value, we'll use it later
151+
id = getbyte or return nil # don't trash this value, we'll use it later
152152
#tag = id & 31
153153
#tag < 31 or raise BerError.new( "unsupported tag encoding: #{id}" )
154154
#tagclass = TagClasses[ id >> 6 ]
155155
#encoding = (id & 0x20 != 0) ? :constructed : :primitive
156156

157-
n = getc
157+
n = getbyte
158158
lengthlength,contentlength = if n <= 127
159159
[1,n]
160160
else
161161
# Replaced the inject because it profiles hot.
162-
#j = (0...(n & 127)).inject(0) {|mem,x| mem = (mem << 8) + getc}
162+
#j = (0...(n & 127)).inject(0) {|mem,x| mem = (mem << 8) + getbyte}
163163
j = 0
164164
read( n & 127 ).each_byte {|n1| j = (j << 8) + n1}
165165
[1 + (n & 127), j]
166166
end
167167

168-
# Read 'value'...
169-
newobj = "" # Buffer to collect 'value' data.
170-
length = contentlength
171-
172-
while ( length > 0 ) # There is more to read.
173-
data = read( length )
174-
length -= data.length
175-
newobj << data
176-
end
168+
newobj = read contentlength
177169

178170
# This exceptionally clever and clear bit of code is verrrry slow.
179171
objtype = (syntax && syntax[id]) || BuiltinSyntax[id]
@@ -554,7 +546,8 @@ def to_ber_oid
554546

555547
private
556548
def to_ber_seq_internal code
557-
s = self.to_s
549+
s = ''
550+
self.each{|x| s = s + x}
558551
[code].pack('C') + s.length.to_ber_length_encoding + s
559552
end
560553

0 commit comments

Comments
 (0)