Skip to content

Commit 422a0e3

Browse files
Merge branch 'master' into bugfix-uninitialized_constant_pduerror
2 parents bb34b7b + 875611d commit 422a0e3

38 files changed

+537
-1081
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ publish/
77
Gemfile.lock
88
.bundle
99
bin/
10+
.idea

.travis.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,44 @@ rvm:
33
- 2.0.0
44
- 2.1
55
- 2.2
6+
- 2.3
7+
- 2.4
8+
- 2.5
9+
- 2.6
10+
- 2.7
11+
- jruby-9.2
612
# optional
713
- ruby-head
814
- jruby-19mode
915
- jruby-head
1016
- rbx-2
1117

18+
addons:
19+
hosts:
20+
- ldap.example.org # needed for TLS verification
21+
22+
services:
23+
- docker
24+
1225
env:
1326
- INTEGRATION=openldap
1427

1528
before_install:
1629
- gem update bundler
1730

1831
install:
19-
- if [ "$INTEGRATION" = "openldap" ]; then sudo script/install-openldap; fi
32+
- >
33+
docker run \
34+
--hostname ldap.example.org \
35+
--env LDAP_TLS_VERIFY_CLIENT=try \
36+
-p 389:389 \
37+
-p 636:636 \
38+
-v "$(pwd)"/test/fixtures/ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom \
39+
--name openldap \
40+
--detach \
41+
osixia/openldap:1.3.0 \
42+
--copy-service \
43+
--loglevel debug \
2044
- bundle install
2145

2246
script: bundle exec rake ci

History.rdoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
=== Net::LDAP 0.16.2
2+
3+
* Net::LDAP#open does not cache bind result {#334}[https://github.com/ruby-ldap/ruby-net-ldap/pull/334]
4+
* Fix CI build {#333}[https://github.com/ruby-ldap/ruby-net-ldap/pull/333]
5+
* Fix to "undefined method 'result_code'" {#308}[https://github.com/ruby-ldap/ruby-net-ldap/pull/308]
6+
* Fixed Exception: incompatible character encodings: ASCII-8BIT and UTF-8 in filter.rb {#285}[https://github.com/ruby-ldap/ruby-net-ldap/pull/285]
7+
18
=== Net::LDAP 0.16.1
29

310
* Send DN and newPassword with password_modify request {#271}[https://github.com/ruby-ldap/ruby-net-ldap/pull/271]

README.rdoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Net::LDAP for Ruby {<img src="https://travis-ci.org/ruby-ldap/ruby-net-ldap.png" />}[https://travis-ci.org/ruby-ldap/ruby-net-ldap]
1+
= Net::LDAP for Ruby {<img src="https://travis-ci.org/ruby-ldap/ruby-net-ldap.svg" />}[https://travis-ci.org/ruby-ldap/ruby-net-ldap]
22

33
== Description
44

@@ -53,9 +53,14 @@ This task will run the test suite and the
5353
rake rubotest
5454

5555
CI takes too long? If your local box supports
56-
{Vagrant}[https://www.vagrantup.com/], you can run most of the tests
57-
in a VM on your local box. For more details and setup instructions, see
58-
{test/support/vm/openldap/README.md}[https://github.com/ruby-ldap/ruby-net-ldap/tree/master/test/support/vm/openldap/README.md]
56+
{Docker}[https://www.docker.com/], you can also run integration tests locally.
57+
Simply run:
58+
59+
script/ldap-docker
60+
INTEGRATION=openldap rake test
61+
62+
CAVEAT: you need to add the following line to /etc/hosts
63+
127.0.0.1 ldap.example.org
5964

6065
== Release
6166

lib/net/ldap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ def open
712712
begin
713713
@open_connection = new_connection
714714
payload[:connection] = @open_connection
715-
payload[:bind] = @open_connection.bind(@auth)
715+
payload[:bind] = @result = @open_connection.bind(@auth)
716716
yield self
717717
ensure
718718
@open_connection.close if @open_connection

lib/net/ldap/connection.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def encode_sort_controls(sort_definitions)
300300
control[2] = (control[2] == true).to_ber
301301
control.to_ber_sequence
302302
end
303-
sort_control = [
303+
[
304304
Net::LDAP::LDAPControls::SORT_REQUEST.to_ber,
305305
false.to_ber,
306306
sort_control_values.to_ber_sequence.to_s.to_ber,
@@ -710,7 +710,7 @@ def socket
710710
# Wrap around Socket.tcp to normalize with other Socket initializers
711711
class DefaultSocket
712712
def self.new(host, port, socket_opts = {})
713-
Socket.tcp(host, port, socket_opts)
713+
Socket.tcp(host, port, **socket_opts)
714714
end
715715
end
716716
end # class Connection

lib/net/ldap/filter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def parse_paren_expression(scanner)
755755
# This parses a given expression inside of parentheses.
756756
def parse_filter_branch(scanner)
757757
scanner.scan(/\s*/)
758-
if token = scanner.scan(/[-\w:.]*[\w]/)
758+
if token = scanner.scan(/[-\w:.;]*[\w]/)
759759
scanner.scan(/\s*/)
760760
if op = scanner.scan(/<=|>=|!=|:=|=/)
761761
scanner.scan(/\s*/)

lib/net/ldap/instrumentation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module Net::LDAP::Instrumentation
1212
def instrument(event, payload = {})
1313
payload = (payload || {}).dup
1414
if instrumentation_service
15-
instrumentation_service.instrument(event, payload) do |payload|
16-
payload[:result] = yield(payload) if block_given?
15+
instrumentation_service.instrument(event, payload) do |instr_payload|
16+
instr_payload[:result] = yield(instr_payload) if block_given?
1717
end
1818
else
1919
yield(payload) if block_given?

lib/net/ldap/password.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ class << self
1919
# * Should we provide sha1 as a synonym for sha1? I vote no because then
2020
# should you also provide ssha1 for symmetry?
2121
#
22-
attribute_value = ""
2322
def generate(type, str)
2423
case type
2524
when :md5
26-
attribute_value = '{MD5}' + Base64.encode64(Digest::MD5.digest(str)).chomp!
25+
'{MD5}' + Base64.strict_encode64(Digest::MD5.digest(str))
2726
when :sha
28-
attribute_value = '{SHA}' + Base64.encode64(Digest::SHA1.digest(str)).chomp!
27+
'{SHA}' + Base64.strict_encode64(Digest::SHA1.digest(str))
2928
when :ssha
3029
salt = SecureRandom.random_bytes(16)
31-
attribute_value = '{SSHA}' + Base64.encode64(Digest::SHA1.digest(str + salt) + salt).chomp!
30+
'{SSHA}' + Base64.strict_encode64(Digest::SHA1.digest(str + salt) + salt)
3231
else
3332
raise Net::LDAP::HashTypeUnsupportedError, "Unsupported password-hash type (#{type})"
3433
end
35-
return attribute_value
3634
end
3735
end
3836
end

lib/net/ldap/pdu.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def initialize(ber_object)
123123
when ExtendedResponse
124124
parse_extended_response(ber_object[1])
125125
else
126-
raise Net::LDAP::PDU::Error, "unknown pdu-type: #{@app_tag}"
126+
raise Error.new("unknown pdu-type: #{@app_tag}")
127127
end
128128

129129
parse_controls(ber_object[2]) if ber_object[2]

lib/net/ldap/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Net
22
class LDAP
3-
VERSION = "0.16.1"
3+
VERSION = "0.16.2"
44
end
55
end

net-ldap.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ the most recent LDAP RFCs (4510-4519, plutions of 4520-4532).}
3131

3232
s.add_development_dependency("flexmock", "~> 1.3")
3333
s.add_development_dependency("rake", "~> 10.0")
34-
s.add_development_dependency("rubocop", "~> 0.42.0")
34+
s.add_development_dependency("rubocop", "~> 0.49.0")
3535
s.add_development_dependency("test-unit")
36-
s.add_development_dependency("byebug")
36+
s.add_development_dependency("byebug") unless RUBY_PLATFORM == "java"
3737
end

script/generate-fixture-ca

Lines changed: 0 additions & 48 deletions
This file was deleted.

script/install-openldap

Lines changed: 0 additions & 134 deletions
This file was deleted.

script/ldap-docker

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Usage: script/ldap-docker
3+
#
4+
# Starts a openldap docker container ready for integration tests
5+
6+
docker run --rm -ti \
7+
--hostname ldap.example.org \
8+
--env LDAP_TLS_VERIFY_CLIENT=try \
9+
-p 389:389 -p 636:636 \
10+
-v "$(pwd)"/test/fixtures/ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom \
11+
--name my-openldap-container \
12+
osixia/openldap:1.3.0 --copy-service --loglevel debug

test/fixtures/ca/ca.info

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)