From: Mariusz Mazur Date: Mon, 10 Jan 2005 19:08:53 +0000 (+0000) Subject: - 'public' (from www iface) connections must try to log in before doing X-Git-Url: https://git.pld-linux.org/?p=projects%2Fpld-ftp-admin.git;a=commitdiff_plain;h=5fcf3f9adfa6fdce0a03037cbc5105cda8e797fa - 'public' (from www iface) connections must try to log in before doing anything else, or they will be terminated Changed files: ftpiod/ftpiod.py -> 1.3 modules/cmds.py -> 1.4 modules/cons.py -> 1.3 --- diff --git a/ftpiod/ftpiod.py b/ftpiod/ftpiod.py index 5411cfb..1726904 100755 --- a/ftpiod/ftpiod.py +++ b/ftpiod/ftpiod.py @@ -27,10 +27,10 @@ while True: for readable in cons.readables(): if readable==cons.privlistener: newsock,addr=readable.accept() - cons.add(cons.Connection(newsock, False)) + cons.add(cons.Connection(newsock, True)) elif readable==cons.publistener: newsock,addr=readable.accept() - cons.add(cons.Connection(newsock, True)) + cons.add(cons.Connection(newsock, False)) else: readable.handleinput() diff --git a/modules/cmds.py b/modules/cmds.py index 46bb55b..e58d3fb 100644 --- a/modules/cmds.py +++ b/modules/cmds.py @@ -3,7 +3,7 @@ import os import time -CmdError="CmdError" +BailOut="BailOut" def parse(con): if '\0' not in con.data: @@ -13,10 +13,13 @@ def parse(con): for cmd in cmds: con.data=con.data[len(cmd)+1:] cmdname=cmd[:4] + if not con.authorized and not (cmdname=='linp' or cmdname=='linc'): + raise BailOut + # TODO: log unauthorized access if cmdname in cmdlist: cmdlist[cmdname](con, cmd[5:]) else: - raise CmdError + raise BailOut # TODO: log this locks={} diff --git a/modules/cons.py b/modules/cons.py index f7b1159..6fc02f2 100644 --- a/modules/cons.py +++ b/modules/cons.py @@ -25,7 +25,7 @@ class Connection: self.data=self.data+newdata try: cmds.parse(self) - except cmds.CmdError: + except cmds.BailOut: self.destroy() def add(con):