Skip to content

Commit

Permalink
Merge pull request #16808 from kastakhov/anon-ldap
Browse files Browse the repository at this point in the history
Fix anonymous bind to LDAP server
  • Loading branch information
hellcp-work authored Sep 6, 2024
2 parents cd6b59e + a354257 commit d85a46b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api/app/models/user_ldap_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def try_ldap_con(server, user_name, password)
# implicitly turn array into string
user_name = [user_name].flatten.join

# LDAP bind quietly dies when user_name or password is nil
# password can be nil in case of passwordless authentication or anonymous bind
password ||= ''

Rails.logger.debug { "UserLdapStrategy: Connecting to server '#{server}' as user '#{user_name}'" }
port = ldap_port

Expand All @@ -191,7 +195,7 @@ def try_ldap_con(server, user_name, password)
Rails.logger.info("UserLdapStrategy: Failed to bind as user '#{user_name}': #{con.err2string(con.err)}")
return
end
Rails.logger.debug { "UserLdapStrategy: Bound as #{user_name}" }
Rails.logger.debug { "UserLdapStrategy: Bound as '#{user_name}'" }
con
end

Expand Down

0 comments on commit d85a46b

Please sign in to comment.