Example #1
0
    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))
            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"))
            privkey_file = from_utf8_or_none(self.get_config("sftpd", "host_privkey_file"))

            from allmydata.frontends import sftpd

            s = sftpd.SFTPServer(self, accountfile, accounturl, sftp_portstr, pubkey_file, privkey_file)
            s.setServiceParent(self)
Example #2
0
    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))
            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"))
            privkey_file = from_utf8_or_none(self.get_config("sftpd", "host_privkey_file"))

            from allmydata.frontends import sftpd
            s = sftpd.SFTPServer(self, accountfile, accounturl,
                                 sftp_portstr, pubkey_file, privkey_file)
            s.setServiceParent(self)
Example #3
0
    def init_ftp_server(self):
        if self.config.get_config("ftpd", "enabled", False, boolean=True):
            accountfile = from_utf8_or_none(
                self.config.get_config("ftpd", "accounts.file", None))
            if accountfile:
                accountfile = self.config.get_config_path(accountfile)
            accounturl = self.config.get_config("ftpd", "accounts.url", None)
            ftp_portstr = self.config.get_config("ftpd", "port", "8021")

            from allmydata.frontends import ftpd
            s = ftpd.FTPServer(self, accountfile, accounturl, ftp_portstr)
            s.setServiceParent(self)
Example #4
0
    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))
            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")

            from allmydata.frontends import ftpd
            s = ftpd.FTPServer(self, accountfile, accounturl, ftp_portstr)
            s.setServiceParent(self)
Example #5
0
 def test_from_utf8_or_none(self):
     self.failUnlessRaises(AssertionError, from_utf8_or_none, u"foo")
     self.failUnlessReallyEqual(from_utf8_or_none("lumi\xc3\xa8re"),
                                u"lumi\u00E8re")
     self.failUnlessReallyEqual(from_utf8_or_none(None), None)
     self.failUnlessRaises(UnicodeDecodeError, from_utf8_or_none, "\xFF")
 def test_from_utf8_or_none(self):
     self.failUnlessRaises(AssertionError, from_utf8_or_none, u"foo")
     self.failUnlessReallyEqual(from_utf8_or_none("lumi\xc3\xa8re"), u"lumi\u00E8re")
     self.failUnlessReallyEqual(from_utf8_or_none(None), None)
     self.failUnlessRaises(UnicodeDecodeError, from_utf8_or_none, "\xFF")