mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-03 13:58:41 +00:00
Merge branch 'fix/ldap' into 'develop'
Fix LDAP support See merge request pleroma/pleroma!4168
This commit is contained in:
commit
7a4687562a
3 changed files with 30 additions and 19 deletions
1
changelog.d/ldap.fix
Normal file
1
changelog.d/ldap.fix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix LDAP support
|
|
@ -102,7 +102,20 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
||||||
{:scope, :eldap.wholeSubtree()},
|
{:scope, :eldap.wholeSubtree()},
|
||||||
{:timeout, @search_timeout}
|
{:timeout, @search_timeout}
|
||||||
]) do
|
]) do
|
||||||
{:ok, {:eldap_search_result, [{:eldap_entry, _, attributes}], _}} ->
|
# The :eldap_search_result record structure changed in OTP 24.3 and added a controls field
|
||||||
|
# https://github.com/erlang/otp/pull/5538
|
||||||
|
{:ok, {:eldap_search_result, [{:eldap_entry, _object, attributes}], _referrals}} ->
|
||||||
|
try_register(name, attributes)
|
||||||
|
|
||||||
|
{:ok, {:eldap_search_result, [{:eldap_entry, _object, attributes}], _referrals, _controls}} ->
|
||||||
|
try_register(name, attributes)
|
||||||
|
|
||||||
|
error ->
|
||||||
|
error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp try_register(name, attributes) do
|
||||||
params = %{
|
params = %{
|
||||||
name: name,
|
name: name,
|
||||||
nickname: name,
|
nickname: name,
|
||||||
|
@ -121,9 +134,5 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
||||||
{:ok, user} -> user
|
{:ok, user} -> user
|
||||||
error -> error
|
error -> error
|
||||||
end
|
end
|
||||||
|
|
||||||
error ->
|
|
||||||
error
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
3
mix.exs
3
mix.exs
|
@ -80,7 +80,8 @@ defmodule Pleroma.Mixfile do
|
||||||
:comeonin,
|
:comeonin,
|
||||||
:fast_sanitize,
|
:fast_sanitize,
|
||||||
:os_mon,
|
:os_mon,
|
||||||
:ssl
|
:ssl,
|
||||||
|
:eldap
|
||||||
] ++ logger_application(),
|
] ++ logger_application(),
|
||||||
included_applications: [:ex_syslogger]
|
included_applications: [:ex_syslogger]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue