openssl 2.1.1 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,29 +77,44 @@ module OpenSSL
77
77
  def parse_config_lines(io)
78
78
  section = 'default'
79
79
  data = {section => {}}
80
- while definition = get_definition(io)
80
+ io_stack = [io]
81
+ while definition = get_definition(io_stack)
81
82
  definition = clear_comments(definition)
82
83
  next if definition.empty?
83
- if definition[0] == ?[
84
+ case definition
85
+ when /\A\[/
84
86
  if /\[([^\]]*)\]/ =~ definition
85
87
  section = $1.strip
86
88
  data[section] ||= {}
87
89
  else
88
90
  raise ConfigError, "missing close square bracket"
89
91
  end
90
- else
91
- if /\A([^:\s]*)(?:::([^:\s]*))?\s*=(.*)\z/ =~ definition
92
- if $2
93
- section = $1
94
- key = $2
95
- else
96
- key = $1
92
+ when /\A\.include (\s*=\s*)?(.+)\z/
93
+ path = $2
94
+ if File.directory?(path)
95
+ files = Dir.glob(File.join(path, "*.{cnf,conf}"), File::FNM_EXTGLOB)
96
+ else
97
+ files = [path]
98
+ end
99
+
100
+ files.each do |filename|
101
+ begin
102
+ io_stack << StringIO.new(File.read(filename))
103
+ rescue
104
+ raise ConfigError, "could not include file '%s'" % filename
97
105
  end
98
- value = unescape_value(data, section, $3)
99
- (data[section] ||= {})[key] = value.strip
106
+ end
107
+ when /\A([^:\s]*)(?:::([^:\s]*))?\s*=(.*)\z/
108
+ if $2
109
+ section = $1
110
+ key = $2
100
111
  else
101
- raise ConfigError, "missing equal sign"
112
+ key = $1
102
113
  end
114
+ value = unescape_value(data, section, $3)
115
+ (data[section] ||= {})[key] = value.strip
116
+ else
117
+ raise ConfigError, "missing equal sign"
103
118
  end
104
119
  end
105
120
  data
@@ -212,10 +227,10 @@ module OpenSSL
212
227
  scanned.join
213
228
  end
214
229
 
215
- def get_definition(io)
216
- if line = get_line(io)
230
+ def get_definition(io_stack)
231
+ if line = get_line(io_stack)
217
232
  while /[^\\]\\\z/ =~ line
218
- if extra = get_line(io)
233
+ if extra = get_line(io_stack)
219
234
  line += extra
220
235
  else
221
236
  break
@@ -225,9 +240,12 @@ module OpenSSL
225
240
  end
226
241
  end
227
242
 
228
- def get_line(io)
229
- if line = io.gets
230
- line.gsub(/[\r\n]*/, '')
243
+ def get_line(io_stack)
244
+ while io = io_stack.last
245
+ if line = io.gets
246
+ return line.gsub(/[\r\n]*/, '')
247
+ end
248
+ io_stack.pop
231
249
  end
232
250
  end
233
251
  end
data/lib/openssl/ssl.rb CHANGED
@@ -12,6 +12,7 @@
12
12
 
13
13
  require "openssl/buffering"
14
14
  require "io/nonblock"
15
+ require "ipaddr"
15
16
 
16
17
  module OpenSSL
17
18
  module SSL
@@ -272,11 +273,11 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
272
273
  return true if verify_hostname(hostname, san.value)
273
274
  when 7 # iPAddress in GeneralName (RFC5280)
274
275
  should_verify_common_name = false
275
- # follows GENERAL_NAME_print() in x509v3/v3_alt.c
276
- if san.value.size == 4
277
- return true if san.value.unpack('C*').join('.') == hostname
278
- elsif san.value.size == 16
279
- return true if san.value.unpack('n*').map { |e| sprintf("%X", e) }.join(':') == hostname
276
+ if san.value.size == 4 || san.value.size == 16
277
+ begin
278
+ return true if san.value == IPAddr.new(hostname).hton
279
+ rescue IPAddr::InvalidAddressError
280
+ end
280
281
  end
281
282
  end
282
283
  }
metadata CHANGED
@@ -1,32 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bosslet
8
8
  - SHIBATA Hiroshi
9
9
  - Zachary Scott
10
10
  - Kazuki Yamaguchi
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-05-12 00:00:00.000000000 Z
14
+ date: 2022-09-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: rake
17
+ name: ipaddr
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
- type: :development
23
+ type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 11.2.0
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 11.2.0
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: rake-compiler
32
46
  requirement: !ruby/object:Gem::Requirement
@@ -155,7 +169,7 @@ licenses:
155
169
  - Ruby
156
170
  metadata:
157
171
  msys2_mingw_dependencies: openssl
158
- post_install_message:
172
+ post_install_message:
159
173
  rdoc_options:
160
174
  - "--main"
161
175
  - README.md
@@ -172,9 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0'
174
188
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.6
177
- signing_key:
189
+ rubygems_version: 3.3.8
190
+ signing_key:
178
191
  specification_version: 4
179
192
  summary: OpenSSL provides SSL, TLS and general purpose cryptography.
180
193
  test_files: []