EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SBSftp.TElSftpClient.RenameFile Fails to Fail

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#16847
Posted: 06/27/2011 15:10:44
by Chris Rysdyk (Basic support level)
Joined: 06/27/2011
Posts: 3

I have a lot of code written around this project so I can't show it all.

However the area in question is fairly simple.

When I call:

Code
'Rename  the File
        If Not m_sFTPClient.RenameFile(strFileName, strNewFileName) Then
            Throw New Exception("Failed to Rename File.")
        End If


It always returns true whether it succeed or failed. Also the:

Code
Private Sub sFTPClient_OnSuccess(ByVal Sender As Object, ByVal Comment As String) Handles m_sFTPClient.OnSuccess


Always fires with a successful rename and the:

Code
Private Sub sFTPClient_OnError(ByVal Sender As Object, ByVal ErrorCode As Integer, ByVal Comment As String) Handles m_sFTPClient.OnError


Does not fire at all during the process.

How I test this is that I have a test username and password on an SFTP server of my own. I have permission to rename a file. I try the code it works perfectly. I then remove permissions for that user to rename the file and I rerun the code. The code behaves in exactly the same way. Return True and Success Event. However the file is left on the server unrenamed because it didn't have permission to do so.

According to the documentation:

"Description

Use this method to rename the file specified by OldPath to the NewPath. If the file was successfully renamed, the OnSuccess event is fired. The OnError event is fired otherwise."

This doesn't seem to be the case, has anyone else had this problem, is there a workaround, or maybe an update? I am running versions:

SecureBlackbox: 8.1.191.32852
SecureBlackbox.SFTP: 8.1.191.32852
SecureBlackbox.SFTPCommon: 8.1.191.32850
SecureBlackbox.SSHClient: 8.1.191.32845
SecureBlackbox.SSHCommon: 8.1.191.32842


Thanks,
Chris
#16849
Posted: 06/27/2011 15:45:25
by Eugene Mayevski (EldoS Corp.)

Thank you for detailed description of the problem. The error codes are returned (or not returned) by the server. In your case it's likely that the server reported the operation as successful while it was not. You can test the issue by trying to rename a non-existent file and see what happens.


Sincerely yours
Eugene Mayevski
#16850
Posted: 06/27/2011 15:47:53
by Chris Rysdyk (Basic support level)
Joined: 06/27/2011
Posts: 3

Highly possible, I've already thought of trying another SFTP server but sadly I can't find one I can use for testing so easy.

However let me try to rename a file that doesn't exist first.
#16858
Posted: 06/28/2011 07:30:37
by Chris Rysdyk (Basic support level)
Joined: 06/27/2011
Posts: 3

It was the server software. Thanks for the help.

Reply

Statistics

Topic viewed 728 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!