1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

messages: Fix ssh_packet_userauth_request().

Remove useless ssh_pki_import_signature_blob().
This commit is contained in:
Andreas Schneider
2011-08-26 21:19:20 +02:00
parent f1634d33da
commit 5a0735d1e8

View File

@@ -589,7 +589,6 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_NONE; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_NONE;
// has a valid signature ? // has a valid signature ?
if(has_sign) { if(has_sign) {
ssh_signature sig;
ssh_string sig_blob = NULL; ssh_string sig_blob = NULL;
ssh_buffer digest = NULL; ssh_buffer digest = NULL;
@@ -599,20 +598,10 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR;
goto error; goto error;
} }
rc = ssh_pki_import_signature_blob(sig_blob,
msg->auth_request.pubkey,
&sig);
if (rc < 0) {
ssh_string_free(sig_blob);
ssh_log(session, SSH_LOG_PACKET, "Wrong signature from peer");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG;
goto error;
}
digest = ssh_msg_userauth_build_digest(session, msg, service_c); digest = ssh_msg_userauth_build_digest(session, msg, service_c);
if (digest == NULL) { if (digest == NULL) {
ssh_string_free(sig_blob); ssh_string_free(sig_blob);
ssh_signature_free(sig);
ssh_log(session, SSH_LOG_PACKET, "Failed to get digest"); ssh_log(session, SSH_LOG_PACKET, "Failed to get digest");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG;
goto error; goto error;
@@ -626,6 +615,9 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
ssh_string_free(sig_blob); ssh_string_free(sig_blob);
ssh_buffer_free(digest); ssh_buffer_free(digest);
if (rc < 0) { if (rc < 0) {
ssh_log(session,
SSH_LOG_PACKET,
"Received an invalid signature from peer");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG;
goto error; goto error;
} }