Skip to content

Commit

Permalink
feat(user): add ldap escape filter for user
Browse files Browse the repository at this point in the history
- it would be better to escape the `name` in ReadUser function attributes.

Signed-off-by: Hy3n4 <[email protected]>
  • Loading branch information
Hy3n4 committed Dec 13, 2023
1 parent 75317ae commit f1c4236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ldap/data_source_resource_ldap_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func dataSourceLDAPUserRead(ctx context.Context, d *schema.ResourceData, m inter
func resourceLDAPUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
client := m.(*goldap.Client)

user, err := client.ReadUser(d.Get("ou").(string), d.Get("name").(string), d.Get("sam_account_name").(string), d.Get("user_principal_name").(string))
user, err := client.ReadUser(d.Get("ou").(string), ldap.EscapeFilter(d.Get("name").(string)), d.Get("sam_account_name").(string), d.Get("user_principal_name").(string))

if err != nil {
if err.(*ldap.Error).ResultCode == ldap.LDAPResultNoSuchObject {
Expand Down

0 comments on commit f1c4236

Please sign in to comment.