Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@syntax("AUTH mechanism [initial-response]")
async def smtp_AUTH(self, arg):
if not arg:
await self.push('500 Not enough values')
return
args = arg.split()
if len(args) > 2:
await self.push('500 Too many values')
return
mechanism = args[0]
if mechanism == 'PLAIN':
if len(args) == 1:
await self.push('334 ') # wait for client login/password
line = await self.readline()
if not line:
return
blob = line.strip()
@syntax('LHLO hostname')
async def smtp_LHLO(self, arg):
"""The LMTP greeting, used instead of HELO/EHLO."""
await super().smtp_HELO(arg)
self.show_smtp_greeting = False
@syntax('QUIT')
async def smtp_QUIT(self, arg):
if arg:
await self.push('501 Syntax: QUIT')
else:
status = await self._call_handler_hook('QUIT')
await self.push('221 Bye' if status is MISSING else status)
self.stop()
@syntax('EHLO hostname')
async def smtp_EHLO(self, hostname):
if not hostname:
await self.push('501 Syntax: EHLO hostname')
return
self._set_rset_state()
await self.push('250-{0} Hello {1}'.format(self.hostname, hostname))
await self.push('250-AUTH PLAIN LOGIN CRAM-MD5')
await self.push('250 EHLO')