Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not load deprecated SASL mechanisms by default #58

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,26 +380,31 @@ def starttls(options = {}, verify = true)
# the authentication mechanism to be used. Currently Net::IMAP
# supports the authentication mechanisms:
#
# LOGIN:: login using cleartext user and password.
# CRAM-MD5:: login with cleartext user and encrypted password
# (see [RFC-2195] for a full description). This
# mechanism requires that the server have the user's
# password stored in clear-text password.
#
# For both of these mechanisms, there should be two +args+: username
# and (cleartext) password. A server may not support one or the other
# of these mechanisms; check #capability for a capability of
# the form "AUTH=LOGIN" or "AUTH=CRAM-MD5".
#
# Authentication is done using the appropriate authenticator object:
# see +add_authenticator+ for more information on plugging in your own
# authenticator.
# PLAIN:: Login using cleartext user and password.
# See Net::IMAP::PlainAuthenticator.
#
# For example:
#
# imap.authenticate('LOGIN', user, password)
# imap.authenticate('PLAIN', user, password)
#
# A Net::IMAP::NoResponseError is raised if authentication fails.
#
# Servers may not support common mechanisms, clients MUST check #capability
# before calling #authenticate. Server capabilities, especially auth
# mechanismsn change after calling #starttls.
#
# Authentication is done using the appropriate authenticator object. Each
# mechanism can use different arguments; please consult the documentation
# for each specific mechanism. See +add_authenticator+ for more information
# on plugging in your own authenticator.
#
# <em>Several obsolete mechanisms are available, for historical reference
# purposes. They are not loaded by default, but can be used by requiring
# the appopriate file:</em>
#
# require "net/imap/authenticators/login"
# require "net/imap/authenticators/cram_md5"
# require "net/imap/authenticators/digest_md5"
def authenticate(auth_type, *args)
authenticator = self.class.authenticator(auth_type, *args)
send_command("AUTHENTICATE", auth_type) do |resp|
Expand Down
3 changes: 0 additions & 3 deletions lib/net/imap/authenticators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,4 @@ def authenticators

Net::IMAP.extend Net::IMAP::Authenticators

require_relative "authenticators/login"
require_relative "authenticators/plain"
require_relative "authenticators/cram_md5"
require_relative "authenticators/digest_md5"
4 changes: 2 additions & 2 deletions net-imap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "net-protocol"
spec.add_dependency "digest"
spec.add_dependency "strscan"
spec.add_development_dependency "digest"
spec.add_development_dependency "strscan"
Comment on lines +35 to +36
Copy link
Member

@eregon eregon Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure how gem dev deps are treated by Bundler, but I guess they are ignored if e.g. a app Gemfile depends on mail or net-imap?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are ignored with bundle install by default.

end