mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +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 void ssh_disconnect(ssh_session session);
|
||||||
LIBSSH_API char *ssh_dirname (const char *path);
|
LIBSSH_API char *ssh_dirname (const char *path);
|
||||||
LIBSSH_API int ssh_finalize(void);
|
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_disconnect_message(ssh_session session);
|
||||||
LIBSSH_API const char *ssh_get_error(void *error);
|
LIBSSH_API const char *ssh_get_error(void *error);
|
||||||
LIBSSH_API int ssh_get_error_code(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);
|
int ssh_handle_packets(ssh_session session);
|
||||||
void ssh_cleanup(ssh_session session);
|
|
||||||
|
|
||||||
#endif /* SESSION_H_ */
|
#endif /* SESSION_H_ */
|
||||||
|
|||||||
@@ -647,6 +647,7 @@ int ssh_get_openssh_version(ssh_session session) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disconnect from a session (client or server).
|
* @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.
|
* @param session The SSH session to disconnect.
|
||||||
*/
|
*/
|
||||||
@@ -686,7 +687,6 @@ void ssh_disconnect(ssh_session session) {
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
leave_function();
|
leave_function();
|
||||||
ssh_cleanup(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ssh_copyright(void) {
|
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) {
|
if (session->wanted_methods[i] == NULL) {
|
||||||
privatekey_free(dsa);
|
privatekey_free(dsa);
|
||||||
privatekey_free(rsa);
|
privatekey_free(rsa);
|
||||||
ssh_cleanup(session);
|
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,7 +252,6 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
|
|||||||
if (session->bindaddr == NULL) {
|
if (session->bindaddr == NULL) {
|
||||||
privatekey_free(dsa);
|
privatekey_free(dsa);
|
||||||
privatekey_free(rsa);
|
privatekey_free(rsa);
|
||||||
ssh_cleanup(session);
|
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,7 +263,6 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
|
|||||||
if (session->socket == NULL) {
|
if (session->socket == NULL) {
|
||||||
privatekey_free(dsa);
|
privatekey_free(dsa);
|
||||||
privatekey_free(rsa);
|
privatekey_free(rsa);
|
||||||
ssh_cleanup(session);
|
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
ssh_socket_set_fd(session->socket, fd);
|
ssh_socket_set_fd(session->socket, fd);
|
||||||
|
|||||||
@@ -98,11 +98,16 @@ ssh_session ssh_new(void) {
|
|||||||
return session;
|
return session;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
ssh_cleanup(session);
|
ssh_free(session);
|
||||||
return NULL;
|
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;
|
int i;
|
||||||
enter_function();
|
enter_function();
|
||||||
|
|
||||||
@@ -182,7 +187,7 @@ void ssh_silent_disconnect(ssh_session session) {
|
|||||||
ssh_socket_close(session->socket);
|
ssh_socket_close(session->socket);
|
||||||
session->alive = 0;
|
session->alive = 0;
|
||||||
ssh_disconnect(session);
|
ssh_disconnect(session);
|
||||||
/* FIXME: leave_function(); ??? */
|
leave_function();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief set the session in blocking/nonblocking mode
|
/** \brief set the session in blocking/nonblocking mode
|
||||||
|
|||||||
Reference in New Issue
Block a user