1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Handle error messages even before session startup.

I carefully put a flag in the new Ssh structure so that I could tell
the difference between ssh->base_layer being NULL because it hasn't
been set up yet, and being NULL because it's been and gone and the
session is terminated. And did I check that flag in all the error
routines? I did not. Result: an early socket error, while we're still
in the verstring BPP, doesn't get reported as an error message and
doesn't cause the socket to be cleaned up.
This commit is contained in:
Simon Tatham 2018-09-27 17:47:55 +01:00
parent 07313e9466
commit c912d0936d

10
ssh.c
View File

@ -387,7 +387,7 @@ static void ssh_initiate_connection_close(Ssh ssh)
void ssh_remote_error(Ssh ssh, const char *fmt, ...)
{
if (ssh->base_layer) {
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
/* Error messages sent by the remote don't count as clean exits */
@ -405,7 +405,7 @@ void ssh_remote_error(Ssh ssh, const char *fmt, ...)
void ssh_remote_eof(Ssh ssh, const char *fmt, ...)
{
if (ssh->base_layer) {
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
/* EOF from the remote, if we were expecting it, does count as
@ -428,7 +428,7 @@ void ssh_remote_eof(Ssh ssh, const char *fmt, ...)
void ssh_proto_error(Ssh ssh, const char *fmt, ...)
{
if (ssh->base_layer) {
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh->exitcode = 128;
@ -445,7 +445,7 @@ void ssh_proto_error(Ssh ssh, const char *fmt, ...)
void ssh_sw_abort(Ssh ssh, const char *fmt, ...)
{
if (ssh->base_layer) {
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh->exitcode = 128;
@ -462,7 +462,7 @@ void ssh_sw_abort(Ssh ssh, const char *fmt, ...)
void ssh_user_close(Ssh ssh, const char *fmt, ...)
{
if (ssh->base_layer) {
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
/* Closing the connection due to user action, even if the