Skip to content

Commit c54d225

Browse files
committed
squash cancel authenticate
1 parent 3b3f8ae commit c54d225

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/net/imap.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,11 +1343,19 @@ def authenticate(mechanism, *creds,
13431343
response = authenticator.process(nil)
13441344
cmdargs << (response.empty? ? "=" : [response].pack("m0"))
13451345
end
1346+
process_error = nil
13461347
result = send_command_with_continuations(*cmdargs) {|data|
1347-
challenge = data.unpack1("m")
1348-
response = authenticator.process challenge
1349-
[response].pack("m0")
1348+
unless process_error
1349+
challenge = data.unpack1("m")
1350+
response = begin
1351+
authenticator.process challenge
1352+
rescue => ex
1353+
process_error = ex
1354+
end
1355+
end
1356+
process_error ? "*" : [response].pack("m0")
13501357
}
1358+
raise process_error if process_error
13511359
if authenticator.respond_to?(:done?) && !authenticator.done?
13521360
logout!
13531361
raise SASL::AuthenticationIncomplete, result

0 commit comments

Comments
 (0)