summaryrefslogtreecommitdiff
path: root/ext/openssl/lib
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-26 23:31:04 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-26 23:31:04 +0000
commit40761f59254bbdeca34e0bcedd906821d0384b54 (patch)
tree42bf0eee5639ba397c124a362ad792414e265149 /ext/openssl/lib
parent89eb20764ea4d3b780eee12488e7c3ff6fb9ba9f (diff)
* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLSocket#post_connection_chech):
treat wildcard character in commonName. [ruby-dev:28121] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib')
-rw-r--r--ext/openssl/lib/openssl/ssl.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 9b287fc..a535fc1 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -82,8 +82,9 @@ module OpenSSL
}
if check_common_name
cert.subject.to_a.each{|oid, value|
- if oid == "CN" && value.casecmp(hostname) == 0
- return true
+ if oid == "CN"
+ reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
end
}
end