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

Allow case-insensitive strings for SASL mechanism #64

Merged
merged 1 commit into from
Oct 15, 2023
Merged
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
4 changes: 3 additions & 1 deletion lib/net/smtp/authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ def self.auth_classes
end

def self.auth_type(type)
type = type.to_s.upcase.tr(?_, ?-).to_sym
Authenticator.auth_classes[type] = self
end

def self.auth_class(type)
Authenticator.auth_classes[type.intern]
type = type.to_s.upcase.tr(?_, ?-).to_sym
Authenticator.auth_classes[type]
end

attr_reader :smtp
Expand Down
2 changes: 1 addition & 1 deletion test/net/smtp/test_smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def test_start_auth_cram_md5
omit "openssl or digest library not loaded" unless defined? OpenSSL or defined? Digest

port = fake_server_start(auth: 'CRAM-MD5')
Net::SMTP.start('localhost', port, user: 'account', password: 'password', authtype: :cram_md5){}
Net::SMTP.start('localhost', port, user: 'account', password: 'password', authtype: "CRAM-MD5"){}

port = fake_server_start(auth: 'CRAM-MD5')
assert_raise Net::SMTPAuthenticationError do
Expand Down