mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
ssh_disconnect doesn't free the session anymore
This commit is contained in:
@@ -345,6 +345,7 @@ LIBSSH_API const char *ssh_copyright(void);
|
||||
LIBSSH_API void ssh_disconnect(ssh_session session);
|
||||
LIBSSH_API char *ssh_dirname (const char *path);
|
||||
LIBSSH_API int ssh_finalize(void);
|
||||
LIBSSH_API void ssh_free(ssh_session session);
|
||||
LIBSSH_API const char *ssh_get_disconnect_message(ssh_session session);
|
||||
LIBSSH_API const char *ssh_get_error(void *error);
|
||||
LIBSSH_API int ssh_get_error_code(void *error);
|
||||
|
||||
@@ -113,6 +113,5 @@ struct ssh_session_struct {
|
||||
};
|
||||
|
||||
int ssh_handle_packets(ssh_session session);
|
||||
void ssh_cleanup(ssh_session session);
|
||||
|
||||
#endif /* SESSION_H_ */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user