From: david-sarah Date: Sat, 15 May 2010 00:57:19 +0000 (-0700) Subject: Attempt to fix #1040 by making SFTPUser implement ISession. X-Git-Tag: trac-4400~30 X-Git-Url: https://git.rkrishnan.org/specifications/components/com_hotproperty/rgr-080307.php?a=commitdiff_plain;h=5ab4a376b7972a2678e68dbb8f13ca9ebcc8ff5a;p=tahoe-lafs%2Ftahoe-lafs.git Attempt to fix #1040 by making SFTPUser implement ISession. --- diff --git a/src/allmydata/frontends/sftpd.py b/src/allmydata/frontends/sftpd.py index b06f9606..e76a3709 100644 --- a/src/allmydata/frontends/sftpd.py +++ b/src/allmydata/frontends/sftpd.py @@ -12,7 +12,7 @@ from twisted.conch.ssh.filetransfer import FileTransferServer, SFTPError, \ FX_BAD_MESSAGE, FX_FAILURE from twisted.conch.ssh.filetransfer import FXF_READ, FXF_WRITE, FXF_APPEND, \ FXF_CREAT, FXF_TRUNC, FXF_EXCL -from twisted.conch.interfaces import ISFTPServer, ISFTPFile, IConchUser +from twisted.conch.interfaces import ISFTPServer, ISFTPFile, IConchUser, ISession from twisted.conch.avatar import ConchUser from twisted.conch.openssh_compat import primes from twisted.cred import portal @@ -1211,9 +1211,12 @@ class SFTPHandler(PrefixingLogMixin): return metadata -class SFTPUser(ConchUser): +class SFTPUser(ConchUser, PrefixingLogMixin): + implements(ISession) def __init__(self, check_abort, client, rootnode, username, convergence): ConchUser.__init__(self) + PrefixingLogMixin.__init__(self, facility="tahoe.sftp") + self.channelLookup["session"] = session.SSHSession self.subsystemLookup["sftp"] = FileTransferServer @@ -1223,6 +1226,28 @@ class SFTPUser(ConchUser): self.username = username self.convergence = convergence + def getPty(self, terminal, windowSize, attrs): + self.log(".getPty(%r, %r, %r)" % (terminal, windowSize, attrs), level=log.OPERATIONAL) + raise NotImplementedError + + def openShell(self, protocol): + self.log(".openShell(%r)" % (protocol,), level=log.OPERATIONAL) + raise NotImplementedError + + def execCommand(self, protocol, cmd): + self.log(".execCommand(%r, %r)" % (protocol, cmd), level=log.OPERATIONAL) + raise NotImplementedError + + def windowChanged(self, newWindowSize): + self.log(".windowChanged(%r)" % (newWindowSize,), level=log.OPERATIONAL) + + def eofReceived(): + self.log(".eofReceived()", level=log.OPERATIONAL) + + def closed(self): + self.log(".closed()", level=log.OPERATIONAL) + + # if you have an SFTPUser, and you want something that provides ISFTPServer, # then you get SFTPHandler(user) components.registerAdapter(SFTPHandler, SFTPUser, ISFTPServer)