Bug Fix #62: DeviceDomainId may be null
This commit is contained in:
@@ -365,7 +365,7 @@ namespace Disco.BI.DeviceBI
|
|||||||
|
|
||||||
if (domain == null)
|
if (domain == null)
|
||||||
domain = ActiveDirectory.Context.GetDomainByName(Request.DeviceDNSDomainName);
|
domain = ActiveDirectory.Context.GetDomainByName(Request.DeviceDNSDomainName);
|
||||||
|
|
||||||
if (!authenticatedToken.User.UserId.Equals(string.Format(@"{0}\{1}$", domain.NetBiosName, Request.DeviceComputerName), System.StringComparison.OrdinalIgnoreCase))
|
if (!authenticatedToken.User.UserId.Equals(string.Format(@"{0}\{1}$", domain.NetBiosName, Request.DeviceComputerName), System.StringComparison.OrdinalIgnoreCase))
|
||||||
throw new EnrolSafeException(string.Format("Connection not correctly authenticated (SN: {0}; Auth User: {1})", Request.DeviceSerialNumber, authenticatedToken.User.UserId));
|
throw new EnrolSafeException(string.Format("Connection not correctly authenticated (SN: {0}; Auth User: {1})", Request.DeviceSerialNumber, authenticatedToken.User.UserId));
|
||||||
}
|
}
|
||||||
@@ -499,7 +499,7 @@ namespace Disco.BI.DeviceBI
|
|||||||
response.DeviceComputerName = adMachineAccount.Name;
|
response.DeviceComputerName = adMachineAccount.Name;
|
||||||
response.DeviceDomainName = adMachineAccount.Domain.NetBiosName;
|
response.DeviceDomainName = adMachineAccount.Domain.NetBiosName;
|
||||||
}
|
}
|
||||||
else
|
else if (ActiveDirectory.IsValidDomainAccountId(RepoDevice.DeviceDomainId))
|
||||||
{
|
{
|
||||||
string accountUsername;
|
string accountUsername;
|
||||||
ADDomain accountDomain;
|
ADDomain accountDomain;
|
||||||
@@ -508,6 +508,11 @@ namespace Disco.BI.DeviceBI
|
|||||||
response.DeviceDomainName = accountDomain == null ? null : accountDomain.NetBiosName;
|
response.DeviceDomainName = accountDomain == null ? null : accountDomain.NetBiosName;
|
||||||
response.DeviceComputerName = accountUsername;
|
response.DeviceComputerName = accountUsername;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.DeviceDomainName = Request.DeviceDNSDomainName;
|
||||||
|
response.DeviceComputerName = Request.DeviceComputerName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user