Attempt to fix #1040 by making SFTPUser implement ISession.
authordavid-sarah <david-sarah@jacaranda.org>
Sat, 15 May 2010 00:57:19 +0000 (17:57 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Sat, 15 May 2010 00:57:19 +0000 (17:57 -0700)
src/allmydata/frontends/sftpd.py

index b06f9606fcc3dc222191a32f807fb38cceedcdb1..e76a37096dfe8c9121facb4113b30769d73ec1a4 100644 (file)
@@ -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)