Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

internal static unsafe bool GetTrustedDomainInfoStatus(DirectoryContext context, string? sourceName, string targetName, Interop.Advapi32.TRUST_ATTRIBUTE attribute, bool isForest)
{
SafeLsaPolicyHandle? handle = null;
IntPtr buffer = (IntPtr)0;
bool impersonated = false;
IntPtr target = (IntPtr)0;
Expand All @@ -44,7 +43,7 @@
try
{
// get the policy handle first
handle = Utils.GetPolicyHandle(serverName);
using var handle = Utils.GetPolicyHandle(serverName);

// get the target name
global::Interop.UNICODE_STRING trustedDomainName;
Expand Down Expand Up @@ -123,7 +122,6 @@

internal static unsafe void SetTrustedDomainInfoStatus(DirectoryContext context, string? sourceName, string targetName, Interop.Advapi32.TRUST_ATTRIBUTE attribute, bool status, bool isForest)
{
SafeLsaPolicyHandle? handle = null;
IntPtr buffer = (IntPtr)0;
IntPtr newInfo = (IntPtr)0;
bool impersonated = false;
Expand All @@ -139,7 +137,7 @@
try
{
// get the policy handle first
handle = Utils.GetPolicyHandle(serverName);
using var handle = Utils.GetPolicyHandle(serverName);

// get the target name
global::Interop.UNICODE_STRING trustedDomainName;
Expand Down Expand Up @@ -251,7 +249,6 @@

internal static unsafe void DeleteTrust(DirectoryContext sourceContext, string? sourceName, string? targetName, bool isForest)
{
SafeLsaPolicyHandle? policyHandle = null;
bool impersonated = false;
IntPtr target = (IntPtr)0;
string? serverName = null;
Expand All @@ -266,7 +263,7 @@
try
{
// get the policy handle
policyHandle = Utils.GetPolicyHandle(serverName);
using var policyHandle = Utils.GetPolicyHandle(serverName);

// get the target name
global::Interop.UNICODE_STRING trustedDomainName;
Expand Down Expand Up @@ -327,7 +324,6 @@

internal static void VerifyTrust(DirectoryContext context, string? sourceName, string? targetName, bool isForest, TrustDirection direction, bool forceSecureChannelReset, string? preferredTargetServer)
{
SafeLsaPolicyHandle? policyHandle = null;
int win32Error = 0;
IntPtr data = (IntPtr)0;
IntPtr ptr = (IntPtr)0;
Expand All @@ -346,7 +342,7 @@
try
{
// get the policy handle
policyHandle = Utils.GetPolicyHandle(policyServerName);
using var policyHandle = Utils.GetPolicyHandle(policyServerName);

// get the target name
global::Interop.UNICODE_STRING trustedDomainName;
Expand Down Expand Up @@ -446,7 +442,6 @@
IntPtr unmanagedPassword = (IntPtr)0;
IntPtr info = (IntPtr)0;
IntPtr domainHandle = (IntPtr)0;
SafeLsaPolicyHandle? policyHandle = null;
IntPtr unmanagedAuthData = (IntPtr)0;
bool impersonated = false;
string? serverName = null;
Expand Down Expand Up @@ -517,7 +512,7 @@

// do impersonation and get policy handle
impersonated = Utils.Impersonate(sourceContext);
policyHandle = Utils.GetPolicyHandle(serverName);
using var policyHandle = Utils.GetPolicyHandle(serverName);

uint result = Interop.Advapi32.LsaCreateTrustedDomainEx(policyHandle, tdi, AuthInfoEx, TRUSTED_SET_POSIX | TRUSTED_SET_AUTH, out domainHandle);
if (result != 0)
Expand Down Expand Up @@ -560,7 +555,6 @@

internal static unsafe string UpdateTrust(DirectoryContext context, string? sourceName, string? targetName, string password, bool isForest)
{
SafeLsaPolicyHandle? handle = null;
IntPtr buffer = (IntPtr)0;
IntPtr newBuffer = (IntPtr)0;
bool impersonated = false;
Expand All @@ -581,7 +575,7 @@
try
{
// get the policy handle first
handle = Utils.GetPolicyHandle(serverName);
using var handle = Utils.GetPolicyHandle(serverName);

// get the target name
global::Interop.UNICODE_STRING trustedDomainName;
Expand Down Expand Up @@ -691,7 +685,6 @@

internal static unsafe void UpdateTrustDirection(DirectoryContext context, string? sourceName, string? targetName, string password, bool isForest, TrustDirection newTrustDirection)
{
SafeLsaPolicyHandle? handle = null;
IntPtr buffer = (IntPtr)0;
IntPtr newBuffer = (IntPtr)0;
bool impersonated = false;
Expand All @@ -711,7 +704,7 @@
try
{
// get the policy handle first
handle = Utils.GetPolicyHandle(serverName);
using var handle = Utils.GetPolicyHandle(serverName);

// get the target name
global::Interop.UNICODE_STRING trustedDomainName;
Expand Down Expand Up @@ -1016,6 +1009,8 @@
}
finally
{
policyHandle?.Dispose();

Check failure on line 1013 in src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_WithPackages)

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs#L1013

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs(1013,1): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 1013 in src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_WithPackages)

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs#L1013

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs(1013,1): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 1013 in src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_WithPackages)

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs#L1013

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs(1013,1): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 1013 in src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs#L1013

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs(1013,1): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 1013 in src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs#L1013

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs(1013,1): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 1013 in src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs#L1013

src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/TrustHelper.cs(1013,1): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)
if (impersonated)
Utils.Revert();
}
Expand Down
Loading