Skip to content

Commit

Permalink
Code Rabbit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Riku Virtanen committed Nov 6, 2024
1 parent 73f659f commit 9de5a89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public class Connection

/// <summary>
/// Used LDAP protocol version.
/// Warning: LDAPv2 is deprecated and has security vulnerabilities. Use LDAPv3 unless absolutely required.
/// </summary>
/// <example>V2</example>
/// <example>LDAPVersion.V3</example>
[DefaultValue(LDAPVersion.V3)]
public LDAPVersion LDAPProtocolVersion { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static Result SearchObjects([PropertyTab] Input input, [PropertyTab] Conn
foreach (var i in input.Attributes)
atr.Add(i.Key.ToString());

var ldapVersion = 0;
// Default to v3 as it's the most commonly used version
var ldapVersion = 3;
switch (connection.LDAPProtocolVersion)
{
case LDAPVersion.V2:
Expand All @@ -52,6 +53,8 @@ public static Result SearchObjects([PropertyTab] Input input, [PropertyTab] Conn
case LDAPVersion.V3:
ldapVersion = 3;
break;
default:
throw new ArgumentException("Unsupported LDAP protocol version");
}

try
Expand Down

0 comments on commit 9de5a89

Please sign in to comment.