SMB TreeID is invalid

248 views Asked by At

When I'm trying to connect to an SmbFile using following code:

    final Properties props = new Properties();
    props.setProperty("jcifs.smb.client.disablePlainTextPasswords", "false");
    final PropertyConfiguration propertyConfig = new PropertyConfiguration(props);

    CIFSContext fCIFSContext = new BaseContext(propertyConfig);
    fCIFSContext = fCIFSContext.withCredentials(new NtlmPasswordAuthenticator("xxx", "xxx", 
    "xxx"));
    String directory = "xxx";
            

    final SmbFile path = new SmbFile(directory, fCIFSContext);

    path.connect();

I get following error.

    Caused by: jcifsng.smb.SmbException: TreeID is invalid
    at jcifsng.smb.SmbTreeImpl.treeConnected(SmbTreeImpl.java:658)
    at jcifsng.smb.SmbTreeImpl.treeConnect(SmbTreeImpl.java:628)
    at jcifsng.smb.SmbTreeConnection.connectTree(SmbTreeConnection.java:614)
    at jcifsng.smb.SmbTreeConnection.connectHost(SmbTreeConnection.java:568)
    at jcifsng.smb.SmbTreeConnection.connectHost(SmbTreeConnection.java:489)
    at jcifsng.smb.SmbTreeConnection.connect(SmbTreeConnection.java:465)
    at jcifsng.smb.SmbTreeConnection.connectWrapException(SmbTreeConnection.java:426)
    at jcifsng.smb.SmbFile.ensureTreeConnected(SmbFile.java:559)
    at jcifsng.smb.SmbFile.connect(SmbFile.java:518)

When debugging the source code it looks like the TreeID is 0 (which is invalid according to Smb2TreeConnectResponse.class) I'm using the latest dependency

    <dependency>
      <groupId>eu.agno3.jcifs</groupId>
      <artifactId>jcifs-ng</artifactId>
      <version>2.1.7</version>
    </dependency>

When connection to the smb using smbclient this works fine and everything seems in place.

I have very little knowledge about smb. What can be the reason that the TreeID is set to 0 and not valid?

UPDATE Issue is fixed: https://github.com/AgNO3/jcifs-ng/issues/303

0

There are 0 answers