Rename doAuthenticate* functions to not conflict with callback names.

This commit is contained in:
Valentin Lorentz 2020-01-23 14:24:41 +01:00
parent 32d8d141ad
commit c4d073a9be

View File

@ -1143,7 +1143,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
mechanism = self.sasl_current_mechanism mechanism = self.sasl_current_mechanism
if mechanism == 'ecdsa-nist256p-challenge': if mechanism == 'ecdsa-nist256p-challenge':
self.doAuthenticateEcdsa(string) self._doAuthenticateEcdsa(string)
elif mechanism == 'external': elif mechanism == 'external':
self.sendSaslString(b'') self.sendSaslString(b'')
elif mechanism.startswith('scram-'): elif mechanism.startswith('scram-'):
@ -1152,15 +1152,15 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
if step == 'uninitialized': if step == 'uninitialized':
log.debug('%s: starting SCRAM.', log.debug('%s: starting SCRAM.',
self.network) self.network)
self.doAuthenticateScramFirst(mechanism) self._doAuthenticateScramFirst(mechanism)
elif step == 'first-sent': elif step == 'first-sent':
log.debug('%s: received SCRAM challenge.', log.debug('%s: received SCRAM challenge.',
self.network) self.network)
self.doAuthenticateScramChallenge(string) self._doAuthenticateScramChallenge(string)
elif step == 'final-sent': elif step == 'final-sent':
log.debug('%s: finishing SCRAM.', log.debug('%s: finishing SCRAM.',
self.network) self.network)
self.doAuthenticateScramFinish(string) self._doAuthenticateScramFinish(string)
else: else:
assert False assert False
except scram.ScramException: except scram.ScramException:
@ -1175,7 +1175,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
]) ])
self.sendSaslString(authstring) self.sendSaslString(authstring)
def doAuthenticateEcdsa(self, string): def _doAuthenticateEcdsa(self, string):
if string == b'': if string == b'':
self.sendSaslString(self.sasl_username.encode('utf-8')) self.sendSaslString(self.sasl_username.encode('utf-8'))
return return
@ -1192,7 +1192,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
args=('*',))) args=('*',)))
self.tryNextSaslMechanism() self.tryNextSaslMechanism()
def doAuthenticateScramFirst(self, mechanism): def _doAuthenticateScramFirst(self, mechanism):
"""Handle sending the client-first message of SCRAM auth.""" """Handle sending the client-first message of SCRAM auth."""
hash_name = mechanism[len('scram-'):] hash_name = mechanism[len('scram-'):]
if hash_name.endswith('-plus'): if hash_name.endswith('-plus'):
@ -1213,13 +1213,13 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
self.sendSaslString(client_first) self.sendSaslString(client_first)
self.sasl_scram_state['step'] = 'first-sent' self.sasl_scram_state['step'] = 'first-sent'
def doAuthenticateScramChallenge(self, challenge): def _doAuthenticateScramChallenge(self, challenge):
client_final = self.sasl_scram_state['authenticator'] \ client_final = self.sasl_scram_state['authenticator'] \
.challenge(challenge) .challenge(challenge)
self.sendSaslString(client_final) self.sendSaslString(client_final)
self.sasl_scram_state['step'] = 'final-sent' self.sasl_scram_state['step'] = 'final-sent'
def doAuthenticateScramFinish(self, data): def _doAuthenticateScramFinish(self, data):
try: try:
res = self.sasl_scram_state['authenticator'] \ res = self.sasl_scram_state['authenticator'] \
.finish(data) .finish(data)