@@ -706,18 +706,19 @@ eldap_open(Servers, Opts) ->
706706ssl_conf () ->
707707 % % We must make sure not to add SSL options unless a) we have at least R16A
708708 % % b) we have SSL turned on (or it breaks StartTLS...)
709- case env (use_ssl ) of
709+ case env (use_ssl , false ) of
710710 false -> [{ssl , false }];
711711 true -> % % Only the unfixed version can be []
712712 case env (ssl_options ) of
713- [] -> [{ssl , true }];
714- _ -> [{ssl , true }, {sslopts , ssl_options ()}]
713+ [] -> [{ssl , true }];
714+ undefined -> [{ssl , true }];
715+ _ -> [{ssl , true }, {sslopts , ssl_options ()}]
715716 end
716717 end .
717718
718719ssl_options () ->
719720 Opts0 = rabbit_networking :fix_ssl_options (env (ssl_options )),
720- case env (ssl_hostname_verification ) of
721+ case env (ssl_hostname_verification , undefined ) of
721722 wildcard ->
722723 rabbit_log_ldap :debug (" Enabling wildcard-aware hostname verification for LDAP client connections" ),
723724 % % Needed for non-HTTPS connections that connect to servers that use wildcard certificates.
@@ -745,8 +746,13 @@ get_expected_env_str(Key, Default) ->
745746 rabbit_data_coercion :to_list (V ).
746747
747748env (Key ) ->
748- {ok , V } = application :get_env (rabbitmq_auth_backend_ldap , Key ),
749- V .
749+ case application :get_env (rabbitmq_auth_backend_ldap , Key ) of
750+ {ok , V } -> V ;
751+ undefined -> undefined
752+ end .
753+
754+ env (Key , Default ) ->
755+ application :get_env (rabbitmq_auth_backend_ldap , Key , Default ).
750756
751757login_fun (User , UserDN , Password , AuthProps ) ->
752758 fun (L ) -> case pget (vhost , AuthProps ) of
@@ -897,17 +903,12 @@ scrub_rdn([DN|Rem], Acc) ->
897903 scrub_rdn (Rem , [string :join (DN0 , " =" )|Acc ]).
898904
899905is_dn (S ) when is_list (S ) ->
900- case catch string :tokens (to_list (S ), " =" ) of
906+ case catch string :tokens (rabbit_data_coercion : to_list (S ), " =" ) of
901907 L when length (L ) > 1 -> true ;
902908 _ -> false
903909 end ;
904910is_dn (_S ) -> false .
905911
906- to_list (S ) when is_list (S ) -> S ;
907- to_list (S ) when is_binary (S ) -> binary_to_list (S );
908- to_list (S ) when is_atom (S ) -> atom_to_list (S );
909- to_list (S ) -> {error , {badarg , S }}.
910-
911912log (Fmt , Args ) -> case env (log ) of
912913 false -> ok ;
913914 _ -> rabbit_log_ldap :info (Fmt ++ " ~n " , Args )
0 commit comments