net-ldap 0.17.1 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55f2964276a686be8ca816c32c499383b0085f0f20c9af76fb039ce0df9bc3c0
4
- data.tar.gz: fd9caa7e812f4de283cc07aefc56707f47215924a50f524beda08b72cc7bd9a3
3
+ metadata.gz: c8d5def02bd0ce6b44457f5c1c7983f8730131a1a7082b3765791b14a0ee576b
4
+ data.tar.gz: 41a50fda89f8c8e7a6a1c182e894181d910367a356c67f031dec8072e1544e3e
5
5
  SHA512:
6
- metadata.gz: 827e26be88d21d2a46b4912cf77c86cd523e3267cf7a6db62eb2a841ef655dd885a979f79479895a65eabe37e54d980b7abb16d134c7c73b4cf73ade9a7c01b6
7
- data.tar.gz: a796f5aebdf10570f0b762b603bcc9668a8a5b6a592866dc8af4e19ec92e01fb0def0c4e3d2199955b68ead95ec3cd09d2602ac2e27bfa02fc292bfe284486b6
6
+ metadata.gz: c5ae1310f3668a7f12f4817ede1cdd9310b8b262a40f41639d29e6cf0ba105f3bd6df8f6b892abed3924b03987c18f0e3f0c9bb2c848ed9d33a4662d53783f83
7
+ data.tar.gz: f2b4573b1af8db1dd16b9b31202a53edd08829d399fb94bd27cb400b8b1246929dca87744bd5156c4910a4fd53a4c4689a3917258d165e472135fbf50afceb7c
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === Net::LDAP 0.18.0
2
+ * Fix escaping of # and space in attrs #408
3
+ * Add support to use SNI #406
4
+ * Drop Ruby 2.5 and JRuby 9.2 from CI tests
5
+ * Bump rubocop to 1.48.1
6
+ * Update CI for TruffleRuby 22
7
+
1
8
  === Net::LDAP 0.17.1
2
9
  * Fixed shebang of bash #385
3
10
  * Omit some tests for now until we update our CA cert #386
@@ -33,9 +33,10 @@ class Net::LDAP::Connection #:nodoc:
33
33
  def prepare_socket(server, timeout=nil)
34
34
  socket = server[:socket]
35
35
  encryption = server[:encryption]
36
+ hostname = server[:host]
36
37
 
37
38
  @conn = socket
38
- setup_encryption(encryption, timeout) if encryption
39
+ setup_encryption(encryption, timeout, hostname) if encryption
39
40
  end
40
41
 
41
42
  def open_connection(server)
@@ -86,7 +87,7 @@ class Net::LDAP::Connection #:nodoc:
86
87
  end
87
88
  end
88
89
 
89
- def self.wrap_with_ssl(io, tls_options = {}, timeout=nil)
90
+ def self.wrap_with_ssl(io, tls_options = {}, timeout=nil, hostname=nil)
90
91
  raise Net::LDAP::NoOpenSSLError, "OpenSSL is unavailable" unless Net::LDAP::HasOpenSSL
91
92
 
92
93
  ctx = OpenSSL::SSL::SSLContext.new
@@ -96,6 +97,7 @@ class Net::LDAP::Connection #:nodoc:
96
97
  ctx.set_params(tls_options) unless tls_options.empty?
97
98
 
98
99
  conn = OpenSSL::SSL::SSLSocket.new(io, ctx)
100
+ conn.hostname = hostname
99
101
 
100
102
  begin
101
103
  if timeout
@@ -148,11 +150,11 @@ class Net::LDAP::Connection #:nodoc:
148
150
  # communications, as with simple_tls. Thanks for Kouhei Sutou for
149
151
  # generously contributing the :start_tls path.
150
152
  #++
151
- def setup_encryption(args, timeout=nil)
153
+ def setup_encryption(args, timeout=nil, hostname=nil)
152
154
  args[:tls_options] ||= {}
153
155
  case args[:method]
154
156
  when :simple_tls
155
- @conn = self.class.wrap_with_ssl(@conn, args[:tls_options], timeout)
157
+ @conn = self.class.wrap_with_ssl(@conn, args[:tls_options], timeout, hostname)
156
158
  # additional branches requiring server validation and peer certs, etc.
157
159
  # go here.
158
160
  when :start_tls
@@ -170,7 +172,7 @@ class Net::LDAP::Connection #:nodoc:
170
172
 
171
173
  raise Net::LDAP::StartTLSError,
172
174
  "start_tls failed: #{pdu.result_code}" unless pdu.result_code.zero?
173
- @conn = self.class.wrap_with_ssl(@conn, args[:tls_options], timeout)
175
+ @conn = self.class.wrap_with_ssl(@conn, args[:tls_options], timeout, hostname)
174
176
  else
175
177
  raise Net::LDAP::EncMethodUnsupportedError, "unsupported encryption method #{args[:method]}"
176
178
  end
data/lib/net/ldap/dn.rb CHANGED
@@ -192,27 +192,19 @@ class Net::LDAP::DN
192
192
  # http://tools.ietf.org/html/rfc2253 section 2.4 lists these exceptions
193
193
  # for dn values. All of the following must be escaped in any normal string
194
194
  # using a single backslash ('\') as escape.
195
- ESCAPES = {
196
- ',' => ',',
197
- '+' => '+',
198
- '"' => '"',
199
- '\\' => '\\',
200
- '<' => '<',
201
- '>' => '>',
202
- ';' => ';',
203
- }
195
+ ESCAPES = %w[, + " \\ < > ;]
204
196
 
205
- # Compiled character class regexp using the keys from the above hash, and
197
+ # Compiled character class regexp using the values from the above list, and
206
198
  # checking for a space or # at the start, or space at the end, of the
207
199
  # string.
208
200
  ESCAPE_RE = Regexp.new("(^ |^#| $|[" +
209
- ESCAPES.keys.map { |e| Regexp.escape(e) }.join +
201
+ ESCAPES.map { |e| Regexp.escape(e) }.join +
210
202
  "])")
211
203
 
212
204
  ##
213
205
  # Escape a string for use in a DN value
214
206
  def self.escape(string)
215
- string.gsub(ESCAPE_RE) { |char| "\\" + ESCAPES[char] }
207
+ string.gsub(ESCAPE_RE) { |char| "\\" + char }
216
208
  end
217
209
 
218
210
  ##
@@ -1,5 +1,5 @@
1
1
  module Net
2
2
  class LDAP
3
- VERSION = "0.17.1"
3
+ VERSION = "0.18.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ldap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Cianfrocca
@@ -10,10 +10,10 @@ authors:
10
10
  - Kaspar Schiess
11
11
  - Austin Ziegler
12
12
  - Michael Schaarschmidt
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2022-06-07 00:00:00.000000000 Z
16
+ date: 2023-04-04 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: flexmock
@@ -49,14 +49,14 @@ dependencies:
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: 0.49.0
52
+ version: '1.48'
53
53
  type: :development
54
54
  prerelease: false
55
55
  version_requirements: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: 0.49.0
59
+ version: '1.48'
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: test-unit
62
62
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ homepage: http://github.com/ruby-ldap/ruby-net-ldap
146
146
  licenses:
147
147
  - MIT
148
148
  metadata: {}
149
- post_install_message:
149
+ post_install_message:
150
150
  rdoc_options:
151
151
  - "--main"
152
152
  - README.rdoc
@@ -163,8 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  requirements: []
166
- rubygems_version: 3.3.7
167
- signing_key:
166
+ rubygems_version: 3.4.7
167
+ signing_key:
168
168
  specification_version: 4
169
169
  summary: Net::LDAP for Ruby (also called net-ldap) implements client access for the
170
170
  Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing