Sanitize AD unsafe NTFS group name characters

This commit is contained in:
Meik
2026-05-08 23:19:54 +02:00
parent 2b460ccc1a
commit 2a290b5f86
2 changed files with 7 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ namespace C4IT_IAM_Engine
public const int MaxAdGroupDescriptionLength = 1024;
public const int MaxAdGroupLoopDigits = 3;
public const string DefaultGroupNameSanitizeReplacement = "_";
private const string AdUnsafeGroupNameCharactersPattern = @"[\x00-\x1F\s\-\/\\\[\]:;\|=,\+\*\?<>\@()'""]";
private const int MinLeadingRelativePathSegmentLength = 3;
private const int MinSingleLeadingRelativePathSegmentLength = 2;
private const int MinLastRelativePathSegmentLength = 12;
@@ -211,7 +212,7 @@ namespace C4IT_IAM_Engine
return string.Empty;
var replacement = NormalizeGroupNameSanitizeReplacement(groupNameSanitizeReplacement);
return Regex.Replace(segment, @"[\s\-]", match => replacement);
return Regex.Replace(segment, AdUnsafeGroupNameCharactersPattern, match => replacement);
}
public static string NormalizeGroupNameSanitizeReplacement(string replacement)