sFTP DirectoryExists() Method returning false even though the remote directory exists.

0

Hello Support,

We recently upgraded the UltimateFTP or ComponentPro tool to use version 6.4.40.60924 and facing few issues regarding checking if the directory exists on the server or not.

We are calling  Sftp.DirectoryExists("/TestFolder/SubFolder") statement to verify whether remote directory exists or not.

I tested with other clients like fileZilla to make sure that the folder exists. But executing the above statement returns false despite the existance of the directory.

Would the Componentpro sftp DirectoryExists() simply returns false if the FTP servers root directory and current working directory are different?

It used to work fine with version ComponentSoft 2.4 but its odd that it is failing with the latest version ComponentPro 6.4.

Please let me know what is the solution to this problem as this is causing lot of problems. The environment is secure so we cannot provide a test FTP user for you.

 

ONe more interesting thing i found between v2.4 and v6.4...

FTP server's root folder : "/"

FTP server's current directory set to: "sftp" folder

If i do sftp.ListDirectory() in v2.4 i get these results....

/sftp/FolderA

If i do sftp.ListDirectory() in upgraded v6.4 i get these results.....

sftp:/FolderA ----- ( wondeting wiy a colon is included in the path)

 

Thanks!

 

edited 12/2/2017 9:50:42 PM
asked 11/18/2016 9:02:57 PM
add a comment

7 Answers

0

Why in your early log the path was detected correctly as "/sftp" but in your later log, it was detected as "sftp:/". That later path is weird since we already trim all "/" characters when detecting that path. Did you modify that one in your log?

 

Our unit tests against VShell are always fine

 
answered 11/16/2017 12:41:37 AM
add a comment
0

v6.4 Log

Sftp: 1, Thread Id: 0 [11/22/2016 11:52:37.42] Information - Info: Connecting to xx.xx.xx.xx:22 - Sftp v6.4.40.60924 (Production version).

 [11/22/2016 11:52:37.68] Debug - Ssh: Server is 'SSH-2.0-VShell_3_8_6_476 VShell'.
 [11/22/2016 11:52:37.72] Information - Ssh: Negotiation started.
 [11/22/2016 11:52:37.82] Debug - Ssh: Group exchange.
 [11/22/2016 11:52:37.86] Debug - Ssh: Negotiating key.
 [11/22/2016 11:52:37.91] Debug - Ssh: Received 1024-bit Diffie-Hellman prime (minimum allowed size is 1024 bits).
 [11/22/2016 11:52:37.98] Debug - Ssh: Validating signature.
 [11/22/2016 11:52:38.20] Information - Ssh: Negotiation finished.
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.20] Information - Info: Server: SSH-2.0-VShell_3_8_6_476 VShell
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.20] Information - Info: Fingerprint: a9:09:4c:00:c9:28:b0:5c:14:5c:82:eb:1e:ed:c2:02
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.20] Information - Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS/SHA1, aes256-ctr/aes256-ctr, hmac-sha1/hmac-sha1
 [11/22/2016 11:52:38.31] Information - Info: Received banner: welcome.
 [11/22/2016 11:52:38.35] Debug - Ssh: Allowed authentication methods for 'username': publickey, password, gssapi-with-mic.
 [11/22/2016 11:52:38.36] Debug - Ssh: Trying password authentication for 'username'.
 [11/22/2016 11:52:38.40] Debug - Ssh: Authentication successful.
 [11/22/2016 11:52:38.46] Debug - Ssh: Requesting subsystem 'sftp'.
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.53] Information - Command: SSH_FXP_INIT Version: 4
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.58] Information - Response: SSH_FXP_VERSION v4 - 9 extensions)
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.58] Information - Info: Server with SFTP v4 - Windows-like Platform.
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.59] Information - Command: SSH_FXP_REALPATH Id: 1, Path: '.'
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.64] Information - Response: SSH_FXP_NAME Id: 1, 1 item
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:38.64] Information - Info: Detected working directory: 'sftp:/'.
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:41.58] Information - Command: SSH_FXP_STAT Id: 2, Path: '/sftp/My_new_folder/Sub_folder/Actual'
Sftp: 1, Thread Id: 0 [11/22/2016 11:52:41.62] Information - Response: SSH_FXP_STATUS Id: 2, Code: 10, Message: 'The system cannot find the path specified. '
 
================================================================================================
v2.0 Log
 
 
Sftp, Unique Id:1, Thread Id:0 Information: 1 : Connecting to xx.xx.xx.xx:22 through proxy NONE [UltimateSftp v2.0.519.2200 (Production Version)]., Info, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : Server: SSH-2.0-VShell_3_8_6_476 VShell, Host key: a9:09:4c:00:c9:28:b0:5c:14:5c:82:eb:1e:ed:c2:02 - Key exchange algorithm: DiffieHellmanGroupExchangeSha1, Host key algorithm: dss, no zlib, Info, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : SSH_FXP_INIT, Version:4, Command, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : SSH_FXP_VERSION, Version:3, 8 extensions, Response, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : Connected to SFTP version 3 server., Info, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Verbose: 1 : OS: , Info, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : SSH_FXP_REALPATH, Path:'.', Id:1, Command, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : SSH_FXP_NAME, 1 item, Id:1, Response, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : Current directory: "/sftp", Info, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : SSH_FXP_STAT, Path:'/sftp/My_new_folder/Sub_folder/Actual', Id:2, Command, Sftp, Unique Id:1, Thread Id:0
Sftp, Unique Id:1, Thread Id:0 Information: 1 : SSH_FXP_ATTRS, Id:2, Response, Sftp, Unique Id:1, Thread Id:0
 
 
=================
 
You might want to look at the current working directory returned by both the versions

 

 
answered 11/16/2017 12:41:37 AM
add a comment
0

I have masked only the IP address in the log.. Other than that its exactly what was generated by Ultimate FTP.

I was hoping you might have an answer about why the Current working directory detected as 'SFTP:/'

 

would Ultimate sftp work differently if...

1. Folder name/ working directory is 'sftp'?

2. Root folder and default working directory are different?

I was wondering how the old version could recognize the current working directory correctly but not in the new version of UltimateFTP

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Hello,

Please add the following code snippet to the beginning of your app and send us the log file:

[code lang='c#']

// Set log level.
ComponentPro.Diagnostics.XTrace.Level = ComponentPro.Diagnostics.TraceEventType.Verbose;
// By default the AutoFlush property is true.
// If you wish to turn it off, just set it to false as follows:
// ComponentPro.Diagnostics.XTrace.AutoFlush = false;
// Add the UltimateTextWriterTraceListener listener to write to a file.
ComponentPro.Diagnostics.XTrace.Listeners.Add(
 new ComponentPro.Diagnostics.UltimateTextWriterTraceListener("c:\\temp\\log.log"));
// You can also write log to Console window with the following code:
ComponentPro.Diagnostics.XTrace.Listeners.Add(new ComponentPro.Diagnostics.UltimateConsoleTraceListener());

[/code]

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Hello,

Please send us the log files generated by both v2.4 and v6.4

Thanks,

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Will provide it.. appreciate your reply

 
answered 11/16/2017 12:41:37 AM
add a comment
0

Here are the log files.

Log using Version v6.4 (Runtime v4.0):

CMD>       SSH_FXP_INIT Version: 4
RESPONSE>  SSH_FXP_VERSION v4 - 9 extensions)
CMD>       SSH_FXP_REALPATH Id: 1, Path: '.'
RESPONSE>  SSH_FXP_NAME Id: 1, 1 item
CMD>       SSH_FXP_STAT Id: 2, Path: '/sftp/My_new_folder/Sub_folder/Actual'
RESPONSE>  SSH_FXP_STATUS Id: 2, Code: 10, Message: 'The system cannot find the path specified. '
 
------------------------------------------------------------------------------------------------------

Log using Version v2.0 (Runtime v2.0):

CMD>       SSH_FXP_INIT, Version:4
RESPONSE>  SSH_FXP_VERSION, Version:3, 8 extensions
CMD>       SSH_FXP_REALPATH, Path:'.', Id:1
RESPONSE>  SSH_FXP_NAME, 1 item, Id:1
CMD>       SSH_FXP_STAT, Path:'/sftp/My_new_folder/Sub_folder/Actual', Id:2
RESPONSE>  SSH_FXP_ATTRS, Id:2
 
 
As you can see, when I used the old version of Ultimate sFTP the folder path is recognized by DirectoryExists() method, but when i switch back to new v6.4 DirectoryExists() method is unable to identify the folder
 
PLease let me know if this there is a bug on your end
 
answered 11/16/2017 12:41:37 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged ftp sftp or ask your own question.