From 981908a74b2ce22559eb64cf3c6cc3f488777a76 Mon Sep 17 00:00:00 2001 From: nick evans Date: Thu, 1 May 2025 09:58:34 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Use=20full=20namespace?= =?UTF-8?q?=20for=20`OpenSSL::SSL`=20constants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These worked because `Net::IMAP` included `OpenSSL::SSL`. But we're going to stop doing that. --- lib/net/imap.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/net/imap.rb b/lib/net/imap.rb index e418622c..0ee63eda 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -3782,7 +3782,7 @@ def coerce_search_array_arg_to_seqset?(obj) def build_ssl_ctx(ssl) if ssl params = (Hash.try_convert(ssl) || {}).freeze - context = SSLContext.new + context = OpenSSL::SSL::SSLContext.new context.set_params(params) if defined?(VerifyCallbackProc) context.verify_callback = VerifyCallbackProc @@ -3798,12 +3798,12 @@ def start_tls_session raise "SSL extension not installed" unless defined?(OpenSSL::SSL) raise "already using SSL" if @sock.kind_of?(OpenSSL::SSL::SSLSocket) raise "cannot start TLS without SSLContext" unless ssl_ctx - @sock = SSLSocket.new(@sock, ssl_ctx) + @sock = OpenSSL::SSL::SSLSocket.new(@sock, ssl_ctx) @reader = ResponseReader.new(self, @sock) @sock.sync_close = true @sock.hostname = @host if @sock.respond_to? :hostname= ssl_socket_connect(@sock, open_timeout) - if ssl_ctx.verify_mode != VERIFY_NONE + if ssl_ctx.verify_mode != OpenSSL::SSL::VERIFY_NONE @sock.post_connection_check(@host) @tls_verified = true end From 3bba1c00e6b7385f92e305856bbdf2e12c6c3c9c Mon Sep 17 00:00:00 2001 From: nick evans Date: Thu, 1 May 2025 10:49:35 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=A5=20Do=20not=20mixin=20`OpenSSL:?= =?UTF-8?q?:SSL`=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Net::IMAP` has mixed in `OpenSSL::SSL` since it first added TLS support. But that isn't very helpful, and it clutters up the namespace with irrelevant constants. I doubt anyone is actually _using_ OpenSSL constants from Net::IMAP. I hope not. Nevertheless, this is a breaking change. --- lib/net/imap.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 0ee63eda..28dbdb57 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -805,10 +805,6 @@ class IMAP < Protocol autoload :StringPrep, "#{dir}/stringprep" include MonitorMixin - if defined?(OpenSSL::SSL) - include OpenSSL - include SSL - end # :call-seq: # Net::IMAP::SequenceSet(set = nil) -> SequenceSet