Search code examples
smblibsmbclient

Problem with getting list of directories : SMBLibrary


I'm trying to get the list of shared folders from SMB server using following code but I'm getting "STATUS_USER_SESSION_DELETED" from ListShares() :

var client = new SMB2Client();
var success = client.Connect(System.Net.IPAddress.Parse("192.21.1.40"), 
    SMBTransportType.DirectTCPTransport);
// Success
if (success)
{
    var status = client.Login(String.Empty, "user", "pass");
    // Success
    if (status == NTStatus.STATUS_SUCCESS)
    {
        var shares = client.ListShares(out var actionStatus);
    // **FAILURE : SMBLibrary.NTStatus.STATUS_USER_SESSION_DELETED**
        foreach (var item in shares)
        {
            Console.WriteLine(item);
        }
    }
}

I'm using following library for SMB communication.

https://github.com/TalAloni/SMBLibrary

I'm using C#.NET for development.

Thanks for the help in advance.


Solution

  • The OP has submitted a packet capture that demonstrated that the problem was with an outdated SAMBA server on the other end. (https://github.com/TalAloni/SMBLibrary/issues/24)