cURL / Mailing Lists / curl-library / Single Mail

curl-library

Q. about LibCurl and SCP

From: Roger Tremblay <hollowman314159_at_yahoo.ca>
Date: Fri, 10 Feb 2012 13:14:01 -0800 (PST)

I have tried LibCurl on FTP, FTPS, SFTP. It worked all fine. But it failed with SCP everytime with every SCP server I've tried (CrushFTP5_PC.zip, SFTP-SCP-Server.msi,

PowerShellServer.exe, Fortress_x86.exe, install_JSCAPE MFT Server.exe, WinSSHD4-Inst.exe, CompleteFTPSetup.exe).

I though maybe I had not used the lib correctly. So I tried all these SCP servers again with the Curl utility (which must be doing the proper LibCurl calls for a successful

SCP transactions). Failed again (see at bottom).

Here are 2 log dumps from SCP server CompleteFTPSetup

Successfull upload with SCP client WinSCP:
...
2012-02-01 17:27:29,061 DEBUG WinSCPShell [3:zila] Shell command: 'scp -r -d -t "/"'
2012-02-01 17:27:29,061 DEBUG SCPServer [3:zila] SCP ready
2012-02-01 17:27:29,061 DEBUG SCPServer [3:zila] Command: scp -r -d -t /
2012-02-01 17:27:29,061 DEBUG SCPServer [3:zila] Name='/'
2012-02-01 17:27:29,077 DEBUG UserSession [3:zila] Change directory to '/'
2012-02-01 17:27:29,077 DEBUG SCPServer [3:zila] Change directory to '/'
2012-02-01 17:27:29,077 DEBUG SCPServer [3:zila] Sending ok
...

Failure with my own client based on libCurl:
...
2012-02-01 17:31:01,729 INFO SSHServerChannel [4:zila] Channel 0 : request exec
2012-02-01 17:31:01,729 DEBUG SSHServerChannel [4:zila] Channel 0: exec 'scp -t '/6BD823E5-8C52-4B82-8780-0C709898C56D-2361-OF.tiff'

??????????????????????????????????????????????????????????????????????????????????????????????????? '
2012-02-01 17:31:01,729 INFO SSHServerChannel [4:zila] Starting SCP
2012-02-01 17:31:01,729 DEBUG SSHServerChannel [4:zila] Channel 0: sent SSH_MSG_CHANNEL_SUCCESS
2012-02-01 17:31:01,729 DEBUG SCPServer [4:zila] SCP ready
2012-02-01 17:31:01,744 DEBUG SCPServer [4:zila] Command: scp -t '/6BD823E5-8C52-4B82-8780-0C709898C56D-2361-OF.tiff'

???????????????????????????????????????????????????????????????????????????????????????????????????
2012-02-01 17:31:01,744 DEBUG SCPServer [4:zila] Name=''/6BD823E5-8C52-4B82-8780-0C709898C56D-2361-OF.tiff'

??????????????????????????????????????????????????????????????????????????????????????????????????? '
2012-02-01 17:31:01,744 DEBUG PlugInManager [4:zila] Created plug-in WindowsFolder with class

EnterpriseDT.Net.FtpServer.FileSystem.Windows.FolderAdapter
2012-02-01 17:31:01,760 DEBUG WindowsAdapter [4:zila] Exception thrown while SYSTEM was accessing '/6BD823E5-8C52-4B82-8780-0C709898C56D-2361-

OF.tiff' ??????????????????????????????????????????????????????????????????????????????????????????????????? -

System.ArgumentException:Illegal characters in path.
2012-02-01 17:31:01,760 DEBUG UserSession [4:zila] Launching idle timeout (300000 ms): [4:zila]
2012-02-01 17:31:01,760 ERROR SFTPConnection [4:zila] Exception thrown in packet processing: Illegal characters in path.
EnterpriseDT.Net.FtpServer.Core.ServerErrorException: Illegal characters in path. --->System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.Combine(String path1, String path2)
at EnterpriseDT.Net.FtpServer.FileSystem.Windows.FolderAdapter.GetWindowsPath(ISession session, IFileSystemNode node, String virtualPath)
at EnterpriseDT.Net.FtpServer.FileSystem.Windows.WindowsAdapter.DirectoryExists(ISession session, IFileSystemNode node, String path)
--- End of inner exception stack trace ---
at EnterpriseDT.Net.FtpServer.FileSystem.Windows.WindowsAdapter.DirectoryExists(ISession session, IFileSystemNode node, String path)
at FMnTyHsOAw97ICdO1LK.WJ0a3nsQGJebLwP2kUK.XEoVLqHyRc(ISession )
at JQRFn5LtQG3ocICVl4m.K1pBbeL2x3ZTq1RrThg.I0eqa2llJSQ(String )
at JQRFn5LtQG3ocICVl4m.K1pBbeL2x3ZTq1RrThg.SAV0toSNcYo()
at QNIm6kDcrYcllMES4Ma.eUpgy4DVZYAlm3us9mT.Dprqo3eG2mm(PacketType , Int32 , SSH2DataReader )
at afhwPPL6PNAK1d70ZYd.GRGjduLENr5v05VpHDY.J01q54lFPcX(nS1acO9dtaXnUU9Wsf7 )
at afhwPPL6PNAK1d70ZYd.GRGjduLENr5v05VpHDY.PWS0tdKjN6Y(nS1acO9dtaXnUU9Wsf7 )
at fWcNbo9H5FmaOcxwvFt.gCaysf9rpOwBmFPiZeU.cwF0t7hmw5Z(Byte[] , Int32 , Int32 )
...

Notice there is something wierd with the url submited by LibCurl! The SCP command submitted by LibCurl is:
exec 'scp -t '/6BD823E5-8C52-4B82-8780-0C709898C56D-2361-OF.tiff'

??????????????????????????????????????????????????????????????????????????????????????????????????? '

What's with all these '?' characters? I specify to libCurl the url as a properly null-terminated "hardcoded" string:

curl_easy_setopt( m_CurlHandle, CURLOPT_URL, "scp://111.111.111.111//filename.tiff" ); // fictional IP ;-)

Since the string
'scp -t '/filename.tiff'
starts with a ', does the server expects the command string to end at the next ' (right before my file name)? Or does it concatenate the file name provided but then at the 3rd

', it concatenates everything else in this memory location until the last (4th) ' ? That would explain why there is garbage in this command line.

To reproduce this, install CompleteFTP, set it up to enable SCP. Build the Curl utility and run the following command

C:\tmp\curl-7.21.0\src\LIB-Debug>curl -T rc.write.1.tlog -u zila:qarules -v -k scp://111.111.111.111:22/rc.write.1.tlog

will generate the following log on the CompleteFTP server:

...
2012-02-10 00:27:20,601 DEBUG SSHServerChannel [12:zila] Channel 0: exec 'scp -t '/rc.write.1.tlog' ??????????????????????????????? '
2012-02-10 00:27:20,601 INFO SSHServerChannel [12:zila] Starting SCP
2012-02-10 00:27:20,601 DEBUG SSHServerChannel [12:zila] Channel 0: sent SSH_MSG_CHANNEL_SUCCESS
2012-02-10 00:27:20,601 DEBUG SCPServer [12:zila] SCP ready
2012-02-10 00:27:20,601 DEBUG SCPServer [12:zila] Command: scp -t '/rc.write.1.tlog' ???????????????????????????????
2012-02-10 00:27:20,601 DEBUG SCPServer [12:zila] Name=''/rc.write.1.tlog' ??????????????????????????????? '
2012-02-10 00:27:20,601 DEBUG PlugInManager [12:zila] Created plug-in WindowsFolder with class EnterpriseDT.Net.FtpServer.FileSystem.Windows.FolderAdapter
2012-02-10 00:27:20,601 DEBUG WindowsAdapter [12:zila] Exception thrown while SYSTEM was accessing '/rc.write.1.tlog' ??????????????????????????????? -

System.ArgumentException:Illegal characters in path.
2012-02-10 00:27:20,617 DEBUG UserSession [12:zila] Launching idle timeout (300000 ms): [12:zila]
2012-02-10 00:27:20,617 ERROR SFTPConnection [12:zila] Exception thrown in packet processing: Illegal characters in path.
EnterpriseDT.Net.FtpServer.Core.ServerErrorException: Illegal characters in path. ---> System.ArgumentException: Illegal characters in path.
...

Again same problem as with my own client using LibCurl to upload on SCP.

Any idea what's the problem?

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-02-10