Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: STATUS_PATH_NOT_COVERED #152

Open
tony-ts opened this issue Aug 9, 2017 · 18 comments
Open

Exception: STATUS_PATH_NOT_COVERED #152

tony-ts opened this issue Aug 9, 2017 · 18 comments
Labels

Comments

@tony-ts
Copy link

tony-ts commented Aug 9, 2017

Hello.
I have share named "DFS" with folder "Resources". Folder Resources contains shortcut for folder "SomeFolder".
When i'm trying to access

Directory directory = share.openDirectory("Resources\\SomeFolder",
        EnumSet.of(AccessMask.FILE_LIST_DIRECTORY, AccessMask.FILE_READ_ATTRIBUTES),
                EnumSet.of(FileAttributes.FILE_ATTRIBUTE_DIRECTORY),
        SMB2ShareAccess.ALL,
        SMB2CreateDisposition.FILE_OPEN,
        EnumSet.of(SMB2CreateOptions.FILE_DIRECTORY_FILE));

i got exception

com.hierynomus.smbj.common.SMBApiException: STATUS_PATH_NOT_COVERED(3221226071/3221226071): Create failed for Resources\SomeFolder

In properties of folder "SomeFolder", DFS tab have link on another server "\SomeServer\DFSData\Resouces\SomeFolder"

I found in documentation

https://msdn.microsoft.com/en-us/library/cc227030.aspx
To identify the DFS link targets that contain the required portion of the DFS namespace, the client MUST look up the path used for the I/O operation in ReferralCache. On a cache hit, the resulting ReferralCache entry MUST be used in further processing

But i can't find something helpful in FileIdBothDirectoryInformation.
How can i access this folder ("Resources\SomeFolder")?

@hierynomus
Copy link
Owner

Hi @tony-ts,

DFS support is upcoming, but not merged yet. Hope to work on this tomorrow actually. So currently this error would be expected when you connect to a DFS share.

@hierynomus
Copy link
Owner

@tony-ts Can you try with the latest master? :)

Don't forget to set the SmbConfig.withDfsEnabled(true). As I've disabled this by default for now, until we get some more practical experience with it.

@tony-ts
Copy link
Author

tony-ts commented Aug 11, 2017

@hierynomus Connect / open file works good. But i received exceptions (access denied) when tried to mkfile/ mkdir / rmfile / rmdir (i have rights for it).

21:08:38.191 [main] DEBUG com.hierynomus.smbj.connection.Connection - Granted 1 (out of 128) credits to SMB2_CREATE with message id << 159 >>
21:08:38.191 [main] DEBUG com.hierynomus.smbj.transport.tcp.direct.DirectTcpTransport - Writing packet SMB2_CREATE with message id << 159 >>
21:08:38.192 [main] DEBUG com.hierynomus.protocol.commons.concurrent.Promise - Awaiting << 159 >>
21:08:38.202 [Packet Reader for 10.63.64.141] DEBUG com.hierynomus.smbj.transport.PacketReader - Received packet SMB2_CREATE with message id << 159 >>
21:08:38.202 [Packet Reader for 10.63.64.141] DEBUG com.hierynomus.smbj.connection.Connection - Server granted us 1 credits for SMB2_CREATE with message id << 159 >>, now available: 128 credits
21:08:38.202 [Packet Reader for 10.63.64.141] DEBUG com.hierynomus.protocol.commons.concurrent.Promise - Setting << 159 >> to SMB2_CREATE with message id << 159 >>
com.hierynomus.mssmb2.SMBApiException: STATUS_ACCESS_DENIED(3221225506/3221225506): Create failed for Resources\SomeFolder\NewFolder
at com.hierynomus.smbj.share.Share.receive(Share.java:335)
at com.hierynomus.smbj.share.Share.sendReceive(Share.java:319)
at com.hierynomus.smbj.share.Share.createFile(Share.java:134)
at com.hierynomus.smbj.share.DFSDiskShare.open(DFSDiskShare.java:48)
at com.hierynomus.smbj.share.DiskShare.openDirectory(DiskShare.java:78)
at com.hierynomus.smbj.share.DiskShare.mkdir(DiskShare.java:174)

@tony-ts
Copy link
Author

tony-ts commented Aug 15, 2017

@hierynomus solved it with DFSPathResolver + connect to DFSShare.

@Disablez
Copy link
Contributor

Disablez commented Sep 6, 2017

With the last version I'm still getting a STATUS_PATH_NOT_COVERED if the whole FQDN is not used for the host, eg,

Accessing //test.mydomain/test... where test.mydomain resolves to IPS 1 2 and 3. Share "test" resides actually on IP 2.
client.connect("test.mydomain") -> DFS works fine
client.connect("test") -> Path not covered
client.connect("1") -> Path not covered
client.connect("2") -> Things work, but no DFS involved.

Anyway, used the proper way it works, so thanks.

@Disablez
Copy link
Contributor

Disablez commented Sep 6, 2017

Nah, spoke too soon. It only works if by chance the FQDN is solved to the good IP. Otherwise this will fail.

SMB2TreeConnectResponse response = (SMB2TreeConnectResponse)Futures.get(send, this.connection.getConfig().getTransactTimeout(), TimeUnit.MILLISECONDS, TransportException.Wrapper);

and response.getCapabilities() is null in this case, same as when "wrong" ip is used as host.

Attaching a tcpdump, if it serves for anything.

DFS3.zip

@cliviu
Copy link

cliviu commented Sep 15, 2017

@Disablez , can you please try the https://github.com/cliviu/smbj version, see if it works for you. Thanks !

@Disablez
Copy link
Contributor

@cliviu Sorry, but it fails same way :(. Only works if by chance the hostname is internally resolved to the proper IP, with no need for redirection. So, still a lottery.

@cliviu
Copy link

cliviu commented Sep 15, 2017

ok, so it may be a network configuration problem. If the link always working under windoz ?

@Disablez
Copy link
Contributor

It does work under windows (explorer / map to drive) with no issue.

@Disablez
Copy link
Contributor

Disablez commented Oct 2, 2017

After sniffing a bit, it seems the current implementation works when the DFS folder points to several copies of the same data in different nodes, i.e.
\commonname\myfolder points to \servera\myfolder and \serverb\myfolder
\commonname\myfolder2 points to \servera\myfolder2 and \serverb\myfolder2

In this case smbj works properly .

However, if we "distribute" the folders among the nodes, e.g myfolder is physically only on servera and myfolder2 is physically only on serverb, smbj cannot resolve it. While Windows does.

@vicnumberone
Copy link

hi all
The problem with
STATUS_PATH_NOT_COVERED (0xc0000257): Cannot connect to resolved path \QA-SRVCLIENT01\dfs_share
can you help me with this?

@kadirchisty
Copy link

kadirchisty commented May 3, 2021

Hi,
Below line is giving compile error when updated smbj jar to 0.10.0 version.

SMB2Echo responsePacket = new SMB2Echo();
responsePacket.getHeader().setStatus(NtStatus.STATUS_PATH_NOT_COVERED);

Compile error : The method setStatus(NtStatus) is undefined for the type SMB2Header

Trying to resolve below warnings:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.hierynomus.security.jce.JceMessageDigest (file:/C:/Users/git/parent/web/webContent/WEB-INF/lib/smbj-0.6.0.jar) to method sun.security.provider.MD4.getInstance() WARNING: Please consider reporting this to the maintainers of com.hierynomus.security.jce.JceMessageDigest WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

Please advice

@JozefDropco
Copy link
Contributor

JozefDropco commented Jun 14, 2021

Hi All,
finally with version 0.11.1 I was able to remove all additional logic to work with DFS. Simply said It was enough for me to do the following.
String uri="smb://dfs.share.com/dfs/Test/testFile.txt"; URI uri = toURI(rootDirectory); SmbPath resolved; try { Connection connection = smbClient.connect(uri.getHost()); Session session = connection.authenticate(authenticationContext); SmbPath resolved = SmbPath.parse(uri.getHost()+uri.getPath()); try (DiskShare smbShare = session.connectShare(resolved.getShareName())) { return smbShare.fileExists(resolved.getPath()); } } catch (SMBApiException e) { // translate exception }

@ilia-dot-karelia
Copy link

ilia-dot-karelia commented Jan 26, 2022

Hi All, finally with version 0.11.1 I was able to remove all additional logic to work with DFS. Simply said It was enough for me to do the following. String uri="smb://dfs.share.com/dfs/Test/testFile.txt"; URI uri = toURI(rootDirectory); SmbPath resolved; try { Connection connection = smbClient.connect(uri.getHost()); Session session = connection.authenticate(authenticationContext); SmbPath resolved = SmbPath.parse(uri.getHost()+uri.getPath()); try (DiskShare smbShare = session.connectShare(resolved.getShareName())) { return smbShare.fileExists(resolved.getPath()); } } catch (SMBApiException e) { // translate exception }

Have a similar issue with the latest lib version. Receive NPE on getAttributes, with 3221226071 status in the header, any ideas?
(so no error, normal response, but everything inside is null)

@JozefDropco
Copy link
Contributor

hi @ilia-dot-karelia ,
I dont have any immediate idea why you got NPE, Can you share some snippet of the code.

Thanks Jozef

@vvandre-ml
Copy link

Hello. I have share named "DFS" with folder "Resources". Folder Resources contains shortcut for folder "SomeFolder". When i'm trying to access

Directory directory = share.openDirectory("Resources\\SomeFolder",
        EnumSet.of(AccessMask.FILE_LIST_DIRECTORY, AccessMask.FILE_READ_ATTRIBUTES),
                EnumSet.of(FileAttributes.FILE_ATTRIBUTE_DIRECTORY),
        SMB2ShareAccess.ALL,
        SMB2CreateDisposition.FILE_OPEN,
        EnumSet.of(SMB2CreateOptions.FILE_DIRECTORY_FILE));

i got exception

com.hierynomus.smbj.common.SMBApiException: STATUS_PATH_NOT_COVERED(3221226071/3221226071): Create failed for Resources\SomeFolder

In properties of folder "SomeFolder", DFS tab have link on another server "\SomeServer\DFSData\Resouces\SomeFolder"

I found in documentation

https://msdn.microsoft.com/en-us/library/cc227030.aspx
To identify the DFS link targets that contain the required portion of the DFS namespace, the client MUST look up the path used for the I/O operation in ReferralCache. On a cache hit, the resulting ReferralCache entry MUST be used in further processing

But i can't find something helpful in FileIdBothDirectoryInformation. How can i access this folder ("Resources\SomeFolder")?

Hi!

Was this item implemented?

Thanks Vinicius

@dkocher
Copy link

dkocher commented Aug 20, 2023

Possibly related to #419 and resolved with #722?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants