Search code examples
smb

Problem accessing SMB1/2 using SmbLibraryStd


I'm trying to access an SMB server from .NET Core using SmbLibraryStd(https://github.com/j4m3z0r/SmbLibraryStd) but login fails no matter whether I try with SMB 1.0 or 2.0.

My code is as following(.Net Core):

var smb = new SMB2Client();
var success = smb.Connect(new System.Net.IPAddress(new byte[] { 192, 21, 1, 40 }), SmbLibraryStd.SMBTransportType.DirectTCPTransport);
var status = smb.Login(string.Empty, "User", "Pass");
SmbLibraryStd.NTStatus actionStatus;
var shares = smb.ListShares(out actionStatus);

Connection is successful but login fails and returned SEC_E_INVALID_TOKEN. There is no documentation for SmbLibraryStd(I could not find any).

Any help would be appreciated.

Regards.


Solution

  • There was a bug in SmbLibrary, which was fixed in 1.3.6 but was not ported to SmbLibraryStd. If you you face the same problem use original library instead of SmbLibraryStd variant.