From ef70cc73c69d04e93c9af5fb49c5d762ba226801 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 28 Apr 2018 21:50:54 +0800 Subject: Add a connection info field in FQTermSocket - the connection info record contains the name of the cipher and MAC algorithms, and the key hash - after doing a key exchange, the connection info will be filled --- src/protocol/fqterm_ssh_socket.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/protocol/fqterm_ssh_socket.cpp') diff --git a/src/protocol/fqterm_ssh_socket.cpp b/src/protocol/fqterm_ssh_socket.cpp index 20612bf..c48fc51 100644 --- a/src/protocol/fqterm_ssh_socket.cpp +++ b/src/protocol/fqterm_ssh_socket.cpp @@ -161,11 +161,22 @@ void FQTermSSHSocket::init(int ssh_version) { key_exchanger_->initKex(packet_receiver_, packet_sender_); } + + conn_info.proto = PROTO_SSH; + conn_info.ssh_proto_info.proto_version = ssh_version; } -void FQTermSSHSocket::kexOK() { - FQ_TRACE("sshsocket", 3) << "Key exchange completed!"; - authentication_->initAuth(packet_receiver_, packet_sender_); +void FQTermSSHSocket::kexOK() +{ + FQ_TRACE("sshsocket", 3) << "Key exchange completed!"; + conn_info.ssh_proto_info.c2s_cipher = packet_sender_->cipher->name; + conn_info.ssh_proto_info.s2c_cipher = packet_receiver_->cipher->name; + if (packet_sender_->mac) + conn_info.ssh_proto_info.c2s_mac = packet_sender_->mac->name; + if (packet_receiver_->mac) + conn_info.ssh_proto_info.s2c_mac = packet_receiver_->mac->name; + key_exchanger_->hostKeyHash(conn_info.ssh_proto_info.hash); + authentication_->initAuth(packet_receiver_, packet_sender_); } void FQTermSSHSocket::authOK() { -- cgit v1.2.3