Consider the above directory structure, we are connected to "Root" share and trying to list the symbolic link "symlink"(share.list("symlink")) which is pointing to \Host\Test (same host but different share). The call to the list is failing with below exception.
In case of absolute path (mklink /D symlink \hostname\Test):
Exception in thread "main" com.hierynomus.mssmb2.SMBApiException: STATUS_INVALID_PARAMETER (0xc000000d): Create failed for \hostname\Root\??\UNC\hostname\Test
at com.hierynomus.smbj.share.Share.receive(Share.java:371)
at com.hierynomus.smbj.share.Share.sendReceive(Share.java:351)
at com.hierynomus.smbj.share.Share.createFile(Share.java:159)
at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:97)
at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:102)
at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:79)
at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66)
at com.hierynomus.smbj.share.DiskShare.openDirectory(DiskShare.java:130)
at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:237)
at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:210)
at com.main.BasicEvaluation.iterateDirectory(BasicEvaluation.java:414)
at com.main.BasicEvaluation.main(BasicEvaluation.java:539)
In case of relative path (mklink /D symlink ..\Test):
Exception in thread "main" com.hierynomus.mssmb2.SMBApiException: STATUS_OBJECT_NAME_NOT_FOUND (0xc0000034): Create failed for \hostname\Root\Test
at com.hierynomus.smbj.share.Share.receive(Share.java:371)
at com.hierynomus.smbj.share.Share.sendReceive(Share.java:351)
at com.hierynomus.smbj.share.Share.createFile(Share.java:159)
at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:97)
at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:102)
at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:79)
at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66)
at com.hierynomus.smbj.share.DiskShare.openDirectory(DiskShare.java:130)
at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:237)
at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:210)
at com.main.BasicEvaluation.iterateDirectory(BasicEvaluation.java:414)
at com.main.BasicEvaluation.main(BasicEvaluation.java:539)
The same is working fine if the symlink is pointing to a directory in the same share i.e Root. Also, is there any way to identify the type of reparse point whether it is a symbolic link or DFS or anything else?
Hi @hierynomus, @pepijnve,
We are facing issues while parsing the symbolic link which is not in the same share.
Host\ | - Root\ (under Host) | - abc.txt (under Root) | - symlink (under Root) --> \Host\Test | - Test\ (under Host) | - test.txt (under Test)
Consider the above directory structure, we are connected to "Root" share and trying to list the symbolic link "symlink"(share.list("symlink")) which is pointing to \Host\Test (same host but different share). The call to the list is failing with below exception.
In case of absolute path (mklink /D symlink \hostname\Test):
Exception in thread "main" com.hierynomus.mssmb2.SMBApiException: STATUS_INVALID_PARAMETER (0xc000000d): Create failed for \hostname\Root\??\UNC\hostname\Test at com.hierynomus.smbj.share.Share.receive(Share.java:371) at com.hierynomus.smbj.share.Share.sendReceive(Share.java:351) at com.hierynomus.smbj.share.Share.createFile(Share.java:159) at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:97) at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:102) at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:79) at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66) at com.hierynomus.smbj.share.DiskShare.openDirectory(DiskShare.java:130) at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:237) at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:210) at com.main.BasicEvaluation.iterateDirectory(BasicEvaluation.java:414) at com.main.BasicEvaluation.main(BasicEvaluation.java:539)
In case of relative path (mklink /D symlink ..\Test):
Exception in thread "main" com.hierynomus.mssmb2.SMBApiException: STATUS_OBJECT_NAME_NOT_FOUND (0xc0000034): Create failed for \hostname\Root\Test at com.hierynomus.smbj.share.Share.receive(Share.java:371) at com.hierynomus.smbj.share.Share.sendReceive(Share.java:351) at com.hierynomus.smbj.share.Share.createFile(Share.java:159) at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:97) at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:102) at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:79) at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66) at com.hierynomus.smbj.share.DiskShare.openDirectory(DiskShare.java:130) at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:237) at com.hierynomus.smbj.share.DiskShare.list(DiskShare.java:210) at com.main.BasicEvaluation.iterateDirectory(BasicEvaluation.java:414) at com.main.BasicEvaluation.main(BasicEvaluation.java:539)
I tried to debug and the handling of symbolic link error response seems to be good as per below link but this does not cover the use case mentioned above. https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/a8da655c-8b0b-415a-b726-16dc33fa5827?redirectedfrom=MSDN
The same is working fine if the symlink is pointing to a directory in the same share i.e Root. Also, is there any way to identify the type of reparse point whether it is a symbolic link or DFS or anything else?