Commit 18286c63 authored by Andreas Jung's avatar Andreas Jung

FTPServer:

A RNFR (rename from) request was always responded
with a response 350 (succesful). We do now check if the 
source file really exists and return a 550 response in case
if it doest not.
parent 1a34d528
......@@ -26,6 +26,9 @@ Zope Changes
Features added
- FTPServer: a RNFR (rename from) request is now being responded
with a 550 error code if the source file does not exist
- Fixed ObjectManager to not swallow exceptions during object
deletion (in debug mode and if the user is not Manager). This
allows for better debugging, while still keeping the possibility
......
......@@ -644,6 +644,13 @@ class ObjectManager(
out=out+((k,stat),)
return marshal.dumps(out)
def manage_hasId(self, REQUEST):
""" check if the folder has an object with REQUEST['id'] """
if not REQUEST['id'] in self.objectIds():
raise KeyError(REQUEST['id'])
def manage_FTPstat(self,REQUEST):
"Psuedo stat used for FTP listings"
mode=0040000
......
......@@ -98,6 +98,11 @@ class FTPRequest(HTTPRequest):
path, 'manage_addFolder')
env['QUERY_STRING']='id=%s' % args[0]
elif command=='RNFR':
env['PATH_INFO']=self._join_paths(channel.path,
path, 'manage_hasId')
env['QUERY_STRING']='id=%s' % (args[0])
elif command=='RNTO':
env['PATH_INFO']=self._join_paths(channel.path,
path, 'manage_renameObject')
......
......@@ -384,7 +384,17 @@ class zope_ftp_channel(ftp_channel):
self.command_not_understood (' '.join(line))
else:
self.fromfile = line[1]
self.respond ('350 RNFR command successful.')
pathf,idf=os.path.split(self.fromfile)
response=make_response(self, self.rnfr_completion)
request=FTPRequest(pathf,('RNFR',idf),self,response)
handle(self.module,request,response)
def rnfr_completion(self,response):
status=response.getStatus()
if status==200:
self.respond ('250 RNTO command successful.')
else:
self.respond ('550 %s: no such file or directory.' % self.fromfile)
def cmd_rnto (self, line):
if len (line) != 2:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment