1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-10 06:23:01 +03:00

bind: Add checks around key functions.

This commit is contained in:
Andreas Schneider
2011-08-15 18:46:03 +02:00
parent 2780f76247
commit fe375132c3

View File

@@ -386,14 +386,39 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
/* FIXME */
#if 0
session->dsa_key = ssh_key_dup(sshbind->dsa);
session->rsa_key = ssh_key_dup(sshbind->rsa);
if (sshbind->dsa) {
session->dsa_key = ssh_key_dup(sshbind->dsa);
if (session->dsa_key == NULL) {
ssh_set_error_oom(sshbind);
return SSH_ERROR;
}
}
if (sshbind->rsa) {
session->rsa_key = ssh_key_dup(sshbind->rsa);
if (session->rsa_key == NULL) {
ssh_set_error_oom(sshbind);
return SSH_ERROR;
}
}
#else
dsa = ssh_key_dup(sshbind->dsa);
rsa = ssh_key_dup(sshbind->rsa);
if (sshbind->dsa) {
dsa = ssh_key_dup(sshbind->dsa);
if (dsa == NULL) {
ssh_set_error_oom(sshbind);
return SSH_ERROR;
}
session->dsa_key = ssh_pki_convert_key_to_privatekey(dsa);
}
if (sshbind->rsa) {
rsa = ssh_key_dup(sshbind->rsa);
if (rsa == NULL) {
ssh_set_error_oom(sshbind);
return SSH_ERROR;
}
session->rsa_key = ssh_pki_convert_key_to_privatekey(rsa);
}
session->dsa_key = ssh_pki_convert_key_to_privatekey(dsa);
session->rsa_key = ssh_pki_convert_key_to_privatekey(rsa);
#endif
return SSH_OK;