Skip to content

Commit 9083663

Browse files
committed
Fix LDAP case sensitivity
1 parent 14d8765 commit 9083663

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

TheSprayer/ActiveDirectoryService.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public void SprayPasswords(IEnumerable<string> passwords, IEnumerable<string> us
228228
//Filter users down to the list passed in (if any)
229229
if (usersToSpray != null)
230230
{
231-
users = users.Where(u => usersToSpray.Contains(u.SamAccountName)).ToList();
231+
users = users.Where(u => usersToSpray.Any(u2 => u2.ToLower() == u.SamAccountName.ToLower())).ToList();
232232
if (!users.Any())
233233
{
234234
Console.WriteLine("No users, exiting!");
@@ -360,8 +360,6 @@ public bool TryValidateCredentials(string username, string password)
360360
{
361361
return false;
362362
}
363-
364-
365363
}
366364

367365
private LdapConnection CreateLdapConnection()

TheSprayer/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Program
1111
public static void Main(string[] args)
1212
{
1313
Parser.Default.ParseArguments<CommandLineOptions>(args).WithParsed(o =>
14-
{
14+
{
1515
IEnumerable<string> passwords, users;
1616
int remainingAttempts;
1717

0 commit comments

Comments
 (0)