diff options
| author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-26 23:31:04 +0000 |
|---|---|---|
| committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-26 23:31:04 +0000 |
| commit | f410afb35d1449d36f11990b1a4ddae8d833fbc8 (patch) | |
| tree | 42bf0eee5639ba397c124a362ad792414e265149 /ext | |
| parent | 5e7a785b405eb533f1a52f1bbf057bbbe89fa6ee (diff) | |
| download | ruby-f410afb35d1449d36f11990b1a4ddae8d833fbc8.tar.gz ruby-f410afb35d1449d36f11990b1a4ddae8d833fbc8.tar.xz ruby-f410afb35d1449d36f11990b1a4ddae8d833fbc8.zip | |
* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLSocket#post_connection_chech):
treat wildcard character in commonName. [ruby-dev:28121]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/openssl/lib/openssl/ssl.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index 9b287fc93..a535fc171 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 |
