[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/FTP - CommonFTPActivityLogger.py:1.1.2.4 FTPServerChannel.py:1.1.2.20 IFTPCommandHandler.py:1.1.2.4 PublisherFTPServerChannel.py:1.1.2.2

Stephan Richter srichter@cbu.edu
Wed, 10 Apr 2002 05:30:58 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Server/FTP
In directory cvs.zope.org:/tmp/cvs-serv23463/lib/python/Zope/Server/FTP

Modified Files:
      Tag: Zope3-Server-Branch
	CommonFTPActivityLogger.py FTPServerChannel.py 
	IFTPCommandHandler.py PublisherFTPServerChannel.py 
Log Message:
Okay, it finally works! We have a Publisher FTP server again. All the basic
functionalitry is there, from dir listing, file transfer to security.

I punted for now on recognizing file endings, since Jim wants to write a 
proposal for that next week. Also, I did not solve the statistical file
information problem, since this takes some more research.


=== Zope3/lib/python/Zope/Server/FTP/CommonFTPActivityLogger.py 1.1.2.3 => 1.1.2.4 ===
         now = time.localtime(time.time())
 
-        print now
-        self.output.log('127.0.0.1', time.strftime('%Y/%m/%d %H:%M', now))
+        message = '%s [%s] "%s %s"' %(task.channel.username,
+                                      time.strftime('%Y/%m/%d %H:%M', now),
+                                      task.m_name[4:].upper(),
+                                      task.channel.cwd,
+                                      )
+        
+        self.output.log('127.0.0.1', message)


=== Zope3/lib/python/Zope/Server/FTP/FTPServerChannel.py 1.1.2.19 => 1.1.2.20 ===
     def cmd_mdtm(self, args):
         'See Zope.Server.FTP.IFTPCommandHandler.IFTPCommandHandler'
+        # We simply do not understand this non-standard extension to MDTM
+        if len(args.split()) > 1:
+            self.reply('ERR_ARGS')
+            return            
         path = self._generatePath(args)
         if not self._getFilesystem().isfile(path):
             self.reply('ERR_IS_NOT_FILE', path)
@@ -347,11 +351,11 @@
     def cmd_size(self, args):
         'See Zope.Server.FTP.IFTPCommandHandler.IFTPCommandHandler'
         path = self._generatePath(args)
-        if not self._getFilesystem().isfile(path):
+        fs = self._getFilesystem()
+        if not fs.isfile(path):
             self.reply('ERR_NO_FILE', path)
         else:
-            self.reply('FILE_SIZE', self.server.openFilesystem(
-                self.username).stat(path)[stat.ST_SIZE])
+            self.reply('FILE_SIZE', fs.stat(path)[stat.ST_SIZE])
 
 
     def cmd_stor(self, args, write_mode='w'):
@@ -371,7 +375,7 @@
             # Verify the file can be opened, but don't open it yet.
             # The actually write should be transactional without
             # holding up the application.
-            fs = self.server.openFilesystem(self.username)
+            fs = self._getFilesystem()
             fs.check_writable(path, mode)
         except OSError, err:
             self.reply('ERR_OPEN_WRITE', str(err))


=== Zope3/lib/python/Zope/Server/FTP/IFTPCommandHandler.py 1.1.2.3 => 1.1.2.4 ===
 
            Example output: 213 19960301204320
+
+           Geez, there seems to be a second syntax for this fiel, where one
+           can also set the modification time using:
+           MDTM datestring pathname
+
         """
 
     def cmd_mkd(args):


=== Zope3/lib/python/Zope/Server/FTP/PublisherFTPServerChannel.py 1.1.2.1 => 1.1.2.2 ===
 
     def authenticate(self):
-        # XXX We need to hook this up to the Zope security mechanism
-        return 1, 'All cool'
+        if self._getFilesystem()._authenticate():
+            return 1, 'User successfully authenticated.'
+        else:
+            return 0, 'User could not be authenticated.'