summaryrefslogtreecommitdiffstats
path: root/libssh
diff options
context:
space:
mode:
Diffstat (limited to 'libssh')
-rw-r--r--libssh/client.c2
-rw-r--r--libssh/server.c3
-rw-r--r--libssh/session.c11
3 files changed, 9 insertions, 7 deletions
diff --git a/libssh/client.c b/libssh/client.c
index 84fbd84..5ca79be 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -647,6 +647,7 @@ int ssh_get_openssh_version(ssh_session session) {
/**
* @brief Disconnect from a session (client or server).
+ * The session can then be reused to open a new session.
*
* @param session The SSH session to disconnect.
*/
@@ -686,7 +687,6 @@ void ssh_disconnect(ssh_session session) {
error:
leave_function();
- ssh_cleanup(session);
}
const char *ssh_copyright(void) {
diff --git a/libssh/server.c b/libssh/server.c
index 986ec04..b29fa68 100644
--- a/libssh/server.c
+++ b/libssh/server.c
@@ -240,7 +240,6 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
if (session->wanted_methods[i] == NULL) {
privatekey_free(dsa);
privatekey_free(rsa);
- ssh_cleanup(session);
return SSH_ERROR;
}
}
@@ -253,7 +252,6 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
if (session->bindaddr == NULL) {
privatekey_free(dsa);
privatekey_free(rsa);
- ssh_cleanup(session);
return SSH_ERROR;
}
}
@@ -265,7 +263,6 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
if (session->socket == NULL) {
privatekey_free(dsa);
privatekey_free(rsa);
- ssh_cleanup(session);
return SSH_ERROR;
}
ssh_socket_set_fd(session->socket, fd);
diff --git a/libssh/session.c b/libssh/session.c
index a03b765..a06c4f6 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -98,11 +98,16 @@ ssh_session ssh_new(void) {
return session;
err:
- ssh_cleanup(session);
+ ssh_free(session);
return NULL;
}
-void ssh_cleanup(ssh_session session) {
+/**
+ * @brief deallocate a session handle
+ * @see ssh_disconnect()
+ * @see ssh_new()
+ */
+void ssh_free(ssh_session session) {
int i;
enter_function();
@@ -182,7 +187,7 @@ void ssh_silent_disconnect(ssh_session session) {
ssh_socket_close(session->socket);
session->alive = 0;
ssh_disconnect(session);
- /* FIXME: leave_function(); ??? */
+ leave_function();
}
/** \brief set the session in blocking/nonblocking mode