diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-11-22 15:57:37 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-01-09 10:14:56 +0100 |
commit | 8e0c047031d69bdf882f550886e3dd43afd8db05 (patch) | |
tree | 0ffd94b05abc4693c92efe60492fca690bd9dd32 /src/auth.c | |
parent | 8d9026666190eecc55548899461b83a4f6cf45ce (diff) | |
download | libssh-8e0c047031d69bdf882f550886e3dd43afd8db05.tar.gz libssh-8e0c047031d69bdf882f550886e3dd43afd8db05.tar.xz libssh-8e0c047031d69bdf882f550886e3dd43afd8db05.zip |
packet: Introduce a new function to access crypto
And remove most of the direct access to the structure throughout the code
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Daiki Ueno <dueno@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/auth.c')
-rw-r--r-- | src/auth.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -282,7 +282,10 @@ end: * * It is also used to communicate the new to the upper levels. */ -SSH_PACKET_CALLBACK(ssh_packet_userauth_success) { +SSH_PACKET_CALLBACK(ssh_packet_userauth_success) +{ + struct ssh_crypto_struct *crypto = NULL; + (void)packet; (void)type; (void)user; @@ -294,13 +297,16 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_success) { session->session_state = SSH_SESSION_STATE_AUTHENTICATED; session->flags |= SSH_SESSION_FLAG_AUTHENTICATED; - if (session->current_crypto && session->current_crypto->delayed_compress_out) { + crypto = ssh_packet_get_current_crypto(session, SSH_DIRECTION_OUT); + if (crypto != NULL && crypto->delayed_compress_out) { SSH_LOG(SSH_LOG_DEBUG, "Enabling delayed compression OUT"); - session->current_crypto->do_compress_out = 1; + crypto->do_compress_out = 1; } - if (session->current_crypto && session->current_crypto->delayed_compress_in) { + + crypto = ssh_packet_get_current_crypto(session, SSH_DIRECTION_IN); + if (crypto != NULL && crypto->delayed_compress_in) { SSH_LOG(SSH_LOG_DEBUG, "Enabling delayed compression IN"); - session->current_crypto->do_compress_in = 1; + crypto->do_compress_in = 1; } /* Reset errors by previous authentication methods. */ |