Skip to content

Commit

Permalink
fixup check_auth_args
Browse files Browse the repository at this point in the history
  • Loading branch information
nevans committed Oct 14, 2023
1 parent d552060 commit 333b5f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/net/smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,9 @@ def tcp_socket(address, port)

def do_start(helo_domain, user, secret, authtype, **auth)
raise IOError, 'SMTP session already started' if @started
check_auth_args(authtype, user, secret, **auth)
if user || secret || authtype || auth.any?
check_auth_args(authtype, user, secret, **auth)
end
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) do
tcp_socket(@address, @port)
end
Expand Down Expand Up @@ -946,8 +948,8 @@ def auth(authtype = DEFAULT_AUTH_TYPE, *args, **kwargs, &block)

private

def check_auth_args(type_arg = nil, *args, type: nil, **kwargs)
return unless type_arg || type || args.any? || kwargs.any?
def check_auth_args(type_arg = nil, *args,
type: nil, user: nil, **kwargs)
type ||= type_arg || DEFAULT_AUTH_TYPE
kwargs[:username] ||= user if user
if (klass = Authenticator.auth_class(type))
Expand Down

0 comments on commit 333b5f5

Please sign in to comment.