diff options
author | Bernhard R. Link <brlink@debian.org> | 2011-02-13 15:11:39 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-02-18 17:54:28 +0100 |
commit | 3ff299922883e88ac0e9866f09d052059f779ba7 (patch) | |
tree | 601aea631038b8bff2761fe77951578ace9affa6 /src | |
parent | 4f65104ecccdc2d1bb9665760efc5e5b388d1b5d (diff) | |
download | libssh-3ff299922883e88ac0e9866f09d052059f779ba7.tar.gz libssh-3ff299922883e88ac0e9866f09d052059f779ba7.tar.xz libssh-3ff299922883e88ac0e9866f09d052059f779ba7.zip |
bind: Set errors on return.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit b1db0e54ad7dcdb8859c64fc44a4a60328033808)
Diffstat (limited to 'src')
-rw-r--r-- | src/bind.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -160,6 +160,7 @@ int ssh_bind_listen(ssh_bind sshbind) { socket_t fd; if (ssh_init() < 0) { + ssh_set_error(sshbind, SSH_FATAL, "ssh_init() failed"); 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, 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; } 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); session->socket = ssh_socket_new(session); 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(rsa); return SSH_ERROR; |