|
92 | 92 | service_name_length_too_large/1, |
93 | 93 | service_name_length_too_short/1, |
94 | 94 | client_close_after_hello/1, |
95 | | - channel_close_timeout/1 |
| 95 | + channel_close_timeout/1, |
| 96 | + extra_ssh_msg_service_request/1 |
96 | 97 | ]). |
97 | 98 |
|
98 | 99 | -define(NEWLINE, <<"\r\n">>). |
@@ -169,7 +170,8 @@ groups() -> |
169 | 170 | bad_long_service_name, |
170 | 171 | bad_very_long_service_name, |
171 | 172 | empty_service_name, |
172 | | - bad_service_name_then_correct |
| 173 | + bad_service_name_then_correct, |
| 174 | + extra_ssh_msg_service_request |
173 | 175 | ]}, |
174 | 176 | {authentication, [], [client_handles_keyboard_interactive_0_pwds, |
175 | 177 | client_handles_banner_keyboard_interactive, |
@@ -1452,6 +1454,44 @@ client_close_after_hello(Config0) -> |
1452 | 1454 | {fail, no_handshakers} |
1453 | 1455 | end. |
1454 | 1456 |
|
| 1457 | +%%% Connect to an erlang server and pretend client sending extra |
| 1458 | +%%% ssh_msg_service_request (Paramiko client behavior) |
| 1459 | +extra_ssh_msg_service_request(Config) -> |
| 1460 | + %% Connect and negotiate keys |
| 1461 | + {ok,InitialState} = ssh_trpt_test_lib:exec( |
| 1462 | + [{set_options, [print_ops, print_seqnums, print_messages]}] |
| 1463 | + ), |
| 1464 | + {ok,AfterKexState} = connect_and_kex(Config, InitialState), |
| 1465 | + %% Do the authentcation |
| 1466 | + {User,Pwd} = server_user_password(Config), |
| 1467 | + UserAuthFlow = |
| 1468 | + fun(P) -> |
| 1469 | + [{send, #ssh_msg_service_request{name = "ssh-userauth"}}, |
| 1470 | + {match, #ssh_msg_service_accept{name = "ssh-userauth"}, receive_msg}, |
| 1471 | + {send, #ssh_msg_userauth_request{user = User, |
| 1472 | + service = "ssh-connection", |
| 1473 | + method = "password", |
| 1474 | + data = <<?BOOLEAN(?FALSE), |
| 1475 | + ?STRING(unicode:characters_to_binary(P))>> |
| 1476 | + }}] |
| 1477 | + end, |
| 1478 | + {ok,EndState} = |
| 1479 | + ssh_trpt_test_lib:exec( |
| 1480 | + UserAuthFlow("WRONG") ++ |
| 1481 | + [{match, #ssh_msg_userauth_failure{_='_'}, receive_msg}] ++ |
| 1482 | + UserAuthFlow(Pwd) ++ |
| 1483 | + [{match, #ssh_msg_userauth_success{_='_'}, receive_msg}], |
| 1484 | + AfterKexState), |
| 1485 | + %% Disconnect |
| 1486 | + {ok,_} = |
| 1487 | + ssh_trpt_test_lib:exec( |
| 1488 | + [{send, #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, |
| 1489 | + description = "End of the fun", |
| 1490 | + language = "" |
| 1491 | + }}, |
| 1492 | + close_socket |
| 1493 | + ], EndState), |
| 1494 | + ok. |
1455 | 1495 |
|
1456 | 1496 | %%%================================================================ |
1457 | 1497 | %%%==== Internal functions ======================================== |
|
0 commit comments