Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if ResolveAccountName returns a value #90

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
10 changes: 10 additions & 0 deletions src/CommonLib/Processors/GPOLocalGroupProcessor.cs
Original file line number Diff line number Diff line change
@@ -531,6 +531,11 @@ internal IEnumerable<GroupAction> ProcessGPOXmlFile(string basePath, string gpoD
var domain = s[0];

var res = _utils.ResolveAccountName(name, domain);
if (res == null)
{
_log.LogWarning("Failed to resolve member {memberName}", memberName);
continue;
}
ga.Target = GroupActionTarget.LocalGroup;
ga.TargetSid = res.ObjectIdentifier;
ga.TargetType = res.ObjectType;
@@ -540,6 +545,11 @@ internal IEnumerable<GroupAction> ProcessGPOXmlFile(string basePath, string gpoD
else
{
var res = _utils.ResolveAccountName(memberName, gpoDomain);
if (res == null)
{
_log.LogWarning("Failed to resolve member {memberName}", memberName);
continue;
}
ga.Target = GroupActionTarget.LocalGroup;
ga.TargetSid = res.ObjectIdentifier;
ga.TargetType = res.ObjectType;

Unchanged files with check annotations Beta

}
[Fact]
public async Task LocalGroupProcessor_ResolveGroupName_NonDC()

Check warning on line 77 in test/unit/LocalGroupProcessorTest.cs

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var mockUtils = new Mock<MockLDAPUtils>();
var proc = new LocalGroupProcessor(mockUtils.Object);
}
[Fact]
public async Task LocalGroupProcessor_ResolveGroupName_DC()

Check warning on line 94 in test/unit/LocalGroupProcessorTest.cs

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var mockUtils = new Mock<MockLDAPUtils>();
var proc = new LocalGroupProcessor(mockUtils.Object);
}
[Fact]
public async Task GPOLocalGroupProcess_ProcessGPOXMLFile_NoFile()

Check warning on line 209 in test/unit/GPOLocalGroupProcessorTest.cs

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var mockLDAPUtils = new Mock<ILDAPUtils>();
var processor = new GPOLocalGroupProcessor(mockLDAPUtils.Object);
}
[Fact]
public async Task GPOLocalGroupProcess_ProcessGPOXMLFile_Disabled()

Check warning on line 221 in test/unit/GPOLocalGroupProcessorTest.cs

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var mockLDAPUtils = new Mock<ILDAPUtils>();
var gpcFileSysPath = Path.GetTempPath();
}
[Fact]
public async Task GPOLocalGroupProcessor_ProcessGPOXMLFile()

Check warning on line 238 in test/unit/GPOLocalGroupProcessorTest.cs

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var mockLDAPUtils = new Mock<ILDAPUtils>();
mockLDAPUtils.Setup(x => x.ResolveAccountName(It.IsAny<string>(), It.IsAny<string>()))
{
var expectedPrincipalType = Label.Group;
var expectedPrincipalSID = "S-1-5-21-3130019616-2776909439-2417379446-512";
var expectedRightName = EdgeNames.GetChangesAll;

Check warning on line 695 in test/unit/ACLProcessorTest.cs

GitHub Actions / build

The variable 'expectedRightName' is assigned but its value is never used
var unmatchedGuid = new Guid("583991c8-629d-4a07-8a70-74d19d22ac9c");
var mockLDAPUtils = new Mock<ILDAPUtils>();
{
var expectedPrincipalType = Label.Group;
var expectedPrincipalSID = "S-1-5-21-3130019616-2776909439-2417379446-512";
var expectedRightName = EdgeNames.AllExtendedRights;

Check warning on line 802 in test/unit/ACLProcessorTest.cs

GitHub Actions / build

The variable 'expectedRightName' is assigned but its value is never used
var mockLDAPUtils = new Mock<ILDAPUtils>();
var mockSecurityDescriptor = new Mock<ActiveDirectorySecurityDescriptor>(MockBehavior.Loose, null);
{
var expectedPrincipalType = Label.Group;
var expectedPrincipalSID = "S-1-5-21-3130019616-2776909439-2417379446-512";
var expectedRightName = EdgeNames.AllExtendedRights;

Check warning on line 876 in test/unit/ACLProcessorTest.cs

GitHub Actions / build

The variable 'expectedRightName' is assigned but its value is never used
var mockLDAPUtils = new Mock<ILDAPUtils>();
var mockSecurityDescriptor = new Mock<ActiveDirectorySecurityDescriptor>(MockBehavior.Loose, null);