1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

Fixed a bunch of smallish bugs

http://linuxtesting.org/upstream-tracker/test_results/libssh/current/test_results.html
for a whole list
This commit is contained in:
Aris Adamantiadis
2010-10-20 14:47:11 +02:00
parent 8e2699e161
commit 98221f4e36
5 changed files with 56 additions and 17 deletions

View File

@@ -832,23 +832,24 @@ int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash) {
unsigned char *h;
if (session == NULL || hash == NULL) {
return -1;
return SSH_ERROR;
}
*hash = NULL;
if (session->current_crypto == NULL ||
session->current_crypto->server_pubkey == NULL){
ssh_set_error(session,SSH_FATAL,"No current cryptographic context");
return SSH_ERROR;
}
h = malloc(sizeof(unsigned char *) * MD5_DIGEST_LEN);
if (h == NULL) {
return -1;
return SSH_ERROR;
}
ctx = md5_init();
if (ctx == NULL) {
SAFE_FREE(h);
return -1;
return SSH_ERROR;
}
pubkey = session->current_crypto->server_pubkey;
@@ -877,6 +878,10 @@ void ssh_clean_pubkey_hash(unsigned char **hash) {
}
ssh_string ssh_get_pubkey(ssh_session session){
if(session==NULL || session->current_crypto ==NULL ||
session->current_crypto->server_pubkey==NULL)
return NULL;
else
return ssh_string_copy(session->current_crypto->server_pubkey);
}