Skip to content

Commit 0507647

Browse files
committed
🚨 SASL: add_authenticator warns on reassignment [🚧WIP: no test]
1 parent 24d5887 commit 0507647

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/net/imap/authenticators.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ module Net::IMAP::Authenticators
1515
# The authenticator session must respond to +#process+, receiving the server's
1616
# challenge and returning the client's response. See PlainAuthenticator,
1717
# XOauth2Authenticator, DigestMD5Authenticator, etc for examples.
18-
def add_authenticator(auth_type, authenticator)
19-
authenticators[auth_type] = authenticator
18+
def add_authenticator(mechanism, authenticator)
19+
if (original = authenticators[mechanism])
20+
warn("%p: replacing %p authenticator: %p" % [ self, mechanism, original],
21+
uplevel: 1)
22+
end
23+
authenticators[mechanism] = authenticator
2024
end
2125

2226
# :call-seq:

0 commit comments

Comments
 (0)