@@ -352,9 +352,15 @@ search_groups(LDAP, Desc, GroupsBase, Scope, DN) ->
352
352
[];
353
353
{ok , {referral , Referrals }} ->
354
354
{error , {referrals_not_supported , Referrals }};
355
- {ok , # eldap_search_result {entries = []}} ->
355
+ % % support #eldap_search_result before and after
356
+ % % https://github.com/erlang/otp/pull/5538
357
+ {ok , {eldap_search_result , [], _Referrals }} ->
356
358
[];
357
- {ok , # eldap_search_result {entries = Entries }} ->
359
+ {ok , {eldap_search_result , [], _Referrals , _Controls }}->
360
+ [];
361
+ {ok , {eldap_search_result , Entries , _Referrals }} ->
362
+ [ON || # eldap_entry {object_name = ON } <- Entries ];
363
+ {ok , {eldap_search_result , Entries , _Referrals , _Controls }} ->
358
364
[ON || # eldap_entry {object_name = ON } <- Entries ]
359
365
end .
360
366
@@ -438,7 +444,11 @@ object_exists(DN, Filter, LDAP) ->
438
444
{scope , eldap :baseObject ()}]) of
439
445
{ok , {referral , Referrals }} ->
440
446
{error , {referrals_not_supported , Referrals }};
441
- {ok , # eldap_search_result {entries = Entries }} ->
447
+ % % support #eldap_search_result before and after
448
+ % % https://github.com/erlang/otp/pull/5538
449
+ {ok , {eldap_search_result , Entries , _Referrals }} ->
450
+ length (Entries ) > 0 ;
451
+ {ok , {eldap_search_result , Entries , _Referrals , _Controls }} ->
442
452
length (Entries ) > 0 ;
443
453
{error , _ } = E ->
444
454
E
@@ -451,9 +461,15 @@ attribute(DN, AttributeName, LDAP) ->
451
461
{attributes , [AttributeName ]}]) of
452
462
{ok , {referral , Referrals }} ->
453
463
{error , {referrals_not_supported , Referrals }};
454
- {ok , # eldap_search_result {entries = E = [# eldap_entry {}|_ ]}} ->
464
+ % % support #eldap_search_result before and after
465
+ % % https://github.com/erlang/otp/pull/5538
466
+ {ok , {eldap_search_result , E = [# eldap_entry {}|_ ], _Referrals }} ->
455
467
get_attributes (AttributeName , E );
456
- {ok , # eldap_search_result {entries = _ }} ->
468
+ {ok , {eldap_search_result , E = [# eldap_entry {}|_ ], _Referrals , _Controls }} ->
469
+ get_attributes (AttributeName , E );
470
+ {ok , {eldap_search_result , _Entries , _Referrals }} ->
471
+ {error , not_found };
472
+ {ok , {eldap_search_result , _Entries , _Referrals , _Controls }} ->
457
473
{error , not_found };
458
474
{error , _ } = E ->
459
475
E
@@ -829,15 +845,19 @@ dn_lookup(Username, LDAP) ->
829
845
{attributes , [" distinguishedName" ]}]) of
830
846
{ok , {referral , Referrals }} ->
831
847
{error , {referrals_not_supported , Referrals }};
832
- % % support #eldap_search_result before and after
833
- % % https://github.com/erlang/otp/pull/5538
848
+ % % support #eldap_search_result before and after
849
+ % % https://github.com/erlang/otp/pull/5538
834
850
{ok , {eldap_search_result , [# eldap_entry {object_name = DN }], _Referrals }}->
835
851
? L1 (" DN lookup: ~s -> ~s " , [Username , DN ]),
836
852
DN ;
837
853
{ok , {eldap_search_result , [# eldap_entry {object_name = DN }], _Referrals , _Controls }}->
838
854
? L1 (" DN lookup: ~s -> ~s " , [Username , DN ]),
839
855
DN ;
840
- {ok , # eldap_search_result {entries = Entries }} ->
856
+ {ok , {eldap_search_result , Entries , _Referrals }} ->
857
+ rabbit_log_ldap :warning (" Searching for DN for ~s , got back ~p " ,
858
+ [Filled , Entries ]),
859
+ Filled ;
860
+ {ok , {eldap_search_result , Entries , _Referrals , _Controls }} ->
841
861
rabbit_log_ldap :warning (" Searching for DN for ~s , got back ~p " ,
842
862
[Filled , Entries ]),
843
863
Filled ;
0 commit comments