@@ -48,6 +48,7 @@ groups() ->
4848 test_update_secret ,
4949 cannot_update_username_after_authenticated ,
5050 cannot_use_another_authmechanism_when_updating_secret ,
51+ update_secret_should_close_connection_if_wrong_secret ,
5152 unauthenticated_client_rejected_tcp_connected ,
5253 timeout_tcp_connected ,
5354 unauthenticated_client_rejected_peer_properties_exchanged ,
@@ -292,22 +293,30 @@ test_update_secret(Config) ->
292293
293294cannot_update_username_after_authenticated (Config ) ->
294295 {S , C0 } = connect_and_authenticate (gen_tcp , Config ),
295- C1 = expect_unsuccessful_authentication (
296- try_authenticate (gen_tcp , S , C0 , <<" PLAIN" >>, <<" other" >>, <<" other" >>),
297- ? RESPONSE_SASL_CANNOT_CHANGE_USERNAME ),
298- _C2 = test_close (gen_tcp , S , C1 ),
296+ _C1 = expect_unsuccessful_authentication (
297+ try_authenticate (gen_tcp , S , C0 , <<" PLAIN" >>, <<" other" >>, <<" other" >>),
298+ ? RESPONSE_SASL_CANNOT_CHANGE_USERNAME ),
299299 closed = wait_for_socket_close (gen_tcp , S , 10 ),
300300 ok .
301301
302302cannot_use_another_authmechanism_when_updating_secret (Config ) ->
303303 {S , C0 } = connect_and_authenticate (gen_tcp , Config ),
304- C1 = expect_unsuccessful_authentication (
305- try_authenticate (gen_tcp , S , C0 , <<" EXTERNAL" >>, <<" guest" >>, <<" new_password" >>),
306- ? RESPONSE_SASL_CANNOT_CHANGE_MECHANISM ),
307- _C2 = test_close (gen_tcp , S , C1 ),
304+ _C1 = expect_unsuccessful_authentication (
305+ try_authenticate (gen_tcp , S , C0 , <<" EXTERNAL" >>, <<" guest" >>, <<" new_password" >>),
306+ ? RESPONSE_SASL_CANNOT_CHANGE_MECHANISM ),
308307 closed = wait_for_socket_close (gen_tcp , S , 10 ),
309308 ok .
310309
310+ update_secret_should_close_connection_if_wrong_secret (Config ) ->
311+ Transport = gen_tcp ,
312+ {S , C0 } = connect_and_authenticate (Transport , Config ),
313+ Pwd = rand :bytes (20 ),
314+ _C1 = expect_unsuccessful_authentication (
315+ try_authenticate (Transport , S , C0 , <<" PLAIN" >>, <<" guest" >>, Pwd ),
316+ ? RESPONSE_AUTHENTICATION_FAILURE ),
317+ closed = wait_for_socket_close (Transport , S , 10 ),
318+ ok .
319+
311320test_stream_tls (Config ) ->
312321 Stream = atom_to_binary (? FUNCTION_NAME , utf8 ),
313322 test_server (ssl , Stream , Config ),
0 commit comments