Bug Fix #79 Ban '/' from serial numbers

This commit is contained in:
Gary Sharp
2016-09-29 17:47:33 +10:00
parent 669de7e46b
commit 3c521541fd
4 changed files with 20 additions and 2 deletions
@@ -189,9 +189,13 @@ namespace Disco.Services.Devices.Enrolment
sessionId = OpenSessionId;
}
EnrolmentLog.LogSessionDeviceInfo(sessionId, Request);
MacEnrolResponse response = new MacEnrolResponse();
try
{
if (Request.DeviceSerialNumber.Contains("/") || Request.DeviceSerialNumber.Contains(@"\"))
throw new EnrolmentSafeException(@"The serial number cannot contain '/' or '\' characters.");
EnrolmentLog.LogSessionProgress(sessionId, 10, "Querying Database");
Device RepoDevice = Database.Devices.Include("AssignedUser").Include("DeviceProfile").Include("DeviceProfile").Where(d => d.SerialNumber == Request.DeviceSerialNumber).FirstOrDefault();
if (!Trusted)
@@ -307,6 +311,9 @@ namespace Disco.Services.Devices.Enrolment
try
{
if (Request.SerialNumber.Contains("/") || Request.SerialNumber.Contains(@"\"))
throw new EnrolmentSafeException(@"The serial number cannot contain '/' or '\' characters.");
EnrolmentLog.LogSessionProgress(sessionId, 10, "Loading User Data");
if (!string.IsNullOrWhiteSpace(Username))
{