sftp bugs

James Henstridge james at jamesh.id.au
Wed Nov 30 10:37:14 GMT 2005


Jan Hudec wrote:

>On Wed, Nov 30, 2005 at 09:33:36 +0800, James Henstridge wrote:
>  
>
>>Matthieu Moy wrote:
>>    
>>
>>>[...]
>>>This is because _parse_url does a
>>>
>>>           # remove leading '/'
>>>           self._path = urllib.unquote(self._path[1:])
>>>
>>>(shouldn't this be a urllib.unquote(self._path.lstrip('/')) to remove
>>>multiple slashes?)
>>> 
>>>
>>>      
>>>
>>I think the URL handling fixes in the patch I posted yesterday should
>>fix this problem.
>>
>>Removing multiple slashes is not necessarily correct though, since the
>>SFTP URI spec is a bit weird: "sftp://localhost/tmp" refers to "~/tmp",
>>while "sftp://localhost/%2Ftmp" refers to "/tmp".
>>
>>It doesn't say how "sftp://localhost//tmp" should be interpreted
>>    
>>
>
>If I read it correctly, it said it's illegal.
>  
>
I'm not sure if that is illegal.  The sftp URI draft spec
(http://www.ietf.org/internet-drafts/draft-ietf-secsh-scp-sftp-ssh-uri-03.txt)
references RFC 3986, which states that the path component can not begin
with two slashes if there is no authority component.  SFTP URIs have a
path component, so that restriction doesn't appear to be valid.

Furthermore, the BNF in the RFC seems to allow the slash to remain
unescaped.

James.




More information about the bazaar mailing list