[Zope-Checkins] CVS: Zope/lib/python/ZServer - FTPServer.py:1.28
Chris McDonough
chrism at zope.com
Fri Sep 26 12:13:59 EDT 2003
Update of /cvs-repository/Zope/lib/python/ZServer
In directory cvs.zope.org:/tmp/cvs-serv9777
Modified Files:
FTPServer.py
Log Message:
Deal with 403 response codes the same as 401 response codes.
Dont attempt to get a message from the FTPResponse object and show it in the message response (it could be HTML and could contain newlines).
=== Zope/lib/python/ZServer/FTPServer.py 1.27 => 1.28 ===
--- Zope/lib/python/ZServer/FTPServer.py:1.27 Wed Jul 9 12:25:26 2003
+++ Zope/lib/python/ZServer/FTPServer.py Fri Sep 26 12:13:59 2003
@@ -195,7 +195,7 @@
self.type_map[self.current_mode]
)
)
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 Could not list directory.')
@@ -223,7 +223,7 @@
# longer anonymous
if self.anonymous and not self.userid=='anonymous':
self.anonymous=None
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 No such directory.')
@@ -264,7 +264,7 @@
mtime[4],
mtime[5]
))
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 Error getting file modification time.')
@@ -282,8 +282,10 @@
status=response.getStatus()
if status==200:
self.respond('213 %d'% response._marshalledBody()[stat.ST_SIZE])
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
+ elif status == 404:
+ self.respond('550 No such file or directory.')
else:
self.respond('550 Error getting file size.')
@@ -317,7 +319,7 @@
self.type_map[self.current_mode],
file
))
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 Error opening file.')
@@ -353,17 +355,13 @@
def stor_completion(self,response):
status=response.getStatus()
- message = response.getMessage()
- if status in (200,201,204,302):
- self.client_dc.channel.respond('226 ' + (
- message or 'Transfer complete.'))
- elif status==401:
- self.client_dc.channel.respond('426 ' + (
- message or 'Unauthorized.'))
+ if status in (200, 201, 204, 302):
+ self.client_dc.channel.respond('226 Transfer complete.')
+ elif status in (401, 403):
+ self.client_dc.channel.respond('553 Permission denied on server.')
else:
- self.client_dc.channel.respond('426 ' + (
- message or 'Error creating file.'))
+ self.client_dc.channel.respond('426 Error creating file.')
self.client_dc.close()
def cmd_rnfr (self, line):
@@ -404,7 +402,7 @@
status=response.getStatus()
if status==200 and response.body.find('Not Deletable')==-1:
self.respond('250 DELE command successful.')
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 Error deleting file.')
@@ -424,7 +422,7 @@
status=response.getStatus()
if status==200:
self.respond('257 MKD command successful.')
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 Error creating directory.')
@@ -446,7 +444,7 @@
status=response.getStatus()
if status==200 and response.body.find('Not Deletable')==-1:
self.respond('250 RMD command successful.')
- elif status==401:
+ elif status in (401, 403):
self.respond('530 Unauthorized.')
else:
self.respond('550 Error removing directory.')
More information about the Zope-Checkins
mailing list