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

bind: Set errors on return.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Bernhard R. Link
2011-02-13 15:11:39 +01:00
committed by Andreas Schneider
parent 4230509e80
commit b1db0e54ad

View File

@@ -160,6 +160,7 @@ int ssh_bind_listen(ssh_bind sshbind) {
socket_t fd; socket_t fd;
if (ssh_init() < 0) { if (ssh_init() < 0) {
ssh_set_error(sshbind, SSH_FATAL, "ssh_init() failed");
return -1; return -1;
} }
@@ -206,7 +207,11 @@ int ssh_bind_listen(ssh_bind sshbind) {
int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks, int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks,
void *userdata){ void *userdata){
if (sshbind == NULL || callbacks == NULL) { if (sshbind == NULL) {
return SSH_ERROR;
}
if (callbacks == NULL) {
ssh_set_error_invalid(sshbind, __FUNCTION__);
return SSH_ERROR; return SSH_ERROR;
} }
if(callbacks->size <= 0 || callbacks->size > 1024 * sizeof(void *)){ if(callbacks->size <= 0 || callbacks->size > 1024 * sizeof(void *)){
@@ -378,6 +383,8 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
ssh_socket_free(session->socket); ssh_socket_free(session->socket);
session->socket = ssh_socket_new(session); session->socket = ssh_socket_new(session);
if (session->socket == NULL) { if (session->socket == NULL) {
/* perhaps it may be better to copy the error from session to sshbind */
ssh_set_error_oom(sshbind);
privatekey_free(dsa); privatekey_free(dsa);
privatekey_free(rsa); privatekey_free(rsa);
return SSH_ERROR; return SSH_ERROR;