def found_terminator(self):
line = self.in_buffer
if not len(line):
return
sp = string.find(line, ' ')
if sp != -1:
line = [line[:sp], line[sp + 1:]]
else:
line = [line]
command = string.lower(line[0])
# watch especially for 'urgent' abort commands.
if string.find(command, 'abor') != -1:
# strip off telnet sync chars and the like...
while command and command[0] not in string.letters:
command = command[1:]
fun_name = 'cmd_%s' % command
if command != 'pass':
self.log('<== %s' % repr(self.in_buffer)[1:-1])
else:
self.log('<== %s' % line[0] + ' <password>')
self.in_buffer = ''
if not hasattr(self, fun_name):
self.command_not_understood(line[0])
return
fun = getattr(self, fun_name)
if (not self.authorized) and (command not in (
'user', 'pass', 'help', 'quit')):
self.respond('530 Please log in with USER and PASS')
elif (not self.check_command_authorization(command)):
self.command_not_authorized(command)
else:
try:
fun(line)
except Exception:
self.server.total_exceptions.increment()
(file, fun, line), t, v, tbinfo = asyncore.compact_traceback()
if self.client_dc:
try:
self.client_dc.close()
except Exception:
pass
self.respond(
'451 Server Error: %s, %s: file: %s line: %s' % (
t, v, file, line,
)
)
评论列表
文章目录