Skip to content

Commit 29d2f58

Browse files
committed
ldap auth backend: Drop support for pre-OTP-25 search results
The search results record change was done in OTP-25, which is no longer supported. So we can use the modern search results record and drop the compatibility clauses. For more context: * 8d8847e * erlang/otp#5538
1 parent 532404d commit 29d2f58

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,8 @@ search_groups(LDAP, Desc, GroupsBase, Scope, DN) ->
378378
[];
379379
{ok, {referral, Referrals}} ->
380380
{error, {referrals_not_supported, Referrals}};
381-
%% support #eldap_search_result before and after
382-
%% https://github.com/erlang/otp/pull/5538
383-
{ok, {eldap_search_result, [], _Referrals}} ->
384-
[];
385381
{ok, {eldap_search_result, [], _Referrals, _Controls}}->
386382
[];
387-
{ok, {eldap_search_result, Entries, _Referrals}} ->
388-
[ON || #eldap_entry{object_name = ON} <- Entries];
389383
{ok, {eldap_search_result, Entries, _Referrals, _Controls}} ->
390384
[ON || #eldap_entry{object_name = ON} <- Entries]
391385
end.
@@ -470,10 +464,6 @@ object_exists(DN, Filter, LDAP) ->
470464
{scope, eldap:baseObject()}]) of
471465
{ok, {referral, Referrals}} ->
472466
{error, {referrals_not_supported, Referrals}};
473-
%% support #eldap_search_result before and after
474-
%% https://github.com/erlang/otp/pull/5538
475-
{ok, {eldap_search_result, Entries, _Referrals}} ->
476-
length(Entries) > 0;
477467
{ok, {eldap_search_result, Entries, _Referrals, _Controls}} ->
478468
length(Entries) > 0;
479469
{error, _} = E ->
@@ -487,14 +477,8 @@ attribute(DN, AttributeName, LDAP) ->
487477
{attributes, [AttributeName]}]) of
488478
{ok, {referral, Referrals}} ->
489479
{error, {referrals_not_supported, Referrals}};
490-
%% support #eldap_search_result before and after
491-
%% https://github.com/erlang/otp/pull/5538
492-
{ok, {eldap_search_result, E = [#eldap_entry{}|_], _Referrals}} ->
493-
get_attributes(AttributeName, E);
494480
{ok, {eldap_search_result, E = [#eldap_entry{}|_], _Referrals, _Controls}} ->
495481
get_attributes(AttributeName, E);
496-
{ok, {eldap_search_result, _Entries, _Referrals}} ->
497-
{error, not_found};
498482
{ok, {eldap_search_result, _Entries, _Referrals, _Controls}} ->
499483
{error, not_found};
500484
{error, _} = E ->
@@ -890,18 +874,9 @@ dn_lookup(Username, LDAP) ->
890874
{attributes, ["distinguishedName"]}]) of
891875
{ok, {referral, Referrals}} ->
892876
{error, {referrals_not_supported, Referrals}};
893-
%% support #eldap_search_result before and after
894-
%% https://github.com/erlang/otp/pull/5538
895-
{ok, {eldap_search_result, [#eldap_entry{object_name = DN}], _Referrals}}->
896-
?L1("DN lookup: ~ts -> ~ts", [Username, DN]),
897-
DN;
898877
{ok, {eldap_search_result, [#eldap_entry{object_name = DN}], _Referrals, _Controls}}->
899878
?L1("DN lookup: ~ts -> ~ts", [Username, DN]),
900879
DN;
901-
{ok, {eldap_search_result, Entries, _Referrals}} ->
902-
rabbit_log_ldap:warning("Searching for DN for ~ts, got back ~tp",
903-
[Filled, Entries]),
904-
Filled;
905880
{ok, {eldap_search_result, Entries, _Referrals, _Controls}} ->
906881
rabbit_log_ldap:warning("Searching for DN for ~ts, got back ~tp",
907882
[Filled, Entries]),

0 commit comments

Comments
 (0)