server session BUGFIX ssh_msg_clb call during session close
libssh can call it during ssh_channel_free or ssh_disconnect,
so if there are any requests left, deny them.
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index f1ca685..fadc3cd 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -841,6 +841,14 @@
}
VRB("Received an SSH message \"%s\" of subtype \"%s\".", str_type, str_subtype);
+ if ((session->status == NC_STATUS_CLOSING) || (session->status == NC_STATUS_INVALID)) {
+ /* "valid" situation if, for example, receiving some auth or channel request timeouted,
+ * but we got it now, during session free */
+ VRB("SSH message arrived on a %s session, the request will be denied.",
+ (session->status == NC_STATUS_CLOSING ? "closing" : "invalid"));
+ ssh_message_reply_default(msg);
+ return 0;
+ }
session->flags |= NC_SESSION_SSH_NEW_MSG;
/*