mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-18 23:38:18 +00:00
Add a test, add missing imports. refs #2388
This tests ftpd, but not sftpd. Doing this sort of test on sftpd requires the creation of a valid pubkey/privkey file pair, which is more work than I want to do right now. init_ftp/init_sftp were changed to interpret the configured accounts.file as relative to the node's basedir, with abspath_expanduser_unicode(accountfile, base=self.basedir). This would happen naturally in a real node, since it os.chdir()s to the basedir before doing anything. But tests don't do that. Author: Brian Warner <warner@lothar.com> Author: Daira Hopwood <daira@jacaranda.org> Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
@ -15,7 +15,8 @@ from allmydata.immutable.offloaded import Helper
|
||||
from allmydata.control import ControlServer
|
||||
from allmydata.introducer.client import IntroducerClient
|
||||
from allmydata.util import hashutil, base32, pollmixin, log, keyutil, idlib
|
||||
from allmydata.util.encodingutil import get_filesystem_encoding
|
||||
from allmydata.util.encodingutil import get_filesystem_encoding, \
|
||||
from_utf8_or_none
|
||||
from allmydata.util.fileutil import abspath_expanduser_unicode
|
||||
from allmydata.util.abbreviate import parse_abbreviated_size
|
||||
from allmydata.util.time_format import parse_duration, parse_date
|
||||
@ -458,7 +459,10 @@ class Client(node.Node, pollmixin.PollMixin):
|
||||
|
||||
def init_ftp_server(self):
|
||||
if self.get_config("ftpd", "enabled", False, boolean=True):
|
||||
accountfile = from_utf8_or_none(self.get_config("ftpd", "accounts.file", None))
|
||||
accountfile = from_utf8_or_none(
|
||||
self.get_config("ftpd", "accounts.file", None))
|
||||
if accountfile:
|
||||
accountfile = abspath_expanduser_unicode(accountfile, base=self.basedir)
|
||||
accounturl = self.get_config("ftpd", "accounts.url", None)
|
||||
ftp_portstr = self.get_config("ftpd", "port", "8021")
|
||||
|
||||
@ -468,7 +472,10 @@ class Client(node.Node, pollmixin.PollMixin):
|
||||
|
||||
def init_sftp_server(self):
|
||||
if self.get_config("sftpd", "enabled", False, boolean=True):
|
||||
accountfile = from_utf8_or_none(self.get_config("sftpd", "accounts.file", None))
|
||||
accountfile = from_utf8_or_none(
|
||||
self.get_config("sftpd", "accounts.file", None))
|
||||
if accountfile:
|
||||
accountfile = abspath_expanduser_unicode(accountfile, base=self.basedir)
|
||||
accounturl = self.get_config("sftpd", "accounts.url", None)
|
||||
sftp_portstr = self.get_config("sftpd", "port", "8022")
|
||||
pubkey_file = from_utf8_or_none(self.get_config("sftpd", "host_pubkey_file"))
|
||||
|
Reference in New Issue
Block a user