mvadkert / rpms / ruby

Forked from rpms/ruby 6 years ago
Clone
6e38a4a
diff -pruN ruby-1.8.6-p111.orig/ext/openssl/lib/net/ftptls.rb ruby-1.8.6-p111/ext/openssl/lib/net/ftptls.rb
6e38a4a
--- ruby-1.8.6-p111.orig/ext/openssl/lib/net/ftptls.rb	2007-02-13 08:01:19.000000000 +0900
6e38a4a
+++ ruby-1.8.6-p111/ext/openssl/lib/net/ftptls.rb	2007-10-29 21:10:24.000000000 +0900
6e38a4a
@@ -29,13 +29,23 @@ require 'net/ftp'
6e38a4a
 
6e38a4a
 module Net
6e38a4a
   class FTPTLS < FTP
6e38a4a
+    def connect(host, port=FTP_PORT)
6e38a4a
+       @hostname = host
6e38a4a
+       super
6e38a4a
+    end
6e38a4a
+
6e38a4a
     def login(user = "anonymous", passwd = nil, acct = nil)
6e38a4a
+       store = OpenSSL::X509::Store.new
6e38a4a
+       store.set_default_paths
6e38a4a
        ctx = OpenSSL::SSL::SSLContext.new('SSLv23')
6e38a4a
+       ctx.cert_store = store
6e38a4a
+       ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
6e38a4a
        ctx.key = nil
6e38a4a
        ctx.cert = nil
6e38a4a
        voidcmd("AUTH TLS")
6e38a4a
        @sock = OpenSSL::SSL::SSLSocket.new(@sock, ctx)
6e38a4a
        @sock.connect
6e38a4a
+       @sock.post_connection_check(@hostname)
6e38a4a
        super(user, passwd, acct)
6e38a4a
        voidcmd("PBSZ 0")
6e38a4a
     end
6e38a4a
diff -pruN ruby-1.8.6-p111.orig/ext/openssl/lib/net/telnets.rb ruby-1.8.6-p111/ext/openssl/lib/net/telnets.rb
6e38a4a
--- ruby-1.8.6-p111.orig/ext/openssl/lib/net/telnets.rb	2007-02-13 08:01:19.000000000 +0900
6e38a4a
+++ ruby-1.8.6-p111/ext/openssl/lib/net/telnets.rb	2007-10-29 21:13:03.000000000 +0900
6e38a4a
@@ -134,6 +134,9 @@ module Net
6e38a4a
             @sock.verify_callback = @options['VerifyCallback']
6e38a4a
             @sock.verify_depth    = @options['VerifyDepth']
6e38a4a
             @sock.connect
6e38a4a
+            if @options['VerifyMode'] != OpenSSL::SSL::VERIFY_NONE
6e38a4a
+              @sock.post_connection_check(@options['Host'])
6e38a4a
+            end
6e38a4a
             @ssl = true
6e38a4a
           end
6e38a4a
           ''
6e38a4a
diff -pruN ruby-1.8.6-p111.orig/lib/net/http.rb ruby-1.8.6-p111/lib/net/http.rb
6e38a4a
--- ruby-1.8.6-p111.orig/lib/net/http.rb	2007-09-24 17:12:24.000000000 +0900
6e38a4a
+++ ruby-1.8.6-p111/lib/net/http.rb	2007-10-29 21:12:12.000000000 +0900
6e38a4a
@@ -470,7 +470,6 @@ module Net   #:nodoc:
6e38a4a
       @debug_output = nil
6e38a4a
       @use_ssl = false
6e38a4a
       @ssl_context = nil
6e38a4a
-      @enable_post_connection_check = false
6e38a4a
     end
6e38a4a
 
6e38a4a
     def inspect
6e38a4a
@@ -527,9 +526,6 @@ module Net   #:nodoc:
6e38a4a
       false   # redefined in net/https
6e38a4a
     end
6e38a4a
 
6e38a4a
-    # specify enabling SSL server certificate and hostname checking.
6e38a4a
-    attr_accessor :enable_post_connection_check
6e38a4a
-
6e38a4a
     # Opens TCP connection and HTTP session.
6e38a4a
     # 
6e38a4a
     # When this method is called with block, gives a HTTP object
6e38a4a
@@ -589,12 +585,7 @@ module Net   #:nodoc:
6e38a4a
         end
6e38a4a
         s.connect
6e38a4a
         if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
6e38a4a
-          begin
6e38a4a
-            s.post_connection_check(@address)
6e38a4a
-          rescue OpenSSL::SSL::SSLError => ex
6e38a4a
-            raise ex if @enable_post_connection_check
6e38a4a
-            warn ex.message
6e38a4a
-          end
6e38a4a
+          s.post_connection_check(@address)
6e38a4a
         end
6e38a4a
       end
6e38a4a
       on_connect
6e38a4a
diff -pruN ruby-1.8.6-p111.orig/lib/net/imap.rb ruby-1.8.6-p111/lib/net/imap.rb
6e38a4a
--- ruby-1.8.6-p111.orig/lib/net/imap.rb	2007-08-22 08:28:09.000000000 +0900
6e38a4a
+++ ruby-1.8.6-p111/lib/net/imap.rb	2007-10-29 21:14:38.000000000 +0900
6e38a4a
@@ -900,6 +900,7 @@ module Net
6e38a4a
         end
6e38a4a
         @sock = SSLSocket.new(@sock, context)
6e38a4a
         @sock.connect   # start ssl session.
6e38a4a
+        @sock.post_connection_check(@host) if verify
6e38a4a
       else
6e38a4a
         @usessl = false
6e38a4a
       end
6e38a4a
diff -pruN ruby-1.8.6-p111.orig/lib/open-uri.rb ruby-1.8.6-p111/lib/open-uri.rb
6e38a4a
--- ruby-1.8.6-p111.orig/lib/open-uri.rb	2007-09-24 17:12:24.000000000 +0900
6e38a4a
+++ ruby-1.8.6-p111/lib/open-uri.rb	2007-10-29 21:16:03.000000000 +0900
6e38a4a
@@ -229,7 +229,6 @@ module OpenURI
6e38a4a
     if target.class == URI::HTTPS
6e38a4a
       require 'net/https'
6e38a4a
       http.use_ssl = true
6e38a4a
-      http.enable_post_connection_check = true
6e38a4a
       http.verify_mode = OpenSSL::SSL::VERIFY_PEER
6e38a4a
       store = OpenSSL::X509::Store.new
6e38a4a
       store.set_default_paths