Skip to content

Commit b5cd9ba

Browse files
Merge branch 'master' into fix-rubocop-lint-details
2 parents ae38233 + 1d81177 commit b5cd9ba

40 files changed

+556
-1084
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

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ MyClass.new \
4949
baz: 'garply'
5050
```
5151

52-
[issues]: https://github.com/ruby-net-ldap/ruby-net-ldap/issues
52+
[issues]: https://github.com/ruby-ldap/ruby-net-ldap/issues
5353
[pr]: https://help.github.com/articles/using-pull-requests
5454
[travis]: https://travis-ci.org/ruby-ldap/ruby-net-ldap

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: 10 additions & 5 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

@@ -21,7 +21,7 @@ the most recent LDAP RFCs (4510–4519, plus portions of 4520–4532).
2121

2222
== Synopsis
2323

24-
See Net::LDAP for documentation and usage samples.
24+
See {Net::LDAP on rubydoc.info}[https://www.rubydoc.info/gems/net-ldap/Net/LDAP] for documentation and usage samples.
2525

2626
== Requirements
2727

@@ -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: 7 additions & 3 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
@@ -606,7 +610,7 @@ def password_modify(args)
606610
pdu = queued_read(message_id)
607611

608612
if !pdu || pdu.app_tag != Net::LDAP::PDU::ExtendedResponse
609-
raise Net::LDAP::ResponseMissingError, "response missing or invalid"
613+
raise Net::LDAP::ResponseMissingOrInvalidError, "response missing or invalid"
610614
end
611615

612616
pdu
@@ -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/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 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: 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.

0 commit comments

Comments
 (0)