mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Do not allow device-report command to be run without administrative privileges.
This commit is contained in:
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using DiscImageChef.CommonTypes.Enums;
|
||||
using DiscImageChef.CommonTypes.Interop;
|
||||
using DiscImageChef.CommonTypes.Metadata;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Core;
|
||||
@@ -55,6 +56,13 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.DebugWriteLine("Device-Report command", "--verbose={0}", options.Verbose);
|
||||
DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath);
|
||||
|
||||
if(!DetectOS.IsAdmin)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Because of the commands sent to a device, device report must be run with administrative privileges.");
|
||||
DicConsole.ErrorWriteLine("Not continuing.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
|
||||
char.IsLetter(options.DevicePath[0]))
|
||||
options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':';
|
||||
|
||||
Reference in New Issue
Block a user