diff options
author | Bernhard R. Link <brlink@debian.org> | 2011-02-13 15:11:39 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-02-14 22:48:53 +0100 |
commit | b1db0e54ad7dcdb8859c64fc44a4a60328033808 (patch) | |
tree | 429bbf6f7c72146362a166b31cd2045d39302e5d | |
parent | 4230509e805f546091ca2e4f8aa13c22f6efc7a8 (diff) | |
download | libssh-b1db0e54ad7dcdb8859c64fc44a4a60328033808.tar.gz libssh-b1db0e54ad7dcdb8859c64fc44a4a60328033808.tar.xz libssh-b1db0e54ad7dcdb8859c64fc44a4a60328033808.zip |
bind: Set errors on return.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-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; |