commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael (JIRA)" <j...@apache.org>
Subject [jira] [Created] (VFS-635) can't access SMBv2
Date Tue, 23 May 2017 15:33:04 GMT
Michael created VFS-635:
---------------------------

             Summary: can't access SMBv2
                 Key: VFS-635
                 URL: https://issues.apache.org/jira/browse/VFS-635
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 2.1, 2.0
            Reporter: Michael


After Disabling SMBV1 in windows I can't access into the filesystem.
This code works when SMB1 is enabled, but sops to work once disabled.

{code}
@Test
    public void testConnection() throws FileSystemException {
		String login = "admin";
		String password = "password"; 
		String domain = "";
		String folder = "//10.0.0.0/smb";
		folder = folder.replaceAll("\\\\", "/");
		StringBuilder builder = new StringBuilder(128).append("smb").append(':').append(folder);
		String fileURI = builder.toString();

		FileSystemOptions fsOptions = null;

		StaticUserAuthenticator auth = new StaticUserAuthenticator(domain, login, password);
		fsOptions = new FileSystemOptions();
		DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(fsOptions, auth);
		FileSystemManager manager = VFS.getManager();
		FileSystemManager fileSystemManager = manager;
		FileObject fileObject = fileSystemManager.resolveFile(fileURI, fsOptions);
		boolean result = fileObject.isReadable();

        System.out.println(fileURI +" " + result);
    }
{code}

this is how I disabled smb v1

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1
-Type DWORD -Value 0 -Force

How I enabled SMBV2

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB2
-Type DWORD -Value 1 -Force

https://support.microsoft.com/en-us/help/2696547/how-to-enable-and-disable-smbv1-smbv2-and-smbv3-in-windows-and-windows-server


[TRACE]
{code}
org.apache.commons.vfs2.FileSystemException: Could not determine if file "smb://10.0.0.0/smb/"
is readable.
    at org.apache.commons.vfs2.provider.AbstractFileObject.isReadable(AbstractFileObject.java:1761)
    at com.pa.util.files.FileUtilsTest.testConnection(FileUtilsTest.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not determine the type of file
"smb://10.0.0.0/smb/".
    at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1526)
    at org.apache.commons.vfs2.provider.AbstractFileObject.exists(AbstractFileObject.java:1022)
    at org.apache.commons.vfs2.provider.AbstractFileObject.isReadable(AbstractFileObject.java:1757)
    ... 26 more
Caused by: jcifs.smb.SmbException: Failed to connect: 0.0.0.0<00>/10.0.0.0
jcifs.util.transport.TransportException
java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:210)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at jcifs.util.transport.Transport.readn(Transport.java:29)
    at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:388)
    at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:288)
    at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:319)
    at jcifs.util.transport.Transport.run(Transport.java:241)
    at java.lang.Thread.run(Thread.java:745)

    at jcifs.util.transport.Transport.run(Transport.java:258)
    at java.lang.Thread.run(Thread.java:745)

    at jcifs.smb.SmbTransport.connect(SmbTransport.java:309)
    at jcifs.smb.SmbTree.treeConnect(SmbTree.java:156)
    at jcifs.smb.SmbFile.doConnect(SmbFile.java:911)
    at jcifs.smb.SmbFile.connect(SmbFile.java:954)
    at jcifs.smb.SmbFile.connect0(SmbFile.java:880)
    at jcifs.smb.SmbFile.exists(SmbFile.java:1415)
    at org.apache.commons.vfs2.provider.smb.SmbFileObject.doGetType(SmbFileObject.java:133)
    at org.apache.commons.vfs2.provider.AbstractFileObject.getType(AbstractFileObject.java:1517)
    ... 28 more
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message