Skip to content

Commit a8cd0f0

Browse files
Merge branch 'master' into master
2 parents a07710c + 30b5db4 commit a8cd0f0

35 files changed

+529
-1074
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: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,43 @@ 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
611
# optional
712
- ruby-head
813
- jruby-19mode
914
- jruby-head
1015
- rbx-2
1116

17+
addons:
18+
hosts:
19+
- ldap.example.org # needed for TLS verification
20+
21+
services:
22+
- docker
23+
1224
env:
1325
- INTEGRATION=openldap
1426

1527
before_install:
1628
- gem update bundler
1729

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

2245
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: 6 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,
@@ -467,6 +467,10 @@ def search(args = nil)
467467
end
468468
end
469469

470+
if result_pdu.nil?
471+
raise Net::LDAP::ResponseMissingOrInvalidError, "response missing"
472+
end
473+
470474
# count number of pages of results
471475
payload[:page_count] ||= 0
472476
payload[:page_count] += 1
@@ -706,7 +710,7 @@ def socket
706710
# Wrap around Socket.tcp to normalize with other Socket initializers
707711
class DefaultSocket
708712
def self.new(host, port, socket_opts = {})
709-
Socket.tcp(host, port, socket_opts)
713+
Socket.tcp(host, port, **socket_opts)
710714
end
711715
end
712716
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/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 LdapPduError.new("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: 1 addition & 1 deletion
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")
3636
s.add_development_dependency("byebug")
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.

test/fixtures/ca/cacert.pem

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

0 commit comments

Comments
 (0)