diff --git a/ssh1connection-server.c b/ssh1connection-server.c index eecb773a..c2975325 100644 --- a/ssh1connection-server.c +++ b/ssh1connection-server.c @@ -239,6 +239,15 @@ bool ssh1_handle_direction_specific_packet( return true; + case SSH1_CMSG_EXIT_CONFIRMATION: + if (!s->sent_exit_status) { + ssh_proto_error(s->ppl.ssh, "Received SSH1_CMSG_EXIT_CONFIRMATION" + " without having sent SSH1_SMSG_EXIT_STATUS"); + return true; + } + ppl_logevent("Client sent exit confirmation"); + return true; + default: return false; } @@ -301,6 +310,8 @@ static void ssh1sesschan_send_exit_status(SshChannel *sc, int status) pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_SMSG_EXIT_STATUS); put_uint32(pktout, status); pq_push(s->ppl.out_pq, pktout); + + s->sent_exit_status = true; } static void ssh1sesschan_send_exit_signal( diff --git a/ssh1connection.h b/ssh1connection.h index fe4c6157..a9ef072a 100644 --- a/ssh1connection.h +++ b/ssh1connection.h @@ -50,6 +50,7 @@ struct ssh1_connection_state { struct outstanding_succfail *succfail_head, *succfail_tail; bool compressing; /* used in server mode only */ + bool sent_exit_status; /* also for server mode */ ConnectionLayer cl; PacketProtocolLayer ppl;