Skip to content

Commit

Permalink
🔒 Don't disconnect for AuthenticationCanceled [🚧 tests]
Browse files Browse the repository at this point in the history
This exception represents an intentional cancellation on the part of the
client's authenticator.  So the connection doesn't need to be dropped.
  • Loading branch information
nevans committed Oct 30, 2024
1 parent 5a0e5cb commit a4ce095
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/net/imap/sasl/authentication_exchange.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ def initialize(client, mechanism, authenticator, sasl_ir: true)

# Call #authenticate to execute an authentication exchange for #client
# using #authenticator. Authentication failures will raise an
# exception. Any exceptions other than those in RESPONSE_ERRORS will
# drop the connection.
# exception. Any exceptions other than AuthenticationCanceled or those
# in <tt>client.response_errors</tt> will drop the connection.
def authenticate
client.run_command(mechanism, initial_response) { process _1 }
.tap { raise AuthenticationIncomplete, _1 unless done? }
rescue *client.response_errors
rescue AuthenticationCanceled, *client.response_errors
raise # but don't drop the connection
rescue
client.drop_connection
Expand Down

0 comments on commit a4ce095

Please sign in to comment.