Node-SMB / marsaud-smb2

SMB2 Client
53 stars 46 forks source link

STATUS_USER_SESSION_DELETED (0xC0000203) #65

Closed ffelipelimao closed 3 years ago

ffelipelimao commented 4 years ago

Hey guys,

i´m trying to call this function " smb2Client.createWriteStream(path, {start});"

but i´m receiving this error: Error: STATUS_USER_SESSION_DELETED (0xC0000203) : The remote user session has been deleted.

my client: const smb2Client: SMB2 = new SMB2({ domain: process.env.NFS_CIFS_DOMAIN || '', username: process.env.NFS_CIFS_USER || '', password: process.env.NFS_CIFS_PASS || '', share: process.env.NFS_CIFS_SHARE || ', });

do you guys know what is going on????

julien-f commented 4 years ago

Hi,

I don't know what's going on, please check the official SMB documentation for more info: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb/6ab6ca20-b404-41fd-b91a-2ed39e3762ea

ShunsukeNagae commented 3 years ago

Hi,

This error indicates that the SessionId sent from the client side does not exist on the server side.

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/c9efe8ca-ff34-44d0-bfbe-58a9b9db50d4 According to the above specifications, the SessionId is returned in "SESSION_SETUP Response 1", but it may also be returned in "SESSION_SETUP Response 2". This module does not support the case returned in "SESSION_SETUP Response 2". Therefore, I think that you should add the following code to session_setup_step2.js. (Refer to session_setup_step1.js)


successCode:'STATUS_SUCCESS',

onSuccess: function(connection, response) { var h = response.getHeaders(); connection.SessionId = h.SessionId; },


I faced the same problem as you, and solved it this way. If the this solution doesn't work well, get the communication packet and compare it with the specifications.

ffelipelimao commented 3 years ago

Thanks guys!!

pznql5 commented 1 year ago

So the fix is to make our own fork and add that code??

julien-f commented 1 year ago

@pznql5 yes, or I can add you as maintainer of this package 🙂

ruikaka16 commented 4 months ago
const smbClient = new smb2({
      client: {
        dialect: '3.1.1'
      },
      share: '\\\\'+ip+'\\'+String(remotepath).substring(0,1)+'$',
      domain: 'workgroup',
      username: username,
      password:password
    });

    smbClient.readdir((String(remotepath).substring(3)).replace(/\\/g, '\\\\') + "\\\\", function(err, files) {
     if (err) throw err;
      console.log(files.length);
      return files.length
    });

run my code returning the same error:"STATUS_USER_SESSION_DELETED ",i don't know how to fix it,but it run perfectly well before.Thanks for help