aboutsummaryrefslogtreecommitdiff
path: root/src/bind.c
diff options
context:
space:
mode:
authorAlan Dunn <amdunn@gmail.com>2014-01-21 08:19:31 -0600
committerAndreas Schneider <asn@cryptomilk.org>2014-01-21 16:07:04 +0100
commitd3e081ba44bad2af176f4dbc17e2402e70bdc462 (patch)
tree4cbb1be0ad6725f4eb232a48441d1173ebb6cc98 /src/bind.c
parent086847f99747d1422028d0a4ee5a05d5f07d9423 (diff)
downloadlibssh-d3e081ba44bad2af176f4dbc17e2402e70bdc462.tar.gz
libssh-d3e081ba44bad2af176f4dbc17e2402e70bdc462.tar.xz
libssh-d3e081ba44bad2af176f4dbc17e2402e70bdc462.zip
Import keys during ssh_bind_accept_fd
Signed-off-by: Alan Dunn <amdunn@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/bind.c')
-rw-r--r--src/bind.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bind.c b/src/bind.c
index e06cb7e3..5234e5b4 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -382,7 +382,7 @@ void ssh_bind_free(ssh_bind sshbind){
}
int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){
- int i;
+ int i, rc;
if (session == NULL){
ssh_set_error(sshbind, SSH_FATAL,"session is null");
@@ -424,6 +424,16 @@ int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){
ssh_socket_set_fd(session->socket, fd);
ssh_socket_get_poll_handle_out(session->socket);
+ /* We must try to import any keys that could be imported in case
+ * we are not using ssh_bind_listen (which is the other place
+ * where keys can be imported) on this ssh_bind and are instead
+ * only using ssh_bind_accept_fd to manage sockets ourselves.
+ */
+ rc = ssh_bind_import_keys(sshbind);
+ if (rc != SSH_OK) {
+ return SSH_ERROR;
+ }
+
#ifdef HAVE_ECC
if (sshbind->ecdsa) {
session->srv.ecdsa_key = ssh_key_dup(sshbind->ecdsa);