Skip to content

Commit

Permalink
Changed RCW release handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Crypt32 committed May 1, 2018
1 parent cd7a0d1 commit 14103c2
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
Binary file added PSPKI.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions PSPKI/Client/Ping-ICertInterface.ps1
Expand Up @@ -21,14 +21,14 @@
$output.ICertAdmin = $true
} catch {
#
} finally {[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertAdmin)}
} finally {[PKI.Utils.CryptographyUtils]::ReleaseCom($CertAdmin)}
try {
$CertRequest = New-Object -ComObject CertificateAuthority.Request
[Void]$CertRequest.GetCAProperty($CA.ConfigString,0x6,0,4,0)
$output.ICertRequest = $true
} catch {
#
} finally {[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertRequest)}
} finally {[PKI.Utils.CryptographyUtils]::ReleaseCom($CertRequest)}
$output
}
}
Expand Down
Binary file modified PSPKI/Server/Approve-CertificateRequest.ps1
Binary file not shown.
Binary file modified PSPKI/Server/Deny-CertificateRequest.ps1
Binary file not shown.
4 changes: 2 additions & 2 deletions PSPKI/Server/Get-EnterprisePKIHealthStatus.ps1
Expand Up @@ -218,7 +218,7 @@ namespace PKI.EnterprisePKI {
Write-Debug "URL error: $hresult"
$CertRequest = New-Object -ComObject CertificateAuthority.Request
$CertRequest.GetErrorMessageText($hresult,0)
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertRequest)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CertRequest)
}
}
# returns [X509CRL2] or [String] that contains error message
Expand All @@ -243,7 +243,7 @@ namespace PKI.EnterprisePKI {
Write-Debug "URL error: $hresult"
$CertRequest = New-Object -ComObject CertificateAuthority.Request
$CertRequest.GetErrorMessageText($hresult,0)
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertRequest)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CertRequest)
}
}
# returns PSObject -- UrlPack
Expand Down
12 changes: 6 additions & 6 deletions PSPKI/Server/Get-RequestRow.ps1
Expand Up @@ -38,13 +38,13 @@ function __handleOidColumns($Row) {
if ($Filter -ne $null) {
foreach ($line in $Filter) {
if ($line -notmatch "^(.+)\s(-eq|-lt|-le|-ge|-gt)\s(.+)$") {
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CaView)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CaView)
throw "Malformed filter: '$line'"
}
try {
$Rcolumn = $CaView.GetColumnIndex($false, $matches[1])
} catch {
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CaView)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CaView)
throw "Specified column '$($matches[1])' does not exist."
}
$Seek = switch ($matches[2]) {
Expand All @@ -70,7 +70,7 @@ function __handleOidColumns($Row) {
$CaView.SetRestriction($RColumn,$Seek,0,$Value)
} catch {
Write-Warning "Specified pattern '$line' is not valid."
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CaView)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CaView)
throw "Specified pattern '$line' is not valid."
}
}
Expand Down Expand Up @@ -131,8 +131,8 @@ function __handleOidColumns($Row) {
}
__handleOidColumns $Row
$Row
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($DbColumn)
[PKI.Utils.CryptographyUtils]::ReleaseCom($DbColumn)
}
$CaView, $DbRow | ForEach-Object {[void][Runtime.InteropServices.Marshal]::ReleaseComObject($_)}
Remove-Variable CaView, Row
$CaView, $DbRow | ForEach-Object {[PKI.Utils.CryptographyUtils]::ReleaseCom($_)}
Remove-Variable CaView, Row -ErrorAction SilentlyContinue
}
4 changes: 2 additions & 2 deletions PSPKI/Server/Remove-DatabaseRow.ps1
Expand Up @@ -59,7 +59,7 @@ function Remove-DatabaseRow {
$Req.RequestID
Write-Warning "Database row with ID = $($Req.RequestID) does not exist."
}
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertAdmin)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CertAdmin)
}
}
"__bulk" {
Expand All @@ -77,7 +77,7 @@ function Remove-DatabaseRow {
} else {
New-Object SysadminsLV.PKI.Utils.ServiceOperationResult 0, "No rows were deleted."
}
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertAdmin)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CertAdmin)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion PSPKI/Server/Revoke-Certificate.ps1
Expand Up @@ -31,7 +31,7 @@ function Revoke-Certificate {
} catch {
New-Object SysadminsLV.PKI.Utils.ServiceOperationResult $_.Exception.HResult
} finally {
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertAdmin)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CertAdmin)
}

}
Expand Down
2 changes: 1 addition & 1 deletion PSPKI/Server/Set-CertificateExtension.ps1
Expand Up @@ -55,7 +55,7 @@
} else {
throw New-Object ArgumentException "The parameter is invalid."
}
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($CertAdmin)
[PKI.Utils.CryptographyUtils]::ReleaseCom($CertAdmin)
}
}
}

0 comments on commit 14103c2

Please sign in to comment.