anchor.diff:  %%% ######## {userauth, client|server} ####
   
   %%---- userauth request to server
  -handle_event(_, 
  +handle_event(internal, 
   	     Msg = #ssh_msg_userauth_request{service = ServiceName, method = Method},
   	     StateName = {userauth,server},
   	     D0 = #data{ssh_params=Ssh0}) ->
  
positive.code: 	    {stop, {shutdown,{unexpected_getopts_return, Other}}}
      end;
  
  handle_event(_, {info_line,Line}, {hello,Role}=StateName, D) ->
      case Role of
  	client ->
  	    %% The server may send info lines to the client before the version_exchange
  	    %% RFC4253/4.2
  	    inet:setopts(D#data.socket, [{active, once}]),
  	    keep_state_and_data;
  	server ->
  	    %% But the client may NOT send them to the server. Openssh answers with cleartext,
  	    %% and so do we
  	    send_bytes("Protocol mismatch.", D),
              Msg = io_lib:format("Protocol mismatch in version exchange. Client sent info lines.~n~s",
                                  [ssh_dbg:hex_dump(Line, 64)]),
              ?call_disconnectfun_and_log_cond("Protocol mismatch.", Msg, StateName, D),
  	    {stop, {shutdown,"Protocol mismatch in version exchange. Client sent info lines."}}
      end;
  
  handle_event(_, {version_exchange,Version}, {hello,Role}, D0) ->
      {NumVsn, StrVsn} = ssh_transport:handle_hello_version(Version),
      case handle_version(NumVsn, StrVsn, D0#data.ssh_params) of
  	{ok, Ssh1} ->
  
negative.code: 	end,
      {next_state, {userauth,client}, D, [postpone]};
  
  handle_event(internal, #ssh_msg_ext_info{}=Msg, {userauth_keyboard_interactive_info_response, client}, D0) ->
      %% FIXME: need new state to receive this msg!
      D = handle_ssh_msg_ext_info(Msg, D0),
      {keep_state, D};
  
  handle_event(internal, #ssh_msg_userauth_success{}, {userauth_keyboard_interactive_info_response, client}, D) ->
      {next_state, {userauth,client}, D, [postpone]};
  
  handle_event(internal, #ssh_msg_userauth_info_request{}, {userauth_keyboard_interactive_info_response, client}, D) ->
      {next_state, {userauth_keyboard_interactive,client}, D, [postpone]};
  
  
  %%% ######## {connected, client|server} ####
  
  %% Skip ext_info messages in connected state (for example from OpenSSH >= 7.7)
  handle_event(internal, #ssh_msg_ext_info{}, {connected,_Role}, D) ->
      {keep_state, D};
  
  handle_event(internal, {#ssh_msg_kexinit{},_}, {connected,Role}, D0) ->
      {KeyInitMsg, SshPacket, Ssh} = ssh_transport:key_exchange_init_msg(D0#data.ssh_params),
      D = D0#data{ssh_params = Ssh,
  		key_exchange_init_msg = KeyInitMsg},
      send_bytes(SshPacket, D),
      {next_state, {kexinit,Role,renegotiate}, D, [postpone]};
  
  handle_event(internal, #ssh_msg_disconnect{description=Desc} = Msg, StateName, D0) ->
      {disconnect, _, RepliesCon} =
  	ssh_connection:handle_msg(Msg, D0#data.connection_state, role(StateName), D0#data.ssh_params),
      {Actions,D} = send_replies(RepliesCon, D0),
      disconnect_fun("Received disconnect: "++Desc, D),
      {stop_and_reply, {shutdown,Desc}, Actions, D};
  
  handle_event(internal, #ssh_msg_ignore{}, _, _) ->
      keep_state_and_data;
  
  handle_event(internal, #ssh_msg_unimplemented{}, _, _) ->
      keep_state_and_data;
  
  handle_event(internal, #ssh_msg_debug{} = Msg, _, D) ->
      debug_fun(Msg, D),
      keep_state_and_data;
  
  