11using System . DirectoryServices ;
22using System . DirectoryServices . ActiveDirectory ;
3+ using System . Globalization ;
34using System . Net ;
45using DSInternals . Common ;
56using DSInternals . Common . Data ;
@@ -10,7 +11,7 @@ namespace DSInternals.ADSI;
1011public sealed class AdsiClient : IDisposable
1112{
1213 private const string NetbiosNameFilterFormat = "(&(objectCategory=crossRef)(nETBIOSName=*)(dnsroot={0}))" ;
13- private static readonly string [ ] NetbiosNamePropertiesToLoad = [ CommonDirectoryAttributes . NetBIOSName ] ;
14+ private static readonly string [ ] NetbiosNamePropertiesToLoad = [ CommonDirectoryAttributes . NetBIOSName ] ;
1415 private const string AccountsFilter = "(objectClass=user)" ;
1516
1617 private DirectoryContext _directoryContext ;
@@ -41,7 +42,7 @@ public AdsiClient(string server = null, NetworkCredential credential = null)
4142 // Resolve the domain partition
4243 _domainNamingContext = dc . Domain . GetDirectoryEntry ( ) ;
4344 _dnsDomainName = dc . Domain . Name ;
44-
45+
4546 // Resolve the configuration partition
4647 _configurationNamingContext = GetConfigurationNamingContext ( dc ) ;
4748 }
@@ -131,7 +132,7 @@ public IEnumerable<DSAccount> GetAccounts(AccountPropertySets propertySets = Acc
131132 CommonDirectoryAttributes . Description ,
132133 CommonDirectoryAttributes . PasswordLastSet
133134 ] ) ;
134- }
135+ }
135136
136137 if ( propertySets . HasFlag ( AccountPropertySets . GenericUserInfo ) )
137138 {
@@ -249,7 +250,7 @@ public void Dispose()
249250 /// <exception cref="InvalidOperationException">Thrown if the NetBIOS domain name cannot be found for the current DNS domain name.</exception>
250251 private string GetNetbiosDomainName ( )
251252 {
252- string netbiosNameFilter = string . Format ( NetbiosNameFilterFormat , _dnsDomainName ) ;
253+ string netbiosNameFilter = string . Format ( CultureInfo . InvariantCulture , NetbiosNameFilterFormat , _dnsDomainName ) ;
253254
254255 using ( var netbiosNameSearcher = new DirectorySearcher ( _configurationNamingContext , netbiosNameFilter , NetbiosNamePropertiesToLoad , SearchScope . Subtree ) )
255256 {
0 commit comments