1
1
Этот коммит содержится в:
Aris Adamantiadis 2009-09-23 22:19:11 +02:00
родитель 0e8e124d20
Коммит 496a8e12d9
7 изменённых файлов: 86 добавлений и 87 удалений

Просмотреть файл

@ -361,13 +361,13 @@ LIBSSH_API int ssh_get_status(ssh_session session);
LIBSSH_API int ssh_init(void); LIBSSH_API int ssh_init(void);
LIBSSH_API int ssh_is_server_known(ssh_session session); LIBSSH_API int ssh_is_server_known(ssh_session session);
LIBSSH_API void ssh_log(ssh_session session, int prioriry, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); LIBSSH_API void ssh_log(ssh_session session, int prioriry, const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(SSH_MESSAGE *msg); LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_reply_success(ssh_message msg);
LIBSSH_API void ssh_message_free(SSH_MESSAGE *msg); LIBSSH_API void ssh_message_free(ssh_message msg);
LIBSSH_API SSH_MESSAGE *ssh_message_get(ssh_session session); LIBSSH_API ssh_message ssh_message_get(ssh_session session);
LIBSSH_API SSH_MESSAGE *ssh_message_retrieve(ssh_session session, uint32_t packettype); LIBSSH_API ssh_message ssh_message_retrieve(ssh_session session, uint32_t packettype);
LIBSSH_API int ssh_message_subtype(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_subtype(ssh_message msg);
LIBSSH_API int ssh_message_type(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_type(ssh_message msg);
LIBSSH_API int ssh_mkdir (const char *pathname, mode_t mode); LIBSSH_API int ssh_mkdir (const char *pathname, mode_t mode);
LIBSSH_API ssh_session ssh_new(void); LIBSSH_API ssh_session ssh_new(void);
LIBSSH_API ssh_options ssh_options_copy(ssh_options opt); LIBSSH_API ssh_options ssh_options_copy(ssh_options opt);

Просмотреть файл

@ -124,40 +124,40 @@ LIBSSH_API int ssh_accept(ssh_session session);
LIBSSH_API int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len); LIBSSH_API int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len);
/* messages.c */ /* messages.c */
LIBSSH_API int ssh_message_reply_default(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_reply_default(ssh_message msg);
LIBSSH_API char *ssh_message_auth_user(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_auth_user(ssh_message msg);
LIBSSH_API char *ssh_message_auth_password(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_auth_password(ssh_message msg);
LIBSSH_API ssh_public_key ssh_message_auth_publickey(SSH_MESSAGE *msg); LIBSSH_API ssh_public_key ssh_message_auth_publickey(ssh_message msg);
LIBSSH_API int ssh_message_auth_reply_success(SSH_MESSAGE *msg,int partial); LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial);
LIBSSH_API int ssh_message_auth_reply_pk_ok(SSH_MESSAGE *msg, ssh_string algo, ssh_string pubkey); LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey);
LIBSSH_API int ssh_message_auth_set_methods(SSH_MESSAGE *msg, int methods); LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods);
LIBSSH_API int ssh_message_service_reply_success(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_service_reply_success(ssh_message msg);
LIBSSH_API char *ssh_message_service_service(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_service_service(ssh_message msg);
LIBSSH_API void ssh_set_message_callback(ssh_session session, LIBSSH_API void ssh_set_message_callback(ssh_session session,
int(*ssh_message_callback)(ssh_session session, ssh_message msg)); int(*ssh_message_callback)(ssh_session session, ssh_message msg));
LIBSSH_API char *ssh_message_channel_request_open_originator(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_open_originator(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_open_originator_port(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg);
LIBSSH_API char *ssh_message_channel_request_open_destination(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_open_destination(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_open_destination_port(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_open_destination_port(ssh_message msg);
LIBSSH_API ssh_channel ssh_message_channel_request_channel(SSH_MESSAGE *msg); LIBSSH_API ssh_channel ssh_message_channel_request_channel(ssh_message msg);
LIBSSH_API char *ssh_message_channel_request_pty_term(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_pty_term(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_pty_width(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_pty_width(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_pty_height(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_pty_height(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_pty_pxwidth(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_pty_pxwidth(ssh_message msg);
LIBSSH_API int ssh_message_channel_request_pty_pxheight(SSH_MESSAGE *msg); LIBSSH_API int ssh_message_channel_request_pty_pxheight(ssh_message msg);
LIBSSH_API char *ssh_message_channel_request_env_name(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_env_name(ssh_message msg);
LIBSSH_API char *ssh_message_channel_request_env_value(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_env_value(ssh_message msg);
LIBSSH_API char *ssh_message_channel_request_command(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_command(ssh_message msg);
LIBSSH_API char *ssh_message_channel_request_subsystem(SSH_MESSAGE *msg); LIBSSH_API char *ssh_message_channel_request_subsystem(ssh_message msg);
#ifdef __cplusplus #ifdef __cplusplus
} }

Просмотреть файл

@ -1346,7 +1346,7 @@ static ssh_channel channel_accept(ssh_session session, int channeltype,
.tv_nsec = 50000000 /* 50ms */ .tv_nsec = 50000000 /* 50ms */
}; };
#endif #endif
SSH_MESSAGE *msg = NULL; ssh_message msg = NULL;
struct ssh_iterator *iterator; struct ssh_iterator *iterator;
int t; int t;
@ -1357,7 +1357,7 @@ static ssh_channel channel_accept(ssh_session session, int channeltype,
if (session->ssh_message_list) { if (session->ssh_message_list) {
iterator = ssh_list_get_iterator(session->ssh_message_list); iterator = ssh_list_get_iterator(session->ssh_message_list);
while (iterator) { while (iterator) {
msg = (SSH_MESSAGE*)iterator->data; msg = (ssh_message)iterator->data;
if (ssh_message_type(msg) == SSH_REQUEST_CHANNEL_OPEN && if (ssh_message_type(msg) == SSH_REQUEST_CHANNEL_OPEN &&
ssh_message_subtype(msg) == channeltype) { ssh_message_subtype(msg) == channeltype) {
ssh_list_remove(session->ssh_message_list, iterator); ssh_list_remove(session->ssh_message_list, iterator);

Просмотреть файл

@ -44,21 +44,20 @@
#include "libssh/ssh2.h" #include "libssh/ssh2.h"
static SSH_MESSAGE *message_new(ssh_session session){ static ssh_message message_new(ssh_session session){
SSH_MESSAGE *msg = malloc(sizeof(SSH_MESSAGE)); ssh_message msg = malloc(sizeof(struct ssh_message_struct));
if (msg == NULL) { if (msg == NULL) {
return NULL; return NULL;
} }
ZERO_STRUCTP(msg);
memset(msg, 0, sizeof(*msg));
msg->session = session; msg->session = session;
return msg; return msg;
} }
static SSH_MESSAGE *handle_service_request(ssh_session session) { static ssh_message handle_service_request(ssh_session session) {
ssh_string service = NULL; ssh_string service = NULL;
char *service_c = NULL; char *service_c = NULL;
SSH_MESSAGE *msg=NULL; ssh_message msg=NULL;
enter_function(); enter_function();
@ -98,11 +97,11 @@ static int handle_unimplemented(ssh_session session) {
return 0; return 0;
} }
static SSH_MESSAGE *handle_userauth_request(ssh_session session){ static ssh_message handle_userauth_request(ssh_session session){
ssh_string user = NULL; ssh_string user = NULL;
ssh_string service = NULL; ssh_string service = NULL;
ssh_string method = NULL; ssh_string method = NULL;
SSH_MESSAGE *msg = NULL; ssh_message msg = NULL;
char *service_c = NULL; char *service_c = NULL;
char *method_c = NULL; char *method_c = NULL;
@ -264,8 +263,8 @@ error:
return NULL; return NULL;
} }
static SSH_MESSAGE *handle_channel_request_open(ssh_session session) { static ssh_message handle_channel_request_open(ssh_session session) {
SSH_MESSAGE *msg = NULL; ssh_message msg = NULL;
ssh_string type = NULL, originator = NULL, destination = NULL; ssh_string type = NULL, originator = NULL, destination = NULL;
char *type_c = NULL; char *type_c = NULL;
uint32_t sender, window, packet, originator_port, destination_port; uint32_t sender, window, packet, originator_port, destination_port;
@ -413,7 +412,7 @@ error:
return NULL; return NULL;
} }
ssh_channel ssh_message_channel_request_open_reply_accept(SSH_MESSAGE *msg) { ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg) {
ssh_session session = msg->session; ssh_session session = msg->session;
ssh_channel chan = NULL; ssh_channel chan = NULL;
@ -470,8 +469,8 @@ error:
return NULL; return NULL;
} }
static SSH_MESSAGE *handle_channel_request(ssh_session session) { static ssh_message handle_channel_request(ssh_session session) {
SSH_MESSAGE *msg = NULL; ssh_message msg = NULL;
ssh_string type = NULL; ssh_string type = NULL;
char *type_c = NULL; char *type_c = NULL;
uint32_t channel; uint32_t channel;
@ -664,7 +663,7 @@ error:
return NULL; return NULL;
} }
int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg) { int ssh_message_channel_request_reply_success(ssh_message msg) {
uint32_t channel; uint32_t channel;
if (msg == NULL) { if (msg == NULL) {
@ -693,8 +692,8 @@ int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg) {
return SSH_OK; return SSH_OK;
} }
SSH_MESSAGE *ssh_message_retrieve(ssh_session session, uint32_t packettype){ ssh_message ssh_message_retrieve(ssh_session session, uint32_t packettype){
SSH_MESSAGE *msg=NULL; ssh_message msg=NULL;
enter_function(); enter_function();
switch(packettype) { switch(packettype) {
case SSH2_MSG_SERVICE_REQUEST: case SSH2_MSG_SERVICE_REQUEST:
@ -722,8 +721,8 @@ SSH_MESSAGE *ssh_message_retrieve(ssh_session session, uint32_t packettype){
/* \brief blocking message retrieval /* \brief blocking message retrieval
* \bug does anything that is not a message, like a channel read/write * \bug does anything that is not a message, like a channel read/write
*/ */
SSH_MESSAGE *ssh_message_get(ssh_session session) { ssh_message ssh_message_get(ssh_session session) {
SSH_MESSAGE *msg = NULL; ssh_message msg = NULL;
enter_function(); enter_function();
do { do {
if ((packet_read(session) != SSH_OK) || if ((packet_read(session) != SSH_OK) ||
@ -737,7 +736,7 @@ SSH_MESSAGE *ssh_message_get(ssh_session session) {
return msg; return msg;
} }
int ssh_message_type(SSH_MESSAGE *msg) { int ssh_message_type(ssh_message msg) {
if (msg == NULL) { if (msg == NULL) {
return -1; return -1;
} }
@ -745,7 +744,7 @@ int ssh_message_type(SSH_MESSAGE *msg) {
return msg->type; return msg->type;
} }
int ssh_message_subtype(SSH_MESSAGE *msg) { int ssh_message_subtype(ssh_message msg) {
if (msg == NULL) { if (msg == NULL) {
return -1; return -1;
} }
@ -762,7 +761,7 @@ int ssh_message_subtype(SSH_MESSAGE *msg) {
return -1; return -1;
} }
void ssh_message_free(SSH_MESSAGE *msg){ void ssh_message_free(ssh_message msg){
if (msg == NULL) { if (msg == NULL) {
return; return;
} }
@ -800,7 +799,7 @@ void ssh_message_free(SSH_MESSAGE *msg){
* \returns nothing * \returns nothing
*/ */
void message_handle(ssh_session session, uint32_t type){ void message_handle(ssh_session session, uint32_t type){
SSH_MESSAGE *msg=ssh_message_retrieve(session,type); ssh_message msg=ssh_message_retrieve(session,type);
if(msg){ if(msg){
if(!session->ssh_message_list){ if(!session->ssh_message_list){
session->ssh_message_list=ssh_list_new(); session->ssh_message_list=ssh_list_new();

Просмотреть файл

@ -528,7 +528,7 @@ int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len) {
/* messages */ /* messages */
static int ssh_message_auth_reply_default(SSH_MESSAGE *msg,int partial) { static int ssh_message_auth_reply_default(ssh_message msg,int partial) {
ssh_session session = msg->session; ssh_session session = msg->session;
char methods_c[128] = {0}; char methods_c[128] = {0};
ssh_string methods = NULL; ssh_string methods = NULL;
@ -589,7 +589,7 @@ error:
return rc; return rc;
} }
static int ssh_message_channel_request_open_reply_default(SSH_MESSAGE *msg) { static int ssh_message_channel_request_open_reply_default(ssh_message msg) {
ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Refusing a channel"); ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Refusing a channel");
if (buffer_add_u8(msg->session->out_buffer if (buffer_add_u8(msg->session->out_buffer
@ -618,7 +618,7 @@ error:
return SSH_ERROR; return SSH_ERROR;
} }
static int ssh_message_channel_request_reply_default(SSH_MESSAGE *msg) { static int ssh_message_channel_request_reply_default(ssh_message msg) {
uint32_t channel; uint32_t channel;
if (msg->channel_request.want_reply) { if (msg->channel_request.want_reply) {
@ -643,12 +643,12 @@ static int ssh_message_channel_request_reply_default(SSH_MESSAGE *msg) {
return SSH_OK; return SSH_OK;
} }
static int ssh_message_service_request_reply_default(SSH_MESSAGE *msg) { static int ssh_message_service_request_reply_default(ssh_message msg) {
/* The only return code accepted by specifications are success or disconnect */ /* The only return code accepted by specifications are success or disconnect */
return ssh_message_service_reply_success(msg); return ssh_message_service_reply_success(msg);
} }
int ssh_message_service_reply_success(SSH_MESSAGE *msg) { int ssh_message_service_reply_success(ssh_message msg) {
struct ssh_string_struct *service; struct ssh_string_struct *service;
ssh_session session=msg->session; ssh_session session=msg->session;
if (msg == NULL) { if (msg == NULL) {
@ -668,7 +668,7 @@ int ssh_message_service_reply_success(SSH_MESSAGE *msg) {
return packet_send(msg->session); return packet_send(msg->session);
} }
int ssh_message_reply_default(SSH_MESSAGE *msg) { int ssh_message_reply_default(ssh_message msg) {
if (msg == NULL) { if (msg == NULL) {
return -1; return -1;
} }
@ -692,14 +692,14 @@ int ssh_message_reply_default(SSH_MESSAGE *msg) {
return -1; return -1;
} }
char *ssh_message_service_service(SSH_MESSAGE *msg){ char *ssh_message_service_service(ssh_message msg){
if (msg == NULL) { if (msg == NULL) {
return NULL; return NULL;
} }
return msg->service_request.service; return msg->service_request.service;
} }
char *ssh_message_auth_user(SSH_MESSAGE *msg) { char *ssh_message_auth_user(ssh_message msg) {
if (msg == NULL) { if (msg == NULL) {
return NULL; return NULL;
} }
@ -707,7 +707,7 @@ char *ssh_message_auth_user(SSH_MESSAGE *msg) {
return msg->auth_request.username; return msg->auth_request.username;
} }
char *ssh_message_auth_password(SSH_MESSAGE *msg){ char *ssh_message_auth_password(ssh_message msg){
if (msg == NULL) { if (msg == NULL) {
return NULL; return NULL;
} }
@ -716,7 +716,7 @@ char *ssh_message_auth_password(SSH_MESSAGE *msg){
} }
/* Get the publickey of an auth request */ /* Get the publickey of an auth request */
ssh_public_key ssh_message_auth_publickey(SSH_MESSAGE *msg){ ssh_public_key ssh_message_auth_publickey(ssh_message msg){
if (msg == NULL) { if (msg == NULL) {
return NULL; return NULL;
} }
@ -724,7 +724,7 @@ ssh_public_key ssh_message_auth_publickey(SSH_MESSAGE *msg){
return msg->auth_request.public_key; return msg->auth_request.public_key;
} }
int ssh_message_auth_set_methods(SSH_MESSAGE *msg, int methods) { int ssh_message_auth_set_methods(ssh_message msg, int methods) {
if (msg == NULL || msg->session == NULL) { if (msg == NULL || msg->session == NULL) {
return -1; return -1;
} }
@ -734,7 +734,7 @@ int ssh_message_auth_set_methods(SSH_MESSAGE *msg, int methods) {
return 0; return 0;
} }
int ssh_message_auth_reply_success(SSH_MESSAGE *msg, int partial) { int ssh_message_auth_reply_success(ssh_message msg, int partial) {
if (msg == NULL) { if (msg == NULL) {
return SSH_ERROR; return SSH_ERROR;
} }
@ -751,7 +751,7 @@ int ssh_message_auth_reply_success(SSH_MESSAGE *msg, int partial) {
} }
/* Answer OK to a pubkey auth request */ /* Answer OK to a pubkey auth request */
int ssh_message_auth_reply_pk_ok(SSH_MESSAGE *msg, ssh_string algo, ssh_string pubkey) { int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey) {
if (msg == NULL) { if (msg == NULL) {
return SSH_ERROR; return SSH_ERROR;
} }
@ -765,59 +765,59 @@ int ssh_message_auth_reply_pk_ok(SSH_MESSAGE *msg, ssh_string algo, ssh_string p
return packet_send(msg->session); return packet_send(msg->session);
} }
char *ssh_message_channel_request_open_originator(SSH_MESSAGE *msg){ char *ssh_message_channel_request_open_originator(ssh_message msg){
return msg->channel_request_open.originator; return msg->channel_request_open.originator;
} }
int ssh_message_channel_request_open_originator_port(SSH_MESSAGE *msg){ int ssh_message_channel_request_open_originator_port(ssh_message msg){
return msg->channel_request_open.originator_port; return msg->channel_request_open.originator_port;
} }
char *ssh_message_channel_request_open_destination(SSH_MESSAGE *msg){ char *ssh_message_channel_request_open_destination(ssh_message msg){
return msg->channel_request_open.destination; return msg->channel_request_open.destination;
} }
int ssh_message_channel_request_open_destination_port(SSH_MESSAGE *msg){ int ssh_message_channel_request_open_destination_port(ssh_message msg){
return msg->channel_request_open.destination_port; return msg->channel_request_open.destination_port;
} }
ssh_channel ssh_message_channel_request_channel(SSH_MESSAGE *msg){ ssh_channel ssh_message_channel_request_channel(ssh_message msg){
return msg->channel_request.channel; return msg->channel_request.channel;
} }
char *ssh_message_channel_request_pty_term(SSH_MESSAGE *msg){ char *ssh_message_channel_request_pty_term(ssh_message msg){
return msg->channel_request.TERM; return msg->channel_request.TERM;
} }
int ssh_message_channel_request_pty_width(SSH_MESSAGE *msg){ int ssh_message_channel_request_pty_width(ssh_message msg){
return msg->channel_request.width; return msg->channel_request.width;
} }
int ssh_message_channel_request_pty_height(SSH_MESSAGE *msg){ int ssh_message_channel_request_pty_height(ssh_message msg){
return msg->channel_request.height; return msg->channel_request.height;
} }
int ssh_message_channel_request_pty_pxwidth(SSH_MESSAGE *msg){ int ssh_message_channel_request_pty_pxwidth(ssh_message msg){
return msg->channel_request.pxwidth; return msg->channel_request.pxwidth;
} }
int ssh_message_channel_request_pty_pxheight(SSH_MESSAGE *msg){ int ssh_message_channel_request_pty_pxheight(ssh_message msg){
return msg->channel_request.pxheight; return msg->channel_request.pxheight;
} }
char *ssh_message_channel_request_env_name(SSH_MESSAGE *msg){ char *ssh_message_channel_request_env_name(ssh_message msg){
return msg->channel_request.var_name; return msg->channel_request.var_name;
} }
char *ssh_message_channel_request_env_value(SSH_MESSAGE *msg){ char *ssh_message_channel_request_env_value(ssh_message msg){
return msg->channel_request.var_value; return msg->channel_request.var_value;
} }
char *ssh_message_channel_request_command(SSH_MESSAGE *msg){ char *ssh_message_channel_request_command(ssh_message msg){
return msg->channel_request.command; return msg->channel_request.command;
} }
char *ssh_message_channel_request_subsystem(SSH_MESSAGE *msg){ char *ssh_message_channel_request_subsystem(ssh_message msg){
return msg->channel_request.subsystem; return msg->channel_request.subsystem;
} }
@ -834,12 +834,12 @@ void ssh_set_message_callback(ssh_session session,
} }
int ssh_execute_message_callbacks(ssh_session session){ int ssh_execute_message_callbacks(ssh_session session){
SSH_MESSAGE *msg=NULL; ssh_message msg=NULL;
int ret; int ret;
if(!session->ssh_message_list) if(!session->ssh_message_list)
return SSH_OK; return SSH_OK;
if(session->ssh_message_callback){ if(session->ssh_message_callback){
while((msg=ssh_list_get_head(SSH_MESSAGE *, session->ssh_message_list)) != NULL){ while((msg=ssh_list_get_head(ssh_message , session->ssh_message_list)) != NULL){
ret=session->ssh_message_callback(session,msg); ret=session->ssh_message_callback(session,msg);
if(ret==1){ if(ret==1){
ret = ssh_message_reply_default(msg); ret = ssh_message_reply_default(msg);
@ -848,7 +848,7 @@ int ssh_execute_message_callbacks(ssh_session session){
} }
} }
} else { } else {
while((msg=ssh_list_get_head(SSH_MESSAGE *, session->ssh_message_list)) != NULL){ while((msg=ssh_list_get_head(ssh_message , session->ssh_message_list)) != NULL){
ret = ssh_message_reply_default(msg); ret = ssh_message_reply_default(msg);
if(ret != SSH_OK) if(ret != SSH_OK)
return ret; return ret;

Просмотреть файл

@ -127,8 +127,8 @@ void ssh_cleanup(ssh_session session) {
privatekey_free(session->dsa_key); privatekey_free(session->dsa_key);
privatekey_free(session->rsa_key); privatekey_free(session->rsa_key);
if(session->ssh_message_list){ if(session->ssh_message_list){
SSH_MESSAGE *msg; ssh_message msg;
while((msg=ssh_list_get_head(SSH_MESSAGE *,session->ssh_message_list)) while((msg=ssh_list_get_head(ssh_message ,session->ssh_message_list))
!= NULL){ != NULL){
ssh_message_free(msg); ssh_message_free(msg);
} }

Просмотреть файл

@ -43,7 +43,7 @@ int main(int argc, char **argv){
ssh_options options=ssh_options_new(); ssh_options options=ssh_options_new();
ssh_session session; ssh_session session;
SSH_BIND *ssh_bind; SSH_BIND *ssh_bind;
SSH_MESSAGE *message; ssh_message message;
ssh_channel chan=0; ssh_channel chan=0;
ssh_buffer buf; ssh_buffer buf;
int auth=0; int auth=0;