|
80 | 80 | preferred_algorithms/1, |
81 | 81 | service_name_length_too_large/1, |
82 | 82 | service_name_length_too_short/1, |
83 | | - client_close_after_hello/1 |
| 83 | + client_close_after_hello/1, |
| 84 | + extra_ssh_msg_service_request/1 |
84 | 85 | ]). |
85 | 86 |
|
86 | 87 | -define(NEWLINE, <<"\r\n">>). |
@@ -148,7 +149,8 @@ groups() -> |
148 | 149 | bad_long_service_name, |
149 | 150 | bad_very_long_service_name, |
150 | 151 | empty_service_name, |
151 | | - bad_service_name_then_correct |
| 152 | + bad_service_name_then_correct, |
| 153 | + extra_ssh_msg_service_request |
152 | 154 | ]}, |
153 | 155 | {authentication, [], [client_handles_keyboard_interactive_0_pwds |
154 | 156 | ]}, |
@@ -1055,6 +1057,44 @@ client_close_after_hello(Config0) -> |
1055 | 1057 | {fail, no_handshakers} |
1056 | 1058 | end. |
1057 | 1059 |
|
| 1060 | +%%% Connect to an erlang server and pretend client sending extra |
| 1061 | +%%% ssh_msg_service_request (Paramiko client behavior) |
| 1062 | +extra_ssh_msg_service_request(Config) -> |
| 1063 | + %% Connect and negotiate keys |
| 1064 | + {ok,InitialState} = ssh_trpt_test_lib:exec( |
| 1065 | + [{set_options, [print_ops, print_seqnums, print_messages]}] |
| 1066 | + ), |
| 1067 | + {ok,AfterKexState} = connect_and_kex(Config, InitialState), |
| 1068 | + %% Do the authentcation |
| 1069 | + {User,Pwd} = server_user_password(Config), |
| 1070 | + UserAuthFlow = |
| 1071 | + fun(P) -> |
| 1072 | + [{send, #ssh_msg_service_request{name = "ssh-userauth"}}, |
| 1073 | + {match, #ssh_msg_service_accept{name = "ssh-userauth"}, receive_msg}, |
| 1074 | + {send, #ssh_msg_userauth_request{user = User, |
| 1075 | + service = "ssh-connection", |
| 1076 | + method = "password", |
| 1077 | + data = <<?BOOLEAN(?FALSE), |
| 1078 | + ?STRING(unicode:characters_to_binary(P))>> |
| 1079 | + }}] |
| 1080 | + end, |
| 1081 | + {ok,EndState} = |
| 1082 | + ssh_trpt_test_lib:exec( |
| 1083 | + UserAuthFlow("WRONG") ++ |
| 1084 | + [{match, #ssh_msg_userauth_failure{_='_'}, receive_msg}] ++ |
| 1085 | + UserAuthFlow(Pwd) ++ |
| 1086 | + [{match, #ssh_msg_userauth_success{_='_'}, receive_msg}], |
| 1087 | + AfterKexState), |
| 1088 | + %% Disconnect |
| 1089 | + {ok,_} = |
| 1090 | + ssh_trpt_test_lib:exec( |
| 1091 | + [{send, #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION, |
| 1092 | + description = "End of the fun", |
| 1093 | + language = "" |
| 1094 | + }}, |
| 1095 | + close_socket |
| 1096 | + ], EndState), |
| 1097 | + ok. |
1058 | 1098 |
|
1059 | 1099 | %%%================================================================ |
1060 | 1100 | %%%==== Internal functions ======================================== |
|
0 commit comments