Skip to content

Commit

Permalink
win_acl/Certificates: Low hanging fruit refactoring part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jpitlor committed Sep 6, 2023
1 parent 520398e commit 0778ddd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Note: The contents of this file are for internal use only! Do not depend on these classes
// or their methods and properties. The API can change without any warning or respect to
// semantic versioning.

using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
Expand All @@ -18,12 +22,6 @@ public CryptHandle()
{
}

public CryptHandle(IntPtr handle)
: base(true)
{
this.SetHandle(handle);
}

[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool CryptReleaseContext(IntPtr safeProvHandle, uint dwFlags);
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/win_acl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ $inherit = Get-AnsibleParam -obj $params -name "inherit" -type "str"
$propagation = Get-AnsibleParam -obj $params -name "propagation" -type "str" -default "None" -validateset "InheritOnly", "None", "NoPropagateInherit"
$follow = Get-AnsibleParam -obj $params -name "follow" -type "bool" -default "false"

# We mount the HKCR, HKU, and HKCC registry hives and the certificate stores so PS can access them.
# We mount the HKCR, HKU, and HKCC registry hives so PS can access them.
# Network paths have no qualifiers so we use -EA SilentlyContinue to ignore that
$path_qualifier = Split-Path -Path $path -Qualifier -ErrorAction SilentlyContinue
if ($path_qualifier -eq "HKCR:" -and (-not (Test-Path -LiteralPath HKCR:\))) {
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/targets/win_acl/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"FileSystemRights"
}
$ace_list = (Get-Acl -LiteralPath $path).Access | Where-Object { $_.IsInherited -eq $false } | ForEach-Object {
@{
rights = $_."$rights_key".ToString()
type = $_.AccessControlType.ToString()
identity = $_.IdentityReference.Value.ToString()
inheritance_flags = $_.InheritanceFlags.ToString()
propagation_flags = $_.PropagationFlags.ToString()
}
@{
rights = $_."$rights_key".ToString()
type = $_.AccessControlType.ToString()
identity = $_.IdentityReference.Value.ToString()
inheritance_flags = $_.InheritanceFlags.ToString()
propagation_flags = $_.PropagationFlags.ToString()
}
}
Pop-Location
ConvertTo-Json -InputObject @($ace_list)
Expand Down

0 comments on commit 0778ddd

Please sign in to comment.