ftp server: initial implementation. Still needs unit tests, custom Twisted patches. For #512

This commit is contained in:
Brian Warner
2008-10-06 12:52:36 -07:00
parent 934dc6aa77
commit bc237b3956
5 changed files with 472 additions and 2 deletions

View File

@ -78,6 +78,7 @@ class Client(node.Node, testutil.PollMixin):
if key_gen_furl:
self.init_key_gen(key_gen_furl)
# ControlServer and Helper are attached after Tub startup
self.init_ftp_server()
hotline_file = os.path.join(self.basedir,
self.SUICIDE_PREVENTION_HOTLINE_FILE)
@ -253,6 +254,17 @@ class Client(node.Node, testutil.PollMixin):
ws = WebishServer(webport, nodeurl_path)
self.add_service(ws)
def init_ftp_server(self):
if not self.get_config("ftpd", "enabled", False, boolean=True):
return
portstr = self.get_config("ftpd", "ftp.port", "8021")
accountfile = self.get_config("ftpd", "ftp.accounts.file", None)
accounturl = self.get_config("ftpd", "ftp.accounts.url", None)
from allmydata import ftpd
s = ftpd.FTPServer(self, portstr, accountfile, accounturl)
s.setServiceParent(self)
def _check_hotline(self, hotline_file):
if os.path.exists(hotline_file):
mtime = os.stat(hotline_file)[stat.ST_MTIME]