6.0.0-git
2021-01-18

[#6227] ssh2 implementation of VFS should quote whitespace pathnames with ssh2_exec
Summary ssh2 implementation of VFS should quote whitespace pathnames with ssh2_exec
Queue Horde Framework Packages
Queue Version HEAD
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester herde (at) tu-harburg (dot) de
Created 2008-02-07 (4729 days ago)
Due
Updated 2008-02-16 (4720 days ago)
Assigned 2008-02-09 (4727 days ago)
Resolved 2008-02-16 (4720 days ago)
Milestone
Patch No

History
2008-02-16 15:51:57 Jan Schneider Comment #8
State ⇒ Resolved
Reply to this comment
Fixed in CVS.
2008-02-12 10:35:49 herde (at) tu-harburg (dot) de Comment #7 Reply to this comment
This patch works for my installation



425c425

<                 $stream = @ssh2_exec($this->_stream, "ls -al $path");

---
                 $stream = @ssh2_exec($this->_stream, "ls -al 
".escapeshellarg($path));
428c428

<                 $stream = @ssh2_exec($this->_stream, "ls -l $path");

---
                 $stream = @ssh2_exec($this->_stream, "ls -l 
".escapeshellarg($path));
2008-02-11 12:36:02 herde (at) tu-harburg (dot) de Comment #6
New Attachment: debugging.png Download
Reply to this comment
i miss the graphics i tryed to attach. So here it is once mal a little 
smaler in size - i hope this will help
2008-02-11 10:16:57 herde (at) tu-harburg (dot) de Comment #5 Reply to this comment
one screenshot of a recent debugging session concerning VFS/ssh2.php 
shows the output of the error substream while trying to list the 
contents of a path named '/smb/rztmh/h/1b/rztmh/windows/My Documents'.
2008-02-09 09:55:38 Jan Schneider Comment #4
Assigned to Jan Schneider
State ⇒ Assigned
Reply to this comment
Works here.
2008-02-09 01:05:08 Michael Rubinsky Comment #3 Reply to this comment
Nope.  Building failed for me as well on two seperate boxes and a VM.


2008-02-08 19:25:10 Chuck Hagenbuch Comment #2
State ⇒ Feedback
Reply to this comment
I haven't been able to get the ssh2 extension to build on my dev boxes 
yet - do any other developers have it available to look at this?
2008-02-07 12:57:46 herde (at) tu-harburg (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ ssh2 implementation of VFS should quote whitespace pathnames with ssh2_exec
Queue ⇒ Horde Framework Packages
Reply to this comment
When we try to list the contents of an imported windows folder from a 
SSH2-Server (unix) and its pathname contains any whitespace characters 
we get an exhausted session memory and a blank page as result.



As far as i could figure out this is due to these lines of code:

VFS/ssh2.php Line 425 (ls -al) or 428 (ls -l)



$stream = @ssh2_exec($this->_stream, 'ls -al');



I wrote a little test script and looked onto the error substream which 
told me:



"No such file or directory: /path !"



if i try to execute a 'ls -l /path with whitespace'



if i do the same but quoting whitespace ('\ ') the code works fine  -

but it really should check for error messages and quote pathnames if 
nessessary ....



The exhausted session memory is produced afterwards when trying to 
read (blocked) from this stream and waiting for an EOF which results 
in an endless loop until the memory limit is reached.




Saved Queries