EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElZipReader cannot unzip to UNC path?

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#30335
Posted: 08/14/2014 06:05:47
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

If the OutputPath parameter of TElZipReader.Extract is set to an UNC path, I get an exception of type SBZipUtils.EElZipFatalError saying "Cannot create file". Is UNC paths not supported by the Zip-classes, or is there something else I could be doing wrong? (The directory exists, and I can create files in that directory using System.IO functions from the application without a problem).
#30337
Posted: 08/14/2014 06:08:26
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Please try the latest 12th version as there were fixes related to UNC paths handling.
#30338
Posted: 08/14/2014 06:09:08
by Eugene Mayevski (EldoS Corp.)

There exists a ghost problem with some systems where UNC paths don't work correctly. We can't reproduce the issue, neither we have any guesses why this happens.

What exactly version of SecureBlackbox are you using?


Sincerely yours
Eugene Mayevski
#30340
Posted: 08/14/2014 06:16:00
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

We are using version 11.0.248.0 at this point. I will try with the latest 12.XX version to see if this resolves the issue.
#30349
Posted: 08/14/2014 06:35:55
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

Okay, I tried it with the latest version (12.x), with the same result. Using a local folder works fine, but an UNC path fails. The test program I used was the following:

Code
class Program
   {
      public const string SecureBlackBoxKey = "XXX";

      static void Main(string[] args)
      {
         SBUtils.Unit.SetLicenseKey(SecureBlackBoxKey);
        
         string sourceFile = "F:\\temp\\temp.zip";
         string targetDirectory = @"\\MyMachine\temp\output";

         using (TElZipReader zipReader = new TElZipReader())
         {
            zipReader.Open(sourceFile, true);

            if (!Directory.Exists(targetDirectory))
            {
               Directory.CreateDirectory(targetDirectory);
            }

            // Extract all files and directories
            zipReader.Extract("*", targetDirectory);
         }
      }
   }


Where MyMachine is my local machine with a share named "temp" with full control permissions for everyone. The Directory.CreateDirectory() call works without a problem.

This is on Windows 8.1 x64 with UAC disabled, running as a domain user that is member of the Administrators group on the local machine.
#30350
Posted: 08/14/2014 06:44:28
by Eugene Mayevski (EldoS Corp.)

Are you getting the same Access Denied error?

We'll try to add some diagnostics to the next build because so far we see no pattern in the error - it doesn't depend on the path used or any other parameters.

As a quick workaround you can do the following:

Samples\C#\FTPSBlackbox\Server folder contains DiskFileSystemAdapter.cs file. This is roughly the same adapter class that is used in SecureBlackbox itself. What you need to do is

a) add this class to your project
b) Create an instance of DiskFileSystemAdapter.TElDiskFileSystemAdapter class
c) set FileSystemAdapter property of the component to the newly created instance.


Sincerely yours
Eugene Mayevski
#30351
Posted: 08/14/2014 07:03:19
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

Yes, the error we're getting is:

Unhandled Exception: SBZipUtils.EElZipFatalError: Cannot create file
at SBArcZip.TElZipReader.CreateExtractionFile(TElZipArchiveDirectoryEntry Ent
ry, String Path)
at SBArcZip.TElZipReader.DoExtractionStreamNeeded(TElZipArchiveDirectoryEntry
Entry, Stream& Stream)
at SBArcZip.TElZipReader.InternalBeginExtraction(TElZipArchiveDirectoryEntry
Entry, Boolean Discard)
at SBArcZip.TElZipReader.InternalExtract(TElZipArchiveDirectoryEntry Entry)
at SBArcZip.TElZipReader.InternalExtract(TElZipArchiveDirectoryEntry Entry)
at SBArcZip.TElZipReader.Extract(String Mask, String OutputPath)
at ConsoleApplication1.Program.Main(String[] args) in c:\Users\palpet\AppData
\Local\Temporary Projects\ConsoleApplication1\Program.cs:line 35

It is strange that you cannot reproduce this. I have now tried it on a virtual machine running Windows 7 x64 as well as one Windows 2012 R2, both on computers that were members of our domain and not, and I get the same result everywhere.
#30352
Posted: 08/14/2014 07:15:34
by Eugene Mayevski (EldoS Corp.)

Quote
Peter Palotas wrote:
It is strange that you cannot reproduce this. I have now tried it on a virtual machine running Windows 7 x64 as well as one Windows 2012 R2, both on computers that were members of our domain and not, and I get the same result everywhere.


This has something to do with environment rather than with the code itself -- the code works fine for some customers and doesn't work for others (and we don't know the pattern). Were you trying to access the same share from multiple computers?

As said, I am now adding some diagnostics to our code so that in next build we will be able to at least see the exact error reported by .NET framework and the path accessed (as it is translated internally by the adapter).


Sincerely yours
Eugene Mayevski
#30353
Posted: 08/14/2014 07:18:01
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

I tried accessing both the same share as well as a newly created local share on the same computer that the application was running on.
#30354
Posted: 08/14/2014 07:34:00
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

Also, the workaround you suggested seems to have no effect on this problem. I still get the same error message.

I ran ProcMon to see what the program was doing and it seems to call CreateFile with the arguments "C:\MyMachine\temp\output\file.txt" instead of "\\MyMachine\temp\output\file.txt" as it should. So for some reason SecureBlackbox.

Debugging a little using the custom TElDiskFileSystemAdapter from the sample you suggested it appears that the first line in DoOpenFile() calls AdjustPath on the path, and this removes one of the leading backslashes, hence the path used will be "\MyMachine\temp...", which of course will not be treated as an UNC path.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 3040 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!