jordanlytle / SmbAbstraction

Implements the System.IO.Abstractions interfaces for interacting with the filesystem, and adds support for interacting with UNC or SMB paths
MIT License
6 stars 8 forks source link

SMBCredential's domain argument, when null, results in unhandled null reference exception #5

Closed Coderrob closed 4 years ago

Coderrob commented 4 years ago

Leaving the domain value null on SMBCredential will result in a null reference exception thrown when attempting to run Connect():

        private void Connect()
        {
            var succeded = SMBClient.Connect(_address, _transport);
            if(!succeded)
            {
                throw new IOException($"Unable to connect to SMB share.");
            }
            var status = SMBClient.Login(_credential.Domain, _credential.UserName, _credential.Password);
            status.HandleStatus();
        }

Likely need to include some guard classes to assert that values are not null to throw argument exceptions.

jordanlytle commented 4 years ago

Thanks for finding this issue Rob, I should have a fix for this sometime this week

jordanlytle commented 4 years ago

This has been addressed in the latest version of the nuget package (1.0.5)