Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/rabbit_auth_backend_ldap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,18 @@ with_ldap({ok, Creds}, Fun, Servers) ->
Opts1 = case env(log) of
network ->
Pre = " LDAP network traffic: ",
rabbit_log:info(
rabbit_log_ldap:info(
" LDAP connecting to servers: ~p~n", [Servers]),
[{log, fun(1, S, A) -> rabbit_log:warning(Pre ++ S, A);
[{log, fun(1, S, A) -> rabbit_log_ldap:warning(Pre ++ S, A);
(2, S, A) ->
rabbit_log:info(Pre ++ S, scrub_creds(A, []))
rabbit_log_ldap:info(Pre ++ S, scrub_creds(A, []))
end} | Opts0];
network_unsafe ->
Pre = " LDAP network traffic: ",
rabbit_log:info(
rabbit_log_ldap:info(
" LDAP connecting to servers: ~p~n", [Servers]),
[{log, fun(1, S, A) -> rabbit_log:warning(Pre ++ S, A);
(2, S, A) -> rabbit_log:info( Pre ++ S, A)
[{log, fun(1, S, A) -> rabbit_log_ldap:warning(Pre ++ S, A);
(2, S, A) -> rabbit_log_ldap:info( Pre ++ S, A)
end} | Opts0];
_ ->
Opts0
Expand All @@ -499,7 +499,7 @@ with_ldap({ok, Creds}, Fun, Servers) ->
with_login(Creds, Servers, Opts, Fun) ->
with_login(Creds, Servers, Opts, Fun, ?LDAP_OPERATION_RETRIES).
with_login(_Creds, _Servers, _Opts, _Fun, 0 = _RetriesLeft) ->
rabbit_log:warning("LDAP failed to perform an operation. TCP connection to a LDAP server was closed or otherwise defunct. Exhausted all retries."),
rabbit_log_ldap:warning("LDAP failed to perform an operation. TCP connection to a LDAP server was closed or otherwise defunct. Exhausted all retries."),
{error, ldap_connect_error};
with_login(Creds, Servers, Opts, Fun, RetriesLeft) ->
case get_or_create_conn(Creds == anon, Servers, Opts) of
Expand Down Expand Up @@ -553,9 +553,9 @@ with_login(Creds, Servers, Opts, Fun, RetriesLeft) ->

purge_connection(Creds, Servers, Opts) ->
%% purge and retry with a new connection
rabbit_log:warning("TCP connection to a LDAP server was closed or otherwise defunct."),
rabbit_log_ldap:warning("TCP connection to a LDAP server was closed or otherwise defunct."),
purge_conn(Creds == anon, Servers, Opts),
rabbit_log:warning("LDAP will retry with a new connection.").
rabbit_log_ldap:warning("LDAP will retry with a new connection.").

call_ldap_fun(Fun, LDAP) ->
call_ldap_fun(Fun, LDAP, "").
Expand Down Expand Up @@ -645,7 +645,7 @@ purge_conn(IsAnon, Servers, Opts) ->
Conns = get(ldap_conns),
Key = {IsAnon, Servers, Opts},
{ok, Conn} = maps:find(Key, Conns),
rabbit_log:warning("LDAP will purge an already closed or defunct LDAP server connection from the pool"),
rabbit_log_ldap:warning("LDAP will purge an already closed or defunct LDAP server connection from the pool"),
% We cannot close the connection with eldap:close/1 because as of OTP-13327
% eldap will try to do_unbind first and will fail with a `{gen_tcp_error, closed}`.
% Since we know that the connection is already closed, we just
Expand Down Expand Up @@ -769,7 +769,7 @@ dn_lookup(Username, LDAP) ->
?L1("DN lookup: ~s -> ~s", [Username, DN]),
DN;
{ok, #eldap_search_result{entries = Entries}} ->
rabbit_log:warning("Searching for DN for ~s, got back ~p~n",
rabbit_log_ldap:warning("Searching for DN for ~s, got back ~p~n",
[Filled, Entries]),
Filled;
{error, _} = E ->
Expand Down Expand Up @@ -852,7 +852,7 @@ to_list(S) -> {error, {badarg, S}}.

log(Fmt, Args) -> case env(log) of
false -> ok;
_ -> rabbit_log:info(Fmt ++ "~n", Args)
_ -> rabbit_log_ldap:info(Fmt ++ "~n", Args)
end.

fill(Fmt, Args) ->
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_auth_backend_ldap_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ start(_Type, _StartArgs) ->
{ok, Backends} = application:get_env(rabbit, auth_backends),
case configured(rabbit_auth_backend_ldap, Backends) of
true -> ok;
false -> rabbit_log:warning(
false -> rabbit_log_ldap:warning(
"LDAP plugin loaded, but rabbit_auth_backend_ldap is not "
"in the list of auth_backends. LDAP auth will not work.~n")
end,
Expand Down