Skip to content

Commit 7853e05

Browse files
author
Steve Salas
committed
Grant read & execute to OpenCover.Profiler.dll
1 parent 150b1bf commit 7853e05

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

dotnet-tracer/main/CodePulse.Console/Program.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ private static int Main(string[] args)
9696

9797
LogManager.GetRepository().Threshold = parser.LogLevel;
9898

99-
if (!DoesUserHaveReadAccess(parser.Profiler32Path, parser.ExpectedOwnerOfApplicationUnderTest, out var new32BitAccessRule))
99+
if (!DoesUserHaveReadAndExecuteAccess(parser.Profiler32Path, parser.ExpectedOwnerOfApplicationUnderTest, out var new32BitAccessRule))
100100
{
101-
LogMandatoryFatal($"The application cannot start because expected owner of the application under test ({parser.ExpectedOwnerOfApplicationUnderTest}) does not have read permissions for the 32-bit profiler library ({parser.Profiler32Path}).");
101+
LogMandatoryFatal($"The application cannot start because expected owner of the application under test ({parser.ExpectedOwnerOfApplicationUnderTest}) does not have read and execute permissions for the 32-bit profiler library ({parser.Profiler32Path}).");
102102
return MakeExitCode(ProgramExitCodes.ProfilerNoReadPermission);
103103
}
104104

105105
try
106106
{
107107
FileSystemAccessRule new64BitAccessRule = null;
108-
if (Environment.Is64BitOperatingSystem && !DoesUserHaveReadAccess(parser.Profiler64Path, parser.ExpectedOwnerOfApplicationUnderTest, out new64BitAccessRule))
108+
if (Environment.Is64BitOperatingSystem && !DoesUserHaveReadAndExecuteAccess(parser.Profiler64Path, parser.ExpectedOwnerOfApplicationUnderTest, out new64BitAccessRule))
109109
{
110-
LogMandatoryFatal($"The application cannot start because expected owner of the application under test ({parser.ExpectedOwnerOfApplicationUnderTest}) does not have read permissions for the 64-bit profiler library ({parser.Profiler64Path}).");
110+
LogMandatoryFatal($"The application cannot start because expected owner of the application under test ({parser.ExpectedOwnerOfApplicationUnderTest}) does not have read and execute permissions for the 64-bit profiler library ({parser.Profiler64Path}).");
111111
return MakeExitCode(ProgramExitCodes.ProfilerNoReadPermission);
112112
}
113113

@@ -172,7 +172,7 @@ private static int Main(string[] args)
172172
}
173173
}
174174

175-
private static bool DoesUserHaveReadAccess(string path, string username, out FileSystemAccessRule newAccessRule)
175+
private static bool DoesUserHaveReadAndExecuteAccess(string path, string username, out FileSystemAccessRule newAccessRule)
176176
{
177177
newAccessRule = null;
178178

@@ -189,19 +189,19 @@ private static bool DoesUserHaveReadAccess(string path, string username, out Fil
189189
return true;
190190
}
191191

192-
Logger.Info($"Attempting to add access rule because expected owner of application under test ({username}) may not have read permissions to profiler library ({path})...");
192+
Logger.Info($"Attempting to add access rule because expected owner of application under test ({username}) may not have read and execute permissions to profiler library ({path})...");
193193

194194
FileSecurity accessControl;
195195
try
196196
{
197-
newAccessRule = new FileSystemAccessRule(username, FileSystemRights.Read | FileSystemRights.Synchronize, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow);
197+
newAccessRule = new FileSystemAccessRule(username, FileSystemRights.Read | FileSystemRights.ReadAndExecute | FileSystemRights.Synchronize, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow);
198198

199199
accessControl = File.GetAccessControl(path);
200200
accessControl.AddAccessRule(newAccessRule);
201201
}
202202
catch (Exception e)
203203
{
204-
Logger.Error($"Unable to obtain DACL for granting read permission to profiler library ({path}) to expected owner of application under test ({username}): {e.Message}");
204+
Logger.Error($"Unable to obtain DACL for granting read and execute permissions to profiler library ({path}) to expected owner of application under test ({username}): {e.Message}");
205205
return false;
206206
}
207207

0 commit comments

Comments
 (0)