Skip to content

Commit 5dee48d

Browse files
committed
* Add test for ssl_options.depth validation
1 parent addd62e commit 5dee48d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_mgmt.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ tls_options(BodyMap) when is_map_key(ssl_options, BodyMap) ->
197197
undefined ->
198198
TlsOpts4;
199199
DepthValue ->
200-
Depth = rabbit_data_coercion:to_integer(DepthValue),
200+
Depth = safe_parse_int(DepthValue, "ssl_options.depth"),
201201
[{depth, Depth} | TlsOpts4]
202202
end,
203203
TlsOpts6 = case maps:get(<<"versions">>, SslOptionsMap, undefined) of

deps/rabbitmq_auth_backend_ldap/test/system_SUITE.erl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,20 @@ validate_ldap_configuration_via_api(Config) ->
588588
'cacertfile' => CaCertfile
589589
}
590590
}, ?BAD_REQUEST),
591+
592+
%% Invalid depth value - string instead of integer
593+
http_put(Config, "/ldap/validate/simple-bind",
594+
#{
595+
'user_dn' => AliceUserDN,
596+
'password' => Password,
597+
'servers' => ["localhost"],
598+
'port' => LdapTlsPort,
599+
'use_ssl' => true,
600+
'ssl_options' => #{
601+
'depth' => "not_a_number",
602+
'cacertfile' => CaCertfile
603+
}
604+
}, ?BAD_REQUEST),
591605
http_put(Config, "/ldap/validate/simple-bind",
592606
#{
593607
'user_dn' => AliceUserDN,

0 commit comments

Comments
 (0)