[Zope-CVS] CVS: Packages/SFTPGateway/src/sftpgateway - application.py:1.11 connector.py:1.29

Fred L. Drake, Jr. fred at zope.com
Sun Dec 21 10:47:00 EST 2003


Update of /cvs-repository/Packages/SFTPGateway/src/sftpgateway
In directory cvs.zope.org:/tmp/cvs-serv7429

Modified Files:
	application.py connector.py 
Log Message:
when connections are dropped from the SFTP client, log the event and
close the FTP connection


=== Packages/SFTPGateway/src/sftpgateway/application.py 1.10 => 1.11 ===
--- Packages/SFTPGateway/src/sftpgateway/application.py:1.10	Wed Dec 17 14:17:27 2003
+++ Packages/SFTPGateway/src/sftpgateway/application.py	Sun Dec 21 10:46:59 2003
@@ -95,10 +95,10 @@
     def getChannel(self, channelType, windowSize, maxPacket, data):
         if channelType == 'session':
             return SFTPSession(
-                    app=self._app,
-                    remoteWindow=windowSize, 
-                    remoteMaxPacket=maxPacket,
-                    conn=self)
+                app=self._app,
+                remoteWindow=windowSize, 
+                remoteMaxPacket=maxPacket,
+                conn=self)
         return 0
 
 
@@ -126,14 +126,22 @@
 
     def __init__(self, app, *args, **kw):
         self._app = app
+        self._sftp = None
         session.SSHSession.__init__(self, *args, **kw)
 
+    def closed(self):
+        if self._sftp is not None:
+            self._sftp.connectionLost()
+            self._sftp = None
+        session.SSHSession.closed(self)
+
     def subsystem_sftp(self):
         avatar = self.conn.transport.authenticatedUser
         logger = self._app.get_child_logger(avatar.username)
         app = ApplicationProxy(self._app, logger)
         ft = connector.FTPConnector(app, avatar)
         ft.makeConnection(self)
+        self._sftp = ft
         return ft
 
 


=== Packages/SFTPGateway/src/sftpgateway/connector.py 1.28 => 1.29 ===
--- Packages/SFTPGateway/src/sftpgateway/connector.py:1.28	Thu Dec 18 14:51:18 2003
+++ Packages/SFTPGateway/src/sftpgateway/connector.py	Sun Dec 21 10:46:59 2003
@@ -112,14 +112,11 @@
         return error
 
     def connectionLost(self, reason=protocol.connectionDone):
-        # XXX this doesn't appear to be called; don't know why
         self._app.info("connection lost")
-        ftpClient = self._client
-        if ftpClient:
+        if self._client is not None:
+            ftpClient = self._client
             self._client = None
-            # Need to make sure this deferred is handled.
-            d = self._queueCommand(ftpClient, "QUIT")
-            d.addCallback(lambda ftpClient=ftpClient: ftpClient.close())
+            ftpClient.quit()
         filetransfer.FileTransferServer.connectionLost(self, reason)
 
     def openFile(self, path, flags, attrs):




More information about the Zope-CVS mailing list