aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-09-23 21:55:54 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-09-23 21:55:54 +0200
commit9a8d4cd0fdd18127065cacbc11296933669ea9ca (patch)
treecccf507167e28aa5038cea357d1f220668a4e937
parentffed8b03bb6e170abbd9564547ba439302840618 (diff)
downloadlibssh-9a8d4cd0fdd18127065cacbc11296933669ea9ca.tar.gz
libssh-9a8d4cd0fdd18127065cacbc11296933669ea9ca.tar.xz
libssh-9a8d4cd0fdd18127065cacbc11296933669ea9ca.zip
get rid of SSH_SESSION
-rw-r--r--include/libssh/libssh.h78
-rw-r--r--include/libssh/priv.h134
-rw-r--r--include/libssh/server.h6
-rw-r--r--include/libssh/sftp.h6
-rw-r--r--libssh/agent.c4
-rw-r--r--libssh/auth.c38
-rw-r--r--libssh/auth1.c14
-rw-r--r--libssh/channels.c50
-rw-r--r--libssh/channels1.c18
-rw-r--r--libssh/client.c16
-rw-r--r--libssh/connect.c6
-rw-r--r--libssh/crypt.c8
-rw-r--r--libssh/dh.c36
-rw-r--r--libssh/gzip.c12
-rw-r--r--libssh/kex.c12
-rw-r--r--libssh/keyfiles.c18
-rw-r--r--libssh/keys.c16
-rw-r--r--libssh/log.c2
-rw-r--r--libssh/messages.c20
-rw-r--r--libssh/packet.c26
-rw-r--r--libssh/server.c18
-rw-r--r--libssh/session.c36
-rw-r--r--libssh/sftp.c4
-rw-r--r--libssh/socket.c18
-rw-r--r--libssh/wrapper.c8
-rw-r--r--sample.c14
-rw-r--r--samplesshd.c2
27 files changed, 309 insertions, 311 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index cfb2583d..21dfb268 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -302,7 +302,7 @@ LIBSSH_API ssh_session channel_get_session(ssh_channel channel);
LIBSSH_API int channel_is_closed(ssh_channel channel);
LIBSSH_API int channel_is_eof(ssh_channel channel);
LIBSSH_API int channel_is_open(ssh_channel channel);
-LIBSSH_API ssh_channel channel_new(SSH_SESSION *session);
+LIBSSH_API ssh_channel channel_new(ssh_session session);
LIBSSH_API int channel_open_forward(ssh_channel channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport);
LIBSSH_API int channel_open_session(ssh_channel channel);
@@ -330,46 +330,46 @@ LIBSSH_API void channel_set_blocking(ssh_channel channel, int blocking);
LIBSSH_API int channel_write(ssh_channel channel, const void *data, uint32_t len);
LIBSSH_API void privatekey_free(ssh_private_key prv);
-LIBSSH_API ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
+LIBSSH_API ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
int type, const char *passphrase);
LIBSSH_API void publickey_free(ssh_public_key key);
-LIBSSH_API ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
+LIBSSH_API ssh_string publickey_from_file(ssh_session session, const char *filename,
int *type);
LIBSSH_API ssh_public_key publickey_from_privatekey(ssh_private_key prv);
LIBSSH_API ssh_string publickey_to_string(ssh_public_key key);
-LIBSSH_API int ssh_auth_list(SSH_SESSION *session);
+LIBSSH_API int ssh_auth_list(ssh_session session);
LIBSSH_API char *ssh_basename (const char *path);
LIBSSH_API void ssh_clean_pubkey_hash(unsigned char **hash);
-LIBSSH_API int ssh_connect(SSH_SESSION *session);
+LIBSSH_API int ssh_connect(ssh_session session);
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 int ssh_finalize(void);
-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 int ssh_get_error_code(void *error);
-LIBSSH_API socket_t ssh_get_fd(SSH_SESSION *session);
+LIBSSH_API socket_t ssh_get_fd(ssh_session session);
LIBSSH_API char *ssh_get_hexa(const unsigned char *what, size_t len);
-LIBSSH_API char *ssh_get_issue_banner(SSH_SESSION *session);
+LIBSSH_API char *ssh_get_issue_banner(ssh_session session);
LIBSSH_API int ssh_get_openssh_version(ssh_session session);
-LIBSSH_API ssh_string ssh_get_pubkey(SSH_SESSION *session);
-LIBSSH_API int ssh_get_pubkey_hash(SSH_SESSION *session, unsigned char **hash);
+LIBSSH_API ssh_string ssh_get_pubkey(ssh_session session);
+LIBSSH_API int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash);
LIBSSH_API int ssh_get_random(void *where,int len,int strong);
-LIBSSH_API int ssh_get_version(SSH_SESSION *session);
-LIBSSH_API int ssh_get_status(SSH_SESSION *session);
+LIBSSH_API int ssh_get_version(ssh_session session);
+LIBSSH_API int ssh_get_status(ssh_session session);
LIBSSH_API int ssh_init(void);
-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 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 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 void ssh_message_free(SSH_MESSAGE *msg);
-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_get(ssh_session session);
+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_type(SSH_MESSAGE *msg);
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 void ssh_options_free(SSH_OPTIONS *opt);
LIBSSH_API SSH_OPTIONS *ssh_options_new(void);
@@ -413,32 +413,32 @@ LIBSSH_API const char *ssh_scp_request_get_warning(ssh_scp scp);
LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);
LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
fd_set *readfds, struct timeval *timeout);
-LIBSSH_API int ssh_service_request(SSH_SESSION *session, const char *service);
-LIBSSH_API void ssh_set_blocking(SSH_SESSION *session, int blocking);
-LIBSSH_API void ssh_set_fd_except(SSH_SESSION *session);
-LIBSSH_API void ssh_set_fd_toread(SSH_SESSION *session);
-LIBSSH_API void ssh_set_fd_towrite(SSH_SESSION *session);
-LIBSSH_API void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options);
-LIBSSH_API void ssh_silent_disconnect(SSH_SESSION *session);
+LIBSSH_API int ssh_service_request(ssh_session session, const char *service);
+LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking);
+LIBSSH_API void ssh_set_fd_except(ssh_session session);
+LIBSSH_API void ssh_set_fd_toread(ssh_session session);
+LIBSSH_API void ssh_set_fd_towrite(ssh_session session);
+LIBSSH_API void ssh_set_options(ssh_session session, SSH_OPTIONS *options);
+LIBSSH_API void ssh_silent_disconnect(ssh_session session);
#ifndef _WIN32
-LIBSSH_API int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
+LIBSSH_API int ssh_userauth_agent_pubkey(ssh_session session, const char *username,
ssh_public_key publickey);
#endif
-LIBSSH_API int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase);
-LIBSSH_API int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *submethods);
-LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session);
-LIBSSH_API const char *ssh_userauth_kbdint_getname(SSH_SESSION *session);
-LIBSSH_API int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session);
-LIBSSH_API const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i, char *echo);
-LIBSSH_API int ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int i,
+LIBSSH_API int ssh_userauth_autopubkey(ssh_session session, const char *passphrase);
+LIBSSH_API int ssh_userauth_kbdint(ssh_session session, const char *user, const char *submethods);
+LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(ssh_session session);
+LIBSSH_API const char *ssh_userauth_kbdint_getname(ssh_session session);
+LIBSSH_API int ssh_userauth_kbdint_getnprompts(ssh_session session);
+LIBSSH_API const char *ssh_userauth_kbdint_getprompt(ssh_session session, unsigned int i, char *echo);
+LIBSSH_API int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
const char *answer);
-LIBSSH_API int ssh_userauth_list(SSH_SESSION *session, const char *username);
-LIBSSH_API int ssh_userauth_none(SSH_SESSION *session, const char *username);
-LIBSSH_API int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, ssh_string publickey);
-LIBSSH_API int ssh_userauth_password(SSH_SESSION *session, const char *username, const char *password);
-LIBSSH_API int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, ssh_string publickey, ssh_private_key privatekey);
+LIBSSH_API int ssh_userauth_list(ssh_session session, const char *username);
+LIBSSH_API int ssh_userauth_none(ssh_session session, const char *username);
+LIBSSH_API int ssh_userauth_offer_pubkey(ssh_session session, const char *username, int type, ssh_string publickey);
+LIBSSH_API int ssh_userauth_password(ssh_session session, const char *username, const char *password);
+LIBSSH_API int ssh_userauth_pubkey(ssh_session session, const char *username, ssh_string publickey, ssh_private_key privatekey);
LIBSSH_API const char *ssh_version(int req_version);
-LIBSSH_API int ssh_write_knownhost(SSH_SESSION *session);
+LIBSSH_API int ssh_write_knownhost(ssh_session session);
LIBSSH_API void string_burn(ssh_string str);
LIBSSH_API ssh_string string_copy(ssh_string str);
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 87bf1bfc..83e44735 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -321,7 +321,7 @@ typedef struct ssh_crypto_struct {
struct ssh_channel_struct {
struct ssh_channel_struct *prev;
struct ssh_channel_struct *next;
- SSH_SESSION *session; /* SSH_SESSION pointer */
+ ssh_session session; /* SSH_SESSION pointer */
uint32_t local_channel;
uint32_t local_window;
int local_eof;
@@ -513,7 +513,7 @@ struct ssh_channel_request {
};
struct ssh_message_struct {
- SSH_SESSION *session;
+ ssh_session session;
int type;
struct ssh_auth_request auth_request;
struct ssh_channel_request_open channel_request_open;
@@ -601,7 +601,7 @@ int ssh_poll_ctx(SSH_POLL_CTX *ctx, int timeout);
struct socket;
int ssh_socket_init(void);
-struct socket *ssh_socket_new(SSH_SESSION *session);
+struct socket *ssh_socket_new(ssh_session session);
void ssh_socket_free(struct socket *s);
void ssh_socket_set_fd(struct socket *s, socket_t fd);
socket_t ssh_socket_get_fd(struct socket *s);
@@ -616,7 +616,7 @@ int ssh_socket_fd_isset(struct socket *s, fd_set *set);
void ssh_socket_fd_set(struct socket *s, fd_set *set, int *fd_max);
int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len);
int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len);
-int ssh_socket_wait_for_data(struct socket *s, SSH_SESSION *session, uint32_t len);
+int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len);
int ssh_socket_nonblocking_flush(struct socket *s);
int ssh_socket_blocking_flush(struct socket *s);
int ssh_socket_poll(struct socket *s, int *writeable, int *except);
@@ -628,12 +628,12 @@ int ssh_socket_data_available(struct socket *s);
int ssh_socket_data_writable(struct socket *s);
/* session.c */
-void ssh_cleanup(SSH_SESSION *session);
+void ssh_cleanup(ssh_session session);
/* client.c */
-int ssh_send_banner(SSH_SESSION *session, int is_server);
-char *ssh_get_banner(SSH_SESSION *session);
+int ssh_send_banner(ssh_session session, int is_server);
+char *ssh_get_banner(ssh_session session);
/* config.c */
int ssh_config_parse_file(ssh_options opt, const char *filename);
@@ -644,103 +644,103 @@ void ssh_set_error(void *error, int code, const char *descr, ...) PRINTF_ATTRIBU
/* in dh.c */
/* DH key generation */
void ssh_print_bignum(const char *which,bignum num);
-int dh_generate_e(SSH_SESSION *session);
-int dh_generate_f(SSH_SESSION *session);
-int dh_generate_x(SSH_SESSION *session);
-int dh_generate_y(SSH_SESSION *session);
+int dh_generate_e(ssh_session session);
+int dh_generate_f(ssh_session session);
+int dh_generate_x(ssh_session session);
+int dh_generate_y(ssh_session session);
int ssh_crypto_init(void);
void ssh_crypto_finalize(void);
-ssh_string dh_get_e(SSH_SESSION *session);
-ssh_string dh_get_f(SSH_SESSION *session);
-int dh_import_f(SSH_SESSION *session,ssh_string f_string);
-int dh_import_e(SSH_SESSION *session, ssh_string e_string);
-void dh_import_pubkey(SSH_SESSION *session,ssh_string pubkey_string);
-int dh_build_k(SSH_SESSION *session);
-int make_sessionid(SSH_SESSION *session);
+ssh_string dh_get_e(ssh_session session);
+ssh_string dh_get_f(ssh_session session);
+int dh_import_f(ssh_session session,ssh_string f_string);
+int dh_import_e(ssh_session session, ssh_string e_string);
+void dh_import_pubkey(ssh_session session,ssh_string pubkey_string);
+int dh_build_k(ssh_session session);
+int make_sessionid(ssh_session session);
/* add data for the final cookie */
-int hashbufin_add_cookie(SSH_SESSION *session, unsigned char *cookie);
-int hashbufout_add_cookie(SSH_SESSION *session);
-int generate_session_keys(SSH_SESSION *session);
-int sig_verify(SSH_SESSION *session, ssh_public_key pubkey,
+int hashbufin_add_cookie(ssh_session session, unsigned char *cookie);
+int hashbufout_add_cookie(ssh_session session);
+int generate_session_keys(ssh_session session);
+int sig_verify(ssh_session session, ssh_public_key pubkey,
SIGNATURE *signature, unsigned char *digest, int size);
/* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */
-int signature_verify(SSH_SESSION *session,ssh_string signature);
+int signature_verify(ssh_session session,ssh_string signature);
bignum make_string_bn(ssh_string string);
ssh_string make_bignum_string(bignum num);
/* in crypt.c */
-uint32_t packet_decrypt_len(SSH_SESSION *session,char *crypted);
-int packet_decrypt(SSH_SESSION *session, void *packet,unsigned int len);
-unsigned char *packet_encrypt(SSH_SESSION *session,void *packet,unsigned int len);
+uint32_t packet_decrypt_len(ssh_session session,char *crypted);
+int packet_decrypt(ssh_session session, void *packet,unsigned int len);
+unsigned char *packet_encrypt(ssh_session session,void *packet,unsigned int len);
/* it returns the hmac buffer if exists*/
-int packet_hmac_verify(SSH_SESSION *session,ssh_buffer buffer,unsigned char *mac);
+int packet_hmac_verify(ssh_session session,ssh_buffer buffer,unsigned char *mac);
/* in packet.c */
-void packet_parse(SSH_SESSION *session);
-int packet_send(SSH_SESSION *session);
+void packet_parse(ssh_session session);
+int packet_send(ssh_session session);
-int packet_read(SSH_SESSION *session);
-int packet_translate(SSH_SESSION *session);
-int packet_wait(SSH_SESSION *session,int type,int blocking);
-int packet_flush(SSH_SESSION *session, int enforce_blocking);
+int packet_read(ssh_session session);
+int packet_translate(ssh_session session);
+int packet_wait(ssh_session session,int type,int blocking);
+int packet_flush(ssh_session session, int enforce_blocking);
/* connect.c */
int ssh_regex_init(void);
void ssh_regex_finalize(void);
-SSH_SESSION *ssh_session_new();
-socket_t ssh_connect_host(SSH_SESSION *session, const char *host,const char
+ssh_session ssh_session_new();
+socket_t ssh_connect_host(ssh_session session, const char *host,const char
*bind_addr, int port, long timeout, long usec);
/* in kex.c */
extern const char *ssh_kex_nums[];
-int ssh_send_kex(SSH_SESSION *session, int server_kex);
-void ssh_list_kex(SSH_SESSION *session, KEX *kex);
-int set_kex(SSH_SESSION *session);
-int ssh_get_kex(SSH_SESSION *session, int server_kex);
+int ssh_send_kex(ssh_session session, int server_kex);
+void ssh_list_kex(ssh_session session, KEX *kex);
+int set_kex(ssh_session session);
+int ssh_get_kex(ssh_session session, int server_kex);
int verify_existing_algo(int algo, const char *name);
char **space_tokenize(const char *chain);
-int ssh_get_kex1(SSH_SESSION *session);
+int ssh_get_kex1(ssh_session session);
char *ssh_find_matching(const char *in_d, const char *what_d);
/* in keyfiles.c */
ssh_private_key _privatekey_from_file(void *session, const char *filename,
int type);
-ssh_string try_publickey_from_file(SSH_SESSION *session,
+ssh_string try_publickey_from_file(ssh_session session,
struct ssh_keys_struct keytab,
char **privkeyfile, int *type);
/* in keys.c */
const char *ssh_type_to_char(int type);
int ssh_type_from_name(const char *name);
-ssh_buffer ssh_userauth_build_digest(SSH_SESSION *session, ssh_message msg, char *service);
+ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service);
-ssh_private_key privatekey_make_dss(SSH_SESSION *session, ssh_buffer buffer);
-ssh_private_key privatekey_make_rsa(SSH_SESSION *session, ssh_buffer buffer,
+ssh_private_key privatekey_make_dss(ssh_session session, ssh_buffer buffer);
+ssh_private_key privatekey_make_rsa(ssh_session session, ssh_buffer buffer,
const char *type);
-ssh_private_key privatekey_from_string(SSH_SESSION *session, ssh_string privkey_s);
+ssh_private_key privatekey_from_string(ssh_session session, ssh_string privkey_s);
-ssh_public_key publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer);
-ssh_public_key publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer, int type);
-ssh_public_key publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s);
-SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,ssh_public_key pubkey,int needed_type);
+ssh_public_key publickey_make_dss(ssh_session session, ssh_buffer buffer);
+ssh_public_key publickey_make_rsa(ssh_session session, ssh_buffer buffer, int type);
+ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s);
+SIGNATURE *signature_from_string(ssh_session session, ssh_string signature,ssh_public_key pubkey,int needed_type);
void signature_free(SIGNATURE *sign);
ssh_string ssh_do_sign_with_agent(struct ssh_session_struct *session,
struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey);
-ssh_string ssh_do_sign(SSH_SESSION *session,ssh_buffer sigbuf,
+ssh_string ssh_do_sign(ssh_session session,ssh_buffer sigbuf,
ssh_private_key privatekey);
-ssh_string ssh_sign_session_id(SSH_SESSION *session, ssh_private_key privatekey);
-ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, ssh_public_key key);
+ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey);
+ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key key);
/* channel.c */
-void channel_handle(SSH_SESSION *session, int type);
-ssh_channel channel_new(SSH_SESSION *session);
+void channel_handle(ssh_session session, int type);
+ssh_channel channel_new(ssh_session session);
int channel_default_bufferize(ssh_channel channel, void *data, int len,
int is_stderr);
-uint32_t ssh_channel_new_id(SSH_SESSION *session);
-ssh_channel ssh_channel_from_local(SSH_SESSION *session, uint32_t id);
+uint32_t ssh_channel_new_id(ssh_session session);
+ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id);
int channel_write_common(ssh_channel channel, const void *data,
uint32_t len, int is_stderr);
@@ -785,12 +785,12 @@ ssh_buffer base64_to_bin(const char *source);
unsigned char *bin_to_base64(const unsigned char *source, int len);
/* gzip.c */
-int compress_buffer(SSH_SESSION *session,ssh_buffer buf);
-int decompress_buffer(SSH_SESSION *session,ssh_buffer buf, size_t maxlen);
+int compress_buffer(ssh_session session,ssh_buffer buf);
+int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen);
/* wrapper.c */
-int crypt_set_algorithms(SSH_SESSION *);
-int crypt_set_algorithms_server(SSH_SESSION *session);
+int crypt_set_algorithms(ssh_session );
+int crypt_set_algorithms_server(ssh_session session);
CRYPTO *crypto_new(void);
void crypto_free(CRYPTO *crypto);
@@ -798,10 +798,10 @@ void crypto_free(CRYPTO *crypto);
uint32_t ssh_crc32(const char *buf, uint32_t len);
/* auth1.c */
-int ssh_userauth1_none(SSH_SESSION *session, const char *username);
-int ssh_userauth1_offer_pubkey(SSH_SESSION *session, const char *username,
+int ssh_userauth1_none(ssh_session session, const char *username);
+int ssh_userauth1_offer_pubkey(ssh_session session, const char *username,
int type, ssh_string pubkey);
-int ssh_userauth1_password(SSH_SESSION *session, const char *username,
+int ssh_userauth1_password(ssh_session session, const char *username,
const char *password);
/* in misc.c */
/* gets the user home dir. */
@@ -854,20 +854,20 @@ int channel_request_pty_size1(ssh_channel channel, const char *terminal,
int channel_change_pty_size1(ssh_channel channel, int cols, int rows);
int channel_request_shell1(ssh_channel channel);
int channel_request_exec1(ssh_channel channel, const char *cmd);
-int channel_handle1(SSH_SESSION *session, int type);
+int channel_handle1(ssh_session session, int type);
int channel_write1(ssh_channel channel, const void *data, int len);
/* session.c */
-int ssh_handle_packets(SSH_SESSION *session);
+int ssh_handle_packets(ssh_session session);
/* match.c */
int match_hostname(const char *host, const char *pattern, unsigned int len);
/* messages.c */
-void message_handle(SSH_SESSION *session, uint32_t type);
-int ssh_execute_message_callbacks(SSH_SESSION *session);
+void message_handle(ssh_session session, uint32_t type);
+int ssh_execute_message_callbacks(ssh_session session);
/* scp.c */
int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len);
diff --git a/include/libssh/server.h b/include/libssh/server.h
index 26f16b59..fefee1b0 100644
--- a/include/libssh/server.h
+++ b/include/libssh/server.h
@@ -103,7 +103,7 @@ LIBSSH_API void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind);
*
* @return A newly allocated ssh session, NULL on error.
*/
-LIBSSH_API SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind);
+LIBSSH_API ssh_session ssh_bind_accept(SSH_BIND *ssh_bind);
/**
* @brief Free a ssh servers bind.
@@ -119,7 +119,7 @@ LIBSSH_API void ssh_bind_free(SSH_BIND *ssh_bind);
*
* @return 0 on success, < 0 on error.
*/
-LIBSSH_API int ssh_accept(SSH_SESSION *session);
+LIBSSH_API int ssh_accept(ssh_session session);
LIBSSH_API int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len);
@@ -136,7 +136,7 @@ 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 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));
LIBSSH_API char *ssh_message_channel_request_open_originator(SSH_MESSAGE *msg);
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index fd354600..3bb242b2 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -70,7 +70,7 @@ extern "C" {
typedef struct sftp_ext_struct *sftp_ext;
typedef struct sftp_session_struct {
- SSH_SESSION *session;
+ ssh_session session;
ssh_channel channel;
int server_version;
int client_version;
@@ -194,7 +194,7 @@ typedef struct sftp_statvfs_struct {
*
* @return A new sftp session or NULL on error.
*/
-LIBSSH_API SFTP_SESSION *sftp_new(SSH_SESSION *session);
+LIBSSH_API SFTP_SESSION *sftp_new(ssh_session session);
/**
* @brief Close and deallocate a sftp session.
@@ -764,7 +764,7 @@ LIBSSH_API int sftp_server_version(SFTP_SESSION *sftp);
*
* @return A new sftp server session.
*/
-LIBSSH_API SFTP_SESSION *sftp_server_new(SSH_SESSION *session, ssh_channel chan);
+LIBSSH_API SFTP_SESSION *sftp_server_new(ssh_session session, ssh_channel chan);
/**
* @brief Intialize the sftp server.
diff --git a/libssh/agent.c b/libssh/agent.c
index 3a8954eb..81233c14 100644
--- a/libssh/agent.c
+++ b/libssh/agent.c
@@ -160,7 +160,7 @@ void agent_free(ssh_agent agent) {
}
}
-static int agent_connect(SSH_SESSION *session) {
+static int agent_connect(ssh_session session) {
const char *auth_sock = NULL;
if (session == NULL || session->agent == NULL) {
@@ -475,7 +475,7 @@ error:
return NULL;
}
-int agent_is_running(SSH_SESSION *session) {
+int agent_is_running(ssh_session session) {
if (session == NULL || session->agent == NULL) {
return 0;
}
diff --git a/libssh/auth.c b/libssh/auth.c
index b5276f17..8dc17f8a 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -39,7 +39,7 @@
/** \addtogroup ssh_auth
* @{ */
-static int ask_userauth(SSH_SESSION *session) {
+static int ask_userauth(ssh_session session) {
int rc = 0;
enter_function();
@@ -56,7 +56,7 @@ static int ask_userauth(SSH_SESSION *session) {
return rc;
}
-static int wait_auth_status(SSH_SESSION *session, int kbdint) {
+static int wait_auth_status(ssh_session session, int kbdint) {
char *auth_methods = NULL;
ssh_string auth;
int rc = SSH_AUTH_ERROR;
@@ -163,7 +163,7 @@ static int wait_auth_status(SSH_SESSION *session, int kbdint) {
return rc;
}
-int ssh_auth_list(SSH_SESSION *session) {
+int ssh_auth_list(ssh_session session) {
if (session == NULL) {
return -1;
}
@@ -171,7 +171,7 @@ int ssh_auth_list(SSH_SESSION *session) {
return session->auth_methods;
}
-int ssh_userauth_list(SSH_SESSION *session, const char *username) {
+int ssh_userauth_list(ssh_session session, const char *username) {
if (session == NULL || username == NULL) {
return SSH_AUTH_ERROR;
}
@@ -200,7 +200,7 @@ int ssh_userauth_list(SSH_SESSION *session, const char *username) {
* have to use another method\n
* SSH_AUTH_SUCCESS: Authentication success
*/
-int ssh_userauth_none(SSH_SESSION *session, const char *username) {
+int ssh_userauth_none(ssh_session session, const char *username) {
ssh_string user = NULL;
ssh_string service = NULL;
ssh_string method = NULL;
@@ -304,7 +304,7 @@ error:
* @see privatekey_from_file()
* @see ssh_userauth_pubkey()
*/
-int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username,
+int ssh_userauth_offer_pubkey(ssh_session session, const char *username,
int type, ssh_string publickey) {
ssh_string user = NULL;
ssh_string service = NULL;
@@ -417,7 +417,7 @@ error:
* @see privatekey_free()
* @see ssh_userauth_offer_pubkey()
*/
-int ssh_userauth_pubkey(SSH_SESSION *session, const char *username,
+int ssh_userauth_pubkey(ssh_session session, const char *username,
ssh_string publickey, ssh_private_key privatekey) {
ssh_string user = NULL;
ssh_string service = NULL;
@@ -536,7 +536,7 @@ error:
* @see privatekey_free()
* @see ssh_userauth_offer_pubkey()
*/
-int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
+int ssh_userauth_agent_pubkey(ssh_session session, const char *username,
ssh_public_key publickey) {
ssh_string user = NULL;
ssh_string service = NULL;
@@ -661,7 +661,7 @@ error:
* @see ssh_userauth_kbdint()
* @see BURN_STRING
*/
-int ssh_userauth_password(SSH_SESSION *session, const char *username,
+int ssh_userauth_password(ssh_session session, const char *username,
const char *password) {
ssh_string user = NULL;
ssh_string service = NULL;
@@ -808,7 +808,7 @@ static struct ssh_keys_struct keytab[] = {
* @see ssh_userauth_password()
* @see ssh_options_set()
*/
-int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) {
+int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
struct ssh_public_key_struct *publickey;
ssh_string pubkey;
ssh_private_key privkey;
@@ -1089,7 +1089,7 @@ static void kbdint_clean(ssh_kbdint kbd) {
/* this function sends the first packet as explained in section 3.1
* of the draft */
-static int kbdauth_init(SSH_SESSION *session, const char *user,
+static int kbdauth_init(ssh_session session, const char *user,
const char *submethods) {
ssh_string usr = NULL;
ssh_string sub = NULL;
@@ -1149,7 +1149,7 @@ error:
return rc;
}
-static int kbdauth_info_get(SSH_SESSION *session) {
+static int kbdauth_info_get(ssh_session session) {
ssh_string name; /* name of the "asking" window showed to client */
ssh_string instruction;
ssh_string tmp;
@@ -1266,7 +1266,7 @@ static int kbdauth_info_get(SSH_SESSION *session) {
}
/* sends challenge back to the server */
-static int kbdauth_send(SSH_SESSION *session) {
+static int kbdauth_send(ssh_session session) {
ssh_string answer = NULL;
int rc = SSH_AUTH_ERROR;
uint32_t i;
@@ -1339,7 +1339,7 @@ error:
* @see ssh_userauth_kbdint_getprompt()
* @see ssh_userauth_kbdint_setanswer()
*/
-int ssh_userauth_kbdint(SSH_SESSION *session, const char *user,
+int ssh_userauth_kbdint(ssh_session session, const char *user,
const char *submethods) {
int rc = SSH_AUTH_ERROR;
@@ -1419,7 +1419,7 @@ int ssh_userauth_kbdint(SSH_SESSION *session, const char *user,
*
* @returns The number of prompts.
*/
-int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session) {
+int ssh_userauth_kbdint_getnprompts(ssh_session session) {
return session->kbdint->nprompts;
}
@@ -1433,7 +1433,7 @@ int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session) {
*
* @returns The name of the message block. Do not free it.
*/
-const char *ssh_userauth_kbdint_getname(SSH_SESSION *session) {
+const char *ssh_userauth_kbdint_getname(ssh_session session) {
return session->kbdint->name;
}
@@ -1448,7 +1448,7 @@ const char *ssh_userauth_kbdint_getname(SSH_SESSION *session) {
* @returns The instruction of the message block.
*/
-const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session) {
+const char *ssh_userauth_kbdint_getinstruction(ssh_session session) {
return session->kbdint->instruction;
}
@@ -1468,7 +1468,7 @@ const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session) {
*
* @returns A pointer to the prompt. Do not free it.
*/
-const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i,
+const char *ssh_userauth_kbdint_getprompt(ssh_session session, unsigned int i,
char *echo) {
if (i > session->kbdint->nprompts) {
return NULL;
@@ -1489,7 +1489,7 @@ const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i,
* \param answer answer to give to server
* \return 0 on success, < 0 on error.
*/
-int ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int i,
+int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
const char *answer) {
if (session == NULL || answer == NULL || i > session->kbdint->nprompts) {
return -1;
diff --git a/libssh/auth1.c b/libssh/auth1.c
index a1e599cf..8a3f8199 100644
--- a/libssh/auth1.c
+++ b/libssh/auth1.c
@@ -28,7 +28,7 @@
#include "libssh/ssh1.h"
#ifdef WITH_SSH1
-static int wait_auth1_status(SSH_SESSION *session) {
+static int wait_auth1_status(ssh_session session) {
/* wait for a packet */
if (packet_read(session) != SSH_OK) {
return SSH_AUTH_ERROR;
@@ -51,7 +51,7 @@ static int wait_auth1_status(SSH_SESSION *session) {
return SSH_AUTH_ERROR;
}
-static int send_username(SSH_SESSION *session, const char *username) {
+static int send_username(ssh_session session, const char *username) {
ssh_string user = NULL;
/* returns SSH_AUTH_SUCCESS or SSH_AUTH_DENIED */
if(session->auth_service_asked) {
@@ -91,12 +91,12 @@ static int send_username(SSH_SESSION *session, const char *username) {
}
/* use the "none" authentication question */
-int ssh_userauth1_none(SSH_SESSION *session, const char *username){
+int ssh_userauth1_none(ssh_session session, const char *username){
return send_username(session, username);
}
/*
-int ssh_userauth_offer_pubkey(SSH_SESSION *session, char *username,int type, ssh_string publickey){
+int ssh_userauth_offer_pubkey(ssh_session session, char *username,int type, ssh_string publickey){
ssh_string user;
ssh_string service;
ssh_string method;
@@ -136,7 +136,7 @@ int ssh_userauth_offer_pubkey(SSH_SESSION *session, char *username,int type, ssh
/** \internal
* \todo implement ssh1 public key
*/
-int ssh_userauth1_offer_pubkey(SSH_SESSION *session, const char *username,
+int ssh_userauth1_offer_pubkey(ssh_session session, const char *username,
int type, ssh_string pubkey) {
(void) session;
(void) username;
@@ -146,7 +146,7 @@ int ssh_userauth1_offer_pubkey(SSH_SESSION *session, const char *username,
}
/*
-int ssh_userauth_pubkey(SSH_SESSION *session, char *username, ssh_string publickey, ssh_private_key privatekey){
+int ssh_userauth_pubkey(ssh_session session, char *username, ssh_string publickey, ssh_private_key privatekey){
ssh_string user;
ssh_string service;
ssh_string method;
@@ -192,7 +192,7 @@ int ssh_userauth_pubkey(SSH_SESSION *session, char *username, ssh_string publick
}
*/
-int ssh_userauth1_password(SSH_SESSION *session, const char *username,
+int ssh_userauth1_password(ssh_session session, const char *username,
const char *password) {
ssh_string pwd = NULL;
int rc;
diff --git a/libssh/channels.c b/libssh/channels.c
index 923ba4a3..c5560de9 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -55,7 +55,7 @@
*
* @return A pointer to a newly allocated channel, NULL on error.
*/
-ssh_channel channel_new(SSH_SESSION *session) {
+ssh_channel channel_new(ssh_session session) {
ssh_channel channel = NULL;
channel = malloc(sizeof(struct ssh_channel_struct));
@@ -102,13 +102,13 @@ ssh_channel channel_new(SSH_SESSION *session) {
*
* @return The new channel identifier.
*/
-uint32_t ssh_channel_new_id(SSH_SESSION *session) {
+uint32_t ssh_channel_new_id(ssh_session session) {
return ++(session->maxchannel);
}
static int channel_open(ssh_channel channel, const char *type_c, int window,
int maxpacket, ssh_buffer payload) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_string type = NULL;
uint32_t tmp = 0;
@@ -233,7 +233,7 @@ static int channel_open(ssh_channel channel, const char *type_c, int window,
}
/* get ssh channel from local session? */
-ssh_channel ssh_channel_from_local(SSH_SESSION *session, uint32_t id) {
+ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id) {
ssh_channel initchan = session->channels;
ssh_channel channel;
@@ -252,7 +252,7 @@ ssh_channel ssh_channel_from_local(SSH_SESSION *session, uint32_t id) {
return channel;
}
-static int grow_window(SSH_SESSION *session, ssh_channel channel, int minimumsize) {
+static int grow_window(ssh_session session, ssh_channel channel, int minimumsize) {
uint32_t new_window = minimumsize > WINDOWBASE ? minimumsize : WINDOWBASE;
enter_function();
@@ -286,7 +286,7 @@ error:
return -1;
}
-static ssh_channel channel_from_msg(SSH_SESSION *session) {
+static ssh_channel channel_from_msg(ssh_session session) {
ssh_channel channel;
uint32_t chan;
@@ -306,7 +306,7 @@ static ssh_channel channel_from_msg(SSH_SESSION *session) {
return channel;
}
-static void channel_rcv_change_window(SSH_SESSION *session) {
+static void channel_rcv_change_window(ssh_session session) {
ssh_channel channel;
uint32_t bytes;
int rc;
@@ -340,7 +340,7 @@ static void channel_rcv_change_window(SSH_SESSION *session) {
}
/* is_stderr is set to 1 if the data are extended, ie stderr */
-static void channel_rcv_data(SSH_SESSION *session,int is_stderr) {
+static void channel_rcv_data(ssh_session session,int is_stderr) {
ssh_channel channel;
ssh_string str;
size_t len;
@@ -406,7 +406,7 @@ static void channel_rcv_data(SSH_SESSION *session,int is_stderr) {
leave_function();
}
-static void channel_rcv_eof(SSH_SESSION *session) {
+static void channel_rcv_eof(ssh_session session) {
ssh_channel channel;
enter_function();
@@ -428,7 +428,7 @@ static void channel_rcv_eof(SSH_SESSION *session) {
leave_function();
}
-static void channel_rcv_close(SSH_SESSION *session) {
+static void channel_rcv_close(ssh_session session) {
ssh_channel channel;
enter_function();
@@ -467,7 +467,7 @@ static void channel_rcv_close(SSH_SESSION *session) {
leave_function();
}
-static void channel_rcv_request(SSH_SESSION *session) {
+static void channel_rcv_request(ssh_session session) {
ssh_channel channel;
ssh_string request_s;
char *request;
@@ -560,7 +560,7 @@ static void channel_rcv_request(SSH_SESSION *session) {
* channel_handle() is called by packet_wait(), for example when there is
* channel informations to handle.
*/
-void channel_handle(SSH_SESSION *session, int type){
+void channel_handle(ssh_session session, int type){
enter_function();
ssh_log(session, SSH_LOG_PROTOCOL, "Channel_handle(%d)", type);
@@ -681,7 +681,7 @@ int channel_open_session(ssh_channel channel) {
*/
int channel_open_forward(ssh_channel channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_buffer payload = NULL;
ssh_string str = NULL;
int rc = SSH_ERROR;
@@ -731,7 +731,7 @@ error:
* @warning Any data unread on this channel will be lost.
*/
void channel_free(ssh_channel channel) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
enter_function();
if (channel == NULL) {
@@ -780,7 +780,7 @@ void channel_free(ssh_channel channel) {
* @see channel_free()
*/
int channel_send_eof(ssh_channel channel){
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
int rc = SSH_ERROR;
enter_function();
@@ -823,7 +823,7 @@ error:
* @see channel_eof()
*/
int channel_close(ssh_channel channel){
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
int rc = 0;
enter_function();
@@ -863,7 +863,7 @@ error:
int channel_write_common(ssh_channel channel, const void *data,
uint32_t len, int is_stderr) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
int origlen = len;
int effectivelen;
@@ -1021,7 +1021,7 @@ void channel_set_blocking(ssh_channel channel, int blocking) {
static int channel_request(ssh_channel channel, const char *request,
ssh_buffer buffer, int reply) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_string req = NULL;
int rc = SSH_ERROR;
@@ -1099,7 +1099,7 @@ error:
*/
int channel_request_pty_size(ssh_channel channel, const char *terminal,
int col, int row) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_string term = NULL;
ssh_buffer buffer = NULL;
int rc = SSH_ERROR;
@@ -1168,7 +1168,7 @@ int channel_request_pty(ssh_channel channel) {
* is running at same time (not 100% threadsafe).
*/
int channel_change_pty_size(ssh_channel channel, int cols, int rows) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_buffer buffer = NULL;
int rc = SSH_ERROR;
@@ -1728,7 +1728,7 @@ error:
*/
int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
int is_stderr) {
- SSH_SESSION *session=channel->session;
+ ssh_session session=channel->session;
ssh_buffer stdbuf = channel->stdout_buffer;
uint32_t maxread = count;
uint32_t len;
@@ -1836,7 +1836,7 @@ int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
* channel_read_buffer().
*/
int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_buffer stdbuf = channel->stdout_buffer;
uint32_t len;
@@ -1935,7 +1935,7 @@ int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr)
*/
int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
int is_stderr) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
uint32_t to_read;
int rc;
@@ -1972,7 +1972,7 @@ int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
* @see channel_is_eof()
*/
int channel_poll(ssh_channel channel, int is_stderr){
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_buffer stdbuf = channel->stdout_buffer;
enter_function();
@@ -2006,7 +2006,7 @@ int channel_poll(ssh_channel channel, int is_stderr){
*
* @return The session pointer.
*/
-SSH_SESSION *channel_get_session(ssh_channel channel) {
+ssh_session channel_get_session(ssh_channel channel) {
return channel->session;
}
diff --git a/libssh/channels1.c b/libssh/channels1.c
index 914cd386..5285f17b 100644
--- a/libssh/channels1.c
+++ b/libssh/channels1.c
@@ -45,7 +45,7 @@ int channel_open_session1(ssh_channel chan) {
* We guess we are requesting an *exec* channel. It can only have one exec
* channel. So we abort with an error if we need more than one.
*/
- SSH_SESSION *session = chan->session;
+ ssh_session session = chan->session;
if (session->exec_channel_opened) {
ssh_set_error(session, SSH_REQUEST_DENIED,
"SSH1 supports only one execution channel. "
@@ -75,7 +75,7 @@ int channel_open_session1(ssh_channel chan) {
int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col,
int row) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_string str = NULL;
str = string_from_char(terminal);
@@ -127,7 +127,7 @@ int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col
}
int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
if (buffer_add_u8(session->out_buffer, SSH_CMSG_WINDOW_SIZE) < 0 ||
buffer_add_u32(session->out_buffer, ntohl(rows)) < 0 ||
@@ -164,7 +164,7 @@ int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
}
int channel_request_shell1(ssh_channel channel) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
if (buffer_add_u8(session->out_buffer,SSH_CMSG_EXEC_SHELL) < 0) {
return -1;
@@ -180,7 +180,7 @@ int channel_request_shell1(ssh_channel channel) {
}
int channel_request_exec1(ssh_channel channel, const char *cmd) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
ssh_string command = NULL;
command = string_from_char(cmd);
@@ -204,7 +204,7 @@ int channel_request_exec1(ssh_channel channel, const char *cmd) {
return 0;
}
-static int channel_rcv_data1(SSH_SESSION *session, int is_stderr) {
+static int channel_rcv_data1(ssh_session session, int is_stderr) {
ssh_channel channel = session->channels;
ssh_string str = NULL;
@@ -228,7 +228,7 @@ static int channel_rcv_data1(SSH_SESSION *session, int is_stderr) {
return 0;
}
-static int channel_rcv_close1(SSH_SESSION *session) {
+static int channel_rcv_close1(ssh_session session) {
ssh_channel channel = session->channels;
uint32_t status;
@@ -253,7 +253,7 @@ static int channel_rcv_close1(SSH_SESSION *session) {
return 0;
}
-int channel_handle1(SSH_SESSION *session, int type) {
+int channel_handle1(ssh_session session, int type) {
ssh_log(session, SSH_LOG_RARE, "Channel_handle1(%d)", type);
switch (type) {
case SSH_SMSG_STDOUT_DATA:
@@ -279,7 +279,7 @@ int channel_handle1(SSH_SESSION *session, int type) {
}
int channel_write1(ssh_channel channel, const void *data, int len) {
- SSH_SESSION *session = channel->session;
+ ssh_session session = channel->session;
int origlen = len;
int effectivelen;
const unsigned char *ptr=data;
diff --git a/libssh/client.c b/libssh/client.c
index 79c82497..b29f8329 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -48,7 +48,7 @@
*
* @return A newly allocated string with the banner or NULL on error.
*/
-char *ssh_get_banner(SSH_SESSION *session) {
+char *ssh_get_banner(ssh_session session) {
char buffer[128] = {0};
char *str = NULL;
int i;
@@ -97,7 +97,7 @@ char *ssh_get_banner(SSH_SESSION *session) {
*
* @see ssh_get_banner()
*/
-static int ssh_analyze_banner(SSH_SESSION *session, int *ssh1, int *ssh2) {
+static int ssh_analyze_banner(ssh_session session, int *ssh1, int *ssh2) {
const char *banner = session->serverbanner;
const char *openssh;
@@ -155,7 +155,7 @@ static int ssh_analyze_banner(SSH_SESSION *session, int *ssh1, int *ssh2) {
*
* @return 0 on success, < 0 on error.
*/
-int ssh_send_banner(SSH_SESSION *session, int server) {
+int ssh_send_banner(ssh_session session, int server) {
const char *banner = NULL;
char buffer[128] = {0};
@@ -203,7 +203,7 @@ int ssh_send_banner(SSH_SESSION *session, int server) {
#define DH_STATE_NEWKEYS_TO_SEND 3
#define DH_STATE_NEWKEYS_SENT 4
#define DH_STATE_FINISHED 5
-static int dh_handshake(SSH_SESSION *session) {
+static int dh_handshake(ssh_session session) {
ssh_string e = NULL;
ssh_string f = NULL;
ssh_string pubkey = NULL;
@@ -413,7 +413,7 @@ error:
*
* @return 0 on success, < 0 on error.
*/
-int ssh_service_request(SSH_SESSION *session, const char *service) {
+int ssh_service_request(ssh_session session, const char *service) {
ssh_string service_s = NULL;
enter_function();
@@ -469,7 +469,7 @@ int ssh_service_request(SSH_SESSION *session, const char *service) {
* \see ssh_new()
* \see ssh_disconnect()
*/
-int ssh_connect(SSH_SESSION *session) {
+int ssh_connect(ssh_session session) {
SSH_OPTIONS *options = session->options;
int ssh1 = 0;
int ssh2 = 0;
@@ -621,7 +621,7 @@ int ssh_connect(SSH_SESSION *session) {
*
* @return A newly allocated string with the banner, NULL on error.
*/
-char *ssh_get_issue_banner(SSH_SESSION *session) {
+char *ssh_get_issue_banner(ssh_session session) {
if (session == NULL || session->banner == NULL) {
return NULL;
}
@@ -652,7 +652,7 @@ int ssh_get_openssh_version(ssh_session session) {
*
* @param session The SSH session to disconnect.
*/
-void ssh_disconnect(SSH_SESSION *session) {
+void ssh_disconnect(ssh_session session) {
ssh_string str = NULL;
if (session == NULL) {
diff --git a/libssh/connect.c b/libssh/connect.c
index c472d2f6..df9c0eb6 100644
--- a/libssh/connect.c
+++ b/libssh/connect.c
@@ -167,7 +167,7 @@ static int ssh_connect_socket_close(socket_t s){
}
-static int getai(SSH_SESSION *session, const char *host, int port, struct addrinfo **ai) {
+static int getai(ssh_session session, const char *host, int port, struct addrinfo **ai) {
const char *service = NULL;
struct addrinfo hints;
char s_port[10];
@@ -197,7 +197,7 @@ static int getai(SSH_SESSION *session, const char *host, int port, struct addrin
return getaddrinfo(host, service, &hints, ai);
}
-static int ssh_connect_ai_timeout(SSH_SESSION *session, const char *host,
+static int ssh_connect_ai_timeout(ssh_session session, const char *host,
int port, struct addrinfo *ai, long timeout, long usec, socket_t s) {
struct timeval to;
fd_set set;
@@ -263,7 +263,7 @@ static int ssh_connect_ai_timeout(SSH_SESSION *session, const char *host,
*
* @returns A file descriptor, < 0 on error.
*/
-socket_t ssh_connect_host(SSH_SESSION *session, const char *host,
+socket_t ssh_connect_host(ssh_session session, const char *host,
const char *bind_addr, int port, long timeout, long usec) {
socket_t s = -1;
int rc;
diff --git a/libssh/crypt.c b/libssh/crypt.c
index 1d4af3e1..d353772c 100644
--- a/libssh/crypt.c
+++ b/libssh/crypt.c
@@ -38,7 +38,7 @@
#include "libssh/priv.h"
#include "libssh/crypto.h"
-uint32_t packet_decrypt_len(SSH_SESSION *session, char *crypted){
+uint32_t packet_decrypt_len(ssh_session session, char *crypted){
uint32_t decrypted;
if (session->current_crypto) {
@@ -56,7 +56,7 @@ uint32_t packet_decrypt_len(SSH_SESSION *session, char *crypted){
return ntohl(decrypted);
}
-int packet_decrypt(SSH_SESSION *session, void *data,uint32_t len) {
+int packet_decrypt(ssh_session session, void *data,uint32_t len) {
struct crypto_struct *crypto = session->current_crypto->in_cipher;
char *out = NULL;
if(len % session->current_crypto->in_cipher->blocksize != 0){
@@ -92,7 +92,7 @@ int packet_decrypt(SSH_SESSION *session, void *data,uint32_t len) {
return 0;
}
-unsigned char *packet_encrypt(SSH_SESSION *session, void *data, uint32_t len) {
+unsigned char *packet_encrypt(ssh_session session, void *data, uint32_t len) {
struct crypto_struct *crypto = NULL;
HMACCTX ctx = NULL;
char *out = NULL;
@@ -179,7 +179,7 @@ unsigned char *packet_encrypt(SSH_SESSION *session, void *data, uint32_t len) {
* @return 0 if hmac and mac are equal, < 0 if not or an error
* occured.
*/
-int packet_hmac_verify(SSH_SESSION *session, ssh_buffer buffer,
+int packet_hmac_verify(ssh_session session, ssh_buffer buffer,
unsigned char *mac) {
unsigned char hmacbuf[EVP_MAX_MD_SIZE] = {0};
HMACCTX ctx;
diff --git a/libssh/dh.c b/libssh/dh.c
index d07ca971..3290e0bb 100644
--- a/libssh/dh.c
+++ b/libssh/dh.c
@@ -217,7 +217,7 @@ void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len) {
printf("%s: %s\n", descr, hexa);
}
-int dh_generate_x(SSH_SESSION *session) {
+int dh_generate_x(ssh_session session) {
session->next_crypto->x = bignum_new();
if (session->next_crypto->x == NULL) {
return -1;
@@ -238,7 +238,7 @@ int dh_generate_x(SSH_SESSION *session) {
}
/* used by server */
-int dh_generate_y(SSH_SESSION *session) {
+int dh_generate_y(ssh_session session) {
session->next_crypto->y = bignum_new();
if (session->next_crypto->y == NULL) {
return -1;
@@ -259,7 +259,7 @@ int dh_generate_y(SSH_SESSION *session) {
}
/* used by server */
-int dh_generate_e(SSH_SESSION *session) {
+int dh_generate_e(ssh_session session) {
#ifdef HAVE_LIBCRYPTO
bignum_CTX ctx = bignum_ctx_new();
if (ctx == NULL) {
@@ -292,7 +292,7 @@ int dh_generate_e(SSH_SESSION *session) {
return 0;
}
-int dh_generate_f(SSH_SESSION *session) {
+int dh_generate_f(ssh_session session) {
#ifdef HAVE_LIBCRYPTO
bignum_CTX ctx = bignum_ctx_new();
if (ctx == NULL) {
@@ -377,20 +377,20 @@ bignum make_string_bn(ssh_string string){
return bn;
}
-ssh_string dh_get_e(SSH_SESSION *session) {
+ssh_string dh_get_e(ssh_session session) {
return make_bignum_string(session->next_crypto->e);
}
/* used by server */
-ssh_string dh_get_f(SSH_SESSION *session) {
+ssh_string dh_get_f(ssh_session session) {
return make_bignum_string(session->next_crypto->f);
}
-void dh_import_pubkey(SSH_SESSION *session, ssh_string pubkey_string) {
+void dh_import_pubkey(ssh_session session, ssh_string pubkey_string) {
session->next_crypto->server_pubkey = pubkey_string;
}
-int dh_import_f(SSH_SESSION *session, ssh_string f_string) {
+int dh_import_f(ssh_session session, ssh_string f_string) {
session->next_crypto->f = make_string_bn(f_string);
if (session->next_crypto->f == NULL) {
return -1;
@@ -404,7 +404,7 @@ int dh_import_f(SSH_SESSION *session, ssh_string f_string) {
}
/* used by the server implementation */
-int dh_import_e(SSH_SESSION *session, ssh_string e_string) {
+int dh_import_e(ssh_session session, ssh_string e_string) {
session->next_crypto->e = make_string_bn(e_string);
if (session->next_crypto->e == NULL) {
return -1;
@@ -417,7 +417,7 @@ int dh_import_e(SSH_SESSION *session, ssh_string e_string) {
return 0;
}
-int dh_build_k(SSH_SESSION *session) {
+int dh_build_k(ssh_session session) {
#ifdef HAVE_LIBCRYPTO
bignum_CTX ctx = bignum_ctx_new();
if (ctx == NULL) {
@@ -474,7 +474,7 @@ static void sha_add(ssh_string str,SHACTX ctx){
}
*/
-int make_sessionid(SSH_SESSION *session) {
+int make_sessionid(ssh_session session) {
SHACTX ctx;
ssh_string num = NULL;
ssh_string str = NULL;
@@ -620,7 +620,7 @@ error:
return rc;
}
-int hashbufout_add_cookie(SSH_SESSION *session) {
+int hashbufout_add_cookie(ssh_session session) {
session->out_hashbuf = buffer_new();
if (session->out_hashbuf == NULL) {
return -1;
@@ -648,7 +648,7 @@ int hashbufout_add_cookie(SSH_SESSION *session) {
return 0;
}
-int hashbufin_add_cookie(SSH_SESSION *session, unsigned char *cookie) {
+int hashbufin_add_cookie(ssh_session session, unsigned char *cookie) {
session->in_hashbuf = buffer_new();
if (session->in_hashbuf == NULL) {
return -1;
@@ -686,7 +686,7 @@ static int generate_one_key(ssh_string k,
return 0;
}
-int generate_session_keys(SSH_SESSION *session) {
+int generate_session_keys(ssh_session session) {
ssh_string k_string = NULL;
SHACTX ctx = NULL;
int rc = -1;
@@ -816,7 +816,7 @@ error:
* @see ssh_get_hexa()
* @see ssh_print_hexa()
*/
-int ssh_get_pubkey_hash(SSH_SESSION *session, unsigned char **hash) {
+int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash) {
ssh_string pubkey;
MD5CTX ctx;
unsigned char *h;
@@ -864,7 +864,7 @@ void ssh_clean_pubkey_hash(unsigned char **hash) {
*hash = NULL;
}
-ssh_string ssh_get_pubkey(SSH_SESSION *session){
+ssh_string ssh_get_pubkey(ssh_session session){
return string_copy(session->current_crypto->server_pubkey);
}
@@ -892,7 +892,7 @@ static int match(const char *group, const char *object){
return 0;
}
-int sig_verify(SSH_SESSION *session, ssh_public_key pubkey,
+int sig_verify(ssh_session session, ssh_public_key pubkey,
SIGNATURE *signature, unsigned char *digest, int size) {
#ifdef HAVE_LIBGCRYPT
gcry_error_t valid = 0;
@@ -987,7 +987,7 @@ int sig_verify(SSH_SESSION *session, ssh_public_key pubkey,
return -1;
}
-int signature_verify(SSH_SESSION *session, ssh_string signature) {
+int signature_verify(ssh_session session, ssh_string signature) {
ssh_public_key pubkey = NULL;
SIGNATURE *sign = NULL;
int err;
diff --git a/libssh/gzip.c b/libssh/gzip.c
index f82ff5a5..000e7775 100644
--- a/libssh/gzip.c
+++ b/libssh/gzip.c
@@ -33,7 +33,7 @@
#define BLOCKSIZE 4092
-static z_stream *initcompress(SSH_SESSION *session, int level) {
+static z_stream *initcompress(ssh_session session, int level) {
z_stream *stream = NULL;
int status;
@@ -54,7 +54,7 @@ static z_stream *initcompress(SSH_SESSION *session, int level) {
return stream;
}
-static ssh_buffer gzip_compress(SSH_SESSION *session,ssh_buffer source,int level){
+static ssh_buffer gzip_compress(ssh_session session,ssh_buffer source,int level){
z_stream *zout = session->current_crypto->compress_out_ctx;
void *in_ptr = buffer_get(source);
unsigned long in_size = buffer_get_len(source);
@@ -98,7 +98,7 @@ static ssh_buffer gzip_compress(SSH_SESSION *session,ssh_buffer source,int level
return dest;
}
-int compress_buffer(SSH_SESSION *session, ssh_buffer buf) {
+int compress_buffer(ssh_session session, ssh_buffer buf) {
ssh_buffer dest = NULL;
dest = gzip_compress(session, buf, 9);
@@ -122,7 +122,7 @@ int compress_buffer(SSH_SESSION *session, ssh_buffer buf) {
/* decompression */
-static z_stream *initdecompress(SSH_SESSION *session) {
+static z_stream *initdecompress(ssh_session session) {
z_stream *stream = NULL;
int status;
@@ -143,7 +143,7 @@ static z_stream *initdecompress(SSH_SESSION *session) {
return stream;
}
-static ssh_buffer gzip_decompress(SSH_SESSION *session, ssh_buffer source, size_t maxlen) {
+static ssh_buffer gzip_decompress(ssh_session session, ssh_buffer source, size_t maxlen) {
z_stream *zin = session->current_crypto->compress_in_ctx;
void *in_ptr = buffer_get_rest(source);
unsigned long in_size = buffer_get_rest_len(source);
@@ -194,7 +194,7 @@ static ssh_buffer gzip_decompress(SSH_SESSION *session, ssh_buffer source, size_
return dest;
}
-int decompress_buffer(SSH_SESSION *session,ssh_buffer buf, size_t maxlen){
+int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen){
ssh_buffer dest = NULL;
dest = gzip_decompress(session,buf, maxlen);
diff --git a/libssh/kex.c b/libssh/kex.c
index dd391ca3..52376668 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -232,7 +232,7 @@ char *ssh_find_matching(const char *in_d, const char *what_d){
return NULL;
}
-int ssh_get_kex(SSH_SESSION *session, int server_kex) {
+int ssh_get_kex(ssh_session session, int server_kex) {
ssh_string str = NULL;
char *strings[10];
int i;
@@ -328,7 +328,7 @@ void ssh_list_kex(ssh_session session, KEX *kex) {
/* it must be aware of the server kex message */
/* it can fail if option is null, not any user specified kex method matches the server one, if not any default kex matches */
-int set_kex(SSH_SESSION *session){
+int set_kex(ssh_session session){
KEX *server = &session->server_kex;
KEX *client=&session->client_kex;
SSH_OPTIONS *options=session->options;
@@ -371,7 +371,7 @@ int set_kex(SSH_SESSION *session){
}
/* this function only sends the predefined set of kex methods */
-int ssh_send_kex(SSH_SESSION *session, int server_kex) {
+int ssh_send_kex(ssh_session session, int server_kex) {
KEX *kex = (server_kex ? &session->server_kex : &session->client_kex);
ssh_string str = NULL;
int i;
@@ -475,7 +475,7 @@ error:
return ret;
}
-static int build_session_id1(SSH_SESSION *session, ssh_string servern,
+static int build_session_id1(ssh_session session, ssh_string servern,
ssh_string hostn) {
MD5CTX md5 = NULL;
@@ -529,7 +529,7 @@ static int modulus_smaller(ssh_public_key k1, ssh_public_key k2){
}
#define ABS(A) ( (A)<0 ? -(A):(A) )
-static ssh_string encrypt_session_key(SSH_SESSION *session, ssh_public_key srvkey,
+static ssh_string encrypt_session_key(ssh_session session, ssh_public_key srvkey,
ssh_public_key hostkey, int slen, int hlen) {
unsigned char buffer[32] = {0};
int i;
@@ -606,7 +606,7 @@ static ssh_string encrypt_session_key(SSH_SESSION *session, ssh_public_key srvke
* 32-bit int supported_authentications_mask
*/
-int ssh_get_kex1(SSH_SESSION *session) {
+int ssh_get_kex1(ssh_session session) {
ssh_string server_exp = NULL;
ssh_string server_mod = NULL;
ssh_string host_exp = NULL;
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index e2dfaf76..c292d5dd 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -577,7 +577,7 @@ error:
#ifdef HAVE_LIBCRYPTO
static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
- SSH_SESSION *session = userdata;
+ ssh_session session = userdata;
/* unused flag */
(void) rwflag;
@@ -612,7 +612,7 @@ static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
* \see privatekey_free()
* \see publickey_from_privatekey()
*/
-ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
+ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
int type, const char *passphrase) {
ssh_auth_callback auth_cb = NULL;
ssh_private_key privkey = NULL;
@@ -857,7 +857,7 @@ void privatekey_free(ssh_private_key prv) {
* \see string_free()
* \see publickey_from_privatekey()
*/
-ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
+ssh_string publickey_from_file(ssh_session session, const char *filename,
int *type) {
ssh_buffer buffer = NULL;
char buf[4096] = {0};
@@ -926,7 +926,7 @@ ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
return str;
}
-ssh_string try_publickey_from_file(SSH_SESSION *session, struct ssh_keys_struct keytab,
+ssh_string try_publickey_from_file(ssh_session session, struct ssh_keys_struct keytab,
char **privkeyfile, int *type) {
static char *home = NULL;
@@ -1063,7 +1063,7 @@ static void tokens_free(char **tokens) {
* \returns NULL if no match was found or the file was not found
* \returns found_type type of key (ie "dsa","ssh-rsa1"). Don't free that value.
*/
-static char **ssh_get_knownhost_line(SSH_SESSION *session, FILE **file,
+static char **ssh_get_knownhost_line(ssh_session session, FILE **file,
const char *filename, const char **found_type) {
char buffer[4096] = {0};
char *ptr;
@@ -1145,7 +1145,7 @@ static char **ssh_get_knownhost_line(SSH_SESSION *session, FILE **file,
* \return 0 if the key doesn't match
* \return -1 on error
*/
-static int check_public_key(SSH_SESSION *session, char **tokens) {
+static int check_public_key(ssh_session session, char **tokens) {
ssh_string pubkey = session->current_crypto->server_pubkey;
ssh_buffer pubkey_buffer;
char *pubkey_64;
@@ -1244,7 +1244,7 @@ static int check_public_key(SSH_SESSION *session, char **tokens) {
* \returns 1 if it matches
* \returns 0 otherwise
*/
-static int match_hashed_host(SSH_SESSION *session, const char *host,
+static int match_hashed_host(ssh_session session, const char *host,
const char *sourcehash) {
/* Openssh hash structure :
* |1|base64 encoded salt|base64 encoded hash
@@ -1362,7 +1362,7 @@ static int match_hashed_host(SSH_SESSION *session, const char *host,
* \bug There is no current way to remove or modify an entry into the known
* host table.
*/
-int ssh_is_server_known(SSH_SESSION *session) {
+int ssh_is_server_known(ssh_session session) {
FILE *file = NULL;
char **tokens;
char *host;
@@ -1450,7 +1450,7 @@ int ssh_is_server_known(SSH_SESSION *session) {
* \param session ssh session
* \return 0 on success, -1 on error
*/
-int ssh_write_knownhost(SSH_SESSION *session) {
+int ssh_write_knownhost(ssh_session session) {
ssh_string pubkey = session->current_crypto->server_pubkey;
unsigned char *pubkey_64;
char buffer[4096] = {0};
diff --git a/libssh/keys.c b/libssh/keys.c
index 626acc97..8df0b05d 100644
--- a/libssh/keys.c
+++ b/libssh/keys.c
@@ -67,7 +67,7 @@ int ssh_type_from_name(const char *name) {
return -1;
}
-ssh_public_key publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer) {
+ssh_public_key publickey_make_dss(ssh_session session, ssh_buffer buffer) {
ssh_string p = NULL;
ssh_string q = NULL;
ssh_string g = NULL;
@@ -153,7 +153,7 @@ error:
return NULL;
}
-ssh_public_key publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer,
+ssh_public_key publickey_make_rsa(ssh_session session, ssh_buffer buffer,
int type) {
ssh_string e = NULL;
ssh_string n = NULL;
@@ -247,7 +247,7 @@ void publickey_free(ssh_public_key key) {
SAFE_FREE(key);
}
-ssh_public_key publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s) {
+ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s) {
ssh_buffer tmpbuf = NULL;
ssh_string type_s = NULL;
char *type_c = NULL;
@@ -847,7 +847,7 @@ static ssh_string signature_to_string(SIGNATURE *sign) {
}
/* TODO : split this function in two so it becomes smaller */
-SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,
+SIGNATURE *signature_from_string(ssh_session session, ssh_string signature,
ssh_public_key pubkey, int needed_type) {
SIGNATURE *sign = NULL;
ssh_buffer tmpbuf = NULL;
@@ -1151,7 +1151,7 @@ ssh_string ssh_do_sign_with_agent(ssh_session session,
/*
* This function concats in a buffer the values needed to do a signature
* verification. */
-ssh_buffer ssh_userauth_build_digest(SSH_SESSION *session, ssh_message msg, char *service) {
+ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service) {
/*
The value of 'signature' is a signature by the corresponding private
key over the following data, in the following order:
@@ -1215,7 +1215,7 @@ error:
/*
* This function signs the session id (known as H) as a string then
* the content of sigbuf */
-ssh_string ssh_do_sign(SSH_SESSION *session, ssh_buffer sigbuf,
+ssh_string ssh_do_sign(ssh_session session, ssh_buffer sigbuf,
ssh_private_key privatekey) {
CRYPTO *crypto = session->current_crypto ? session->current_crypto :
session->next_crypto;
@@ -1314,7 +1314,7 @@ ssh_string ssh_do_sign(SSH_SESSION *session, ssh_buffer sigbuf,
return signature;
}
-ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, ssh_public_key key) {
+ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key key) {
ssh_string str = NULL;
size_t len = string_len(data);
size_t size = 0;
@@ -1380,7 +1380,7 @@ ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, ssh_public_ke
/* this function signs the session id */
-ssh_string ssh_sign_session_id(SSH_SESSION *session, ssh_private_key privatekey) {
+ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey) {
CRYPTO *crypto=session->current_crypto ? session->current_crypto :
session->next_crypto;
unsigned char hash[SHA_DIGEST_LEN + 1] = {0};
diff --git a/libssh/log.c b/libssh/log.c
index f2a4b8b9..fb2d6663 100644
--- a/libssh/log.c
+++ b/libssh/log.c
@@ -44,7 +44,7 @@
*
* @param format The format string of the log entry.
*/
-void ssh_log(SSH_SESSION *session, int verbosity, const char *format, ...) {
+void ssh_log(ssh_session session, int verbosity, const char *format, ...) {
char buffer[1024];
char indent[256];
int min;
diff --git a/libssh/messages.c b/libssh/messages.c
index a2252534..2989d0ce 100644
--- a/libssh/messages.c
+++ b/libssh/messages.c
@@ -44,7 +44,7 @@
#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));
if (msg == NULL) {
return NULL;
@@ -55,7 +55,7 @@ static SSH_MESSAGE *message_new(SSH_SESSION *session){
return msg;
}
-static SSH_MESSAGE *handle_service_request(SSH_SESSION *session) {
+static SSH_MESSAGE *handle_service_request(ssh_session session) {
ssh_string service = NULL;
char *service_c = NULL;
SSH_MESSAGE *msg=NULL;
@@ -86,7 +86,7 @@ static SSH_MESSAGE *handle_service_request(SSH_SESSION *session) {
return msg;
}
-static int handle_unimplemented(SSH_SESSION *session) {
+static int handle_unimplemented(ssh_session session) {
if (buffer_add_u32(session->out_buffer, htonl(session->recv_seq - 1)) < 0) {
return -1;
}
@@ -98,7 +98,7 @@ static int handle_unimplemented(SSH_SESSION *session) {
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 service = NULL;
ssh_string method = NULL;
@@ -264,7 +264,7 @@ error:
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_string type = NULL, originator = NULL, destination = NULL;
char *type_c = NULL;
@@ -414,7 +414,7 @@ error:
}
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;
enter_function();
@@ -470,7 +470,7 @@ error:
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_string type = NULL;
char *type_c = NULL;
@@ -693,7 +693,7 @@ int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg) {
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;
enter_function();
switch(packettype) {
@@ -722,7 +722,7 @@ SSH_MESSAGE *ssh_message_retrieve(SSH_SESSION *session, uint32_t packettype){
/* \brief blocking message retrieval
* \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;
enter_function();
do {
@@ -799,7 +799,7 @@ void ssh_message_free(SSH_MESSAGE *msg){
* \param type packet type
* \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);
if(msg){
if(!session->ssh_message_list){
diff --git a/libssh/packet.c b/libssh/packet.c
index 0952f341..d52c5420 100644
--- a/libssh/packet.c
+++ b/libssh/packet.c
@@ -47,7 +47,7 @@ static int macsize=SHA_DIGEST_LEN;
#define PACKET_STATE_INIT 0
#define PACKET_STATE_SIZEREAD 1
-static int packet_read2(SSH_SESSION *session) {
+static int packet_read2(ssh_session session) {
unsigned int blocksize = (session->current_crypto ?
session->current_crypto->in_cipher->blocksize : 8);
int current_macsize = session->current_crypto ? macsize : 0;
@@ -215,7 +215,7 @@ error:
#ifdef WITH_SSH1
/* a slighty modified packet_read2() for SSH-1 protocol */
-static int packet_read1(SSH_SESSION *session) {
+static int packet_read1(ssh_session session) {
void *packet = NULL;
int rc = SSH_ERROR;
int to_be_read;
@@ -365,7 +365,7 @@ error:
#endif /* WITH_SSH1 */
/* that's where i'd like C to be object ... */
-int packet_read(SSH_SESSION *session) {
+int packet_read(ssh_session session) {
#ifdef WITH_SSH1
if (session->version == 1) {
return packet_read1(session);
@@ -374,7 +374,7 @@ int packet_read(SSH_SESSION *session) {
return packet_read2(session);
}
-int packet_translate(SSH_SESSION *session) {
+int packet_translate(ssh_session session) {
enter_function();
memset(&session->in_packet, 0, sizeof(PACKET));
@@ -405,7 +405,7 @@ int packet_translate(SSH_SESSION *session) {
* Return SSH_OK if everything has been sent, SSH_AGAIN if there are still
* things to send on buffer, SSH_ERROR if there is an error.
*/
-int packet_flush(SSH_SESSION *session, int enforce_blocking) {
+int packet_flush(ssh_session session, int enforce_blocking) {
if (enforce_blocking || session->blocking) {
return ssh_socket_blocking_flush(session->socket);
}
@@ -417,7 +417,7 @@ int packet_flush(SSH_SESSION *session, int enforce_blocking) {
* This function places the outgoing packet buffer into an outgoing
* socket buffer
*/
-static int packet_write(SSH_SESSION *session) {
+static int packet_write(ssh_session session) {
int rc = SSH_ERROR;
enter_function();
@@ -432,7 +432,7 @@ static int packet_write(SSH_SESSION *session) {
return rc;
}
-static int packet_send2(SSH_SESSION *session) {
+static int packet_send2(ssh_session session) {
unsigned int blocksize = (session->current_crypto ?
session->current_crypto->out_cipher->blocksize : 8);
uint32_t currentlen = buffer_get_len(session->out_buffer);
@@ -502,7 +502,7 @@ error:
}
#ifdef WITH_SSH1
-static int packet_send1(SSH_SESSION *session) {
+static int packet_send1(ssh_session session) {
unsigned int blocksize = (session->current_crypto ?
session->current_crypto->out_cipher->blocksize : 8);
uint32_t currentlen = buffer_get_len(session->out_buffer) + sizeof(uint32_t);
@@ -581,7 +581,7 @@ error:
#endif /* WITH_SSH1 */
-int packet_send(SSH_SESSION *session) {
+int packet_send(ssh_session session) {
#ifdef WITH_SSH1
if (session->version == 1) {
return packet_send1(session);
@@ -590,7 +590,7 @@ int packet_send(SSH_SESSION *session) {
return packet_send2(session);
}
-void packet_parse(SSH_SESSION *session) {
+void packet_parse(ssh_session session) {
ssh_string error_s = NULL;
char *error = NULL;
uint32_t type = session->in_packet.type;
@@ -669,7 +669,7 @@ void packet_parse(SSH_SESSION *session) {
}
#ifdef WITH_SSH1
-static int packet_wait1(SSH_SESSION *session, int type, int blocking) {
+static int packet_wait1(ssh_session session, int type, int blocking) {
enter_function();
@@ -726,7 +726,7 @@ static int packet_wait1(SSH_SESSION *session, int type, int blocking) {
}
#endif /* WITH_SSH1 */
-static int packet_wait2(SSH_SESSION *session, int type, int blocking) {
+static int packet_wait2(ssh_session session, int type, int blocking) {
int rc = SSH_ERROR;
enter_function();
@@ -781,7 +781,7 @@ static int packet_wait2(SSH_SESSION *session, int type, int blocking) {
return SSH_OK;
}
-int packet_wait(SSH_SESSION *session, int type, int block) {
+int packet_wait(ssh_session session, int type, int block) {
#ifdef WITH_SSH1
if (session->version == 1) {
return packet_wait1(session, type, block);
diff --git a/libssh/server.c b/libssh/server.c
index 84cd3e74..a116836c 100644
--- a/libssh/server.c
+++ b/libssh/server.c
@@ -176,8 +176,8 @@ void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind) {
ssh_bind->toaccept = 1;
}
-SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind) {
- SSH_SESSION *session;
+ssh_session ssh_bind_accept(SSH_BIND *ssh_bind) {
+ ssh_session session;
ssh_private_key dsa = NULL;
ssh_private_key rsa = NULL;
int fd = -1;
@@ -269,7 +269,7 @@ void ssh_bind_free(SSH_BIND *ssh_bind){
extern char *supported_methods[];
-static int server_set_kex(SSH_SESSION * session) {
+static int server_set_kex(ssh_session session) {
KEX *server = &session->server_kex;
SSH_OPTIONS *options = session->options;
int i, j;
@@ -323,7 +323,7 @@ static int server_set_kex(SSH_SESSION * session) {
return 0;
}
-static int dh_handshake_server(SSH_SESSION *session) {
+static int dh_handshake_server(ssh_session session) {
ssh_string e;
ssh_string f;
ssh_string pubkey;
@@ -473,7 +473,7 @@ static int dh_handshake_server(SSH_SESSION *session) {
}
/* Do the banner and key exchange */
-int ssh_accept(SSH_SESSION *session) {
+int ssh_accept(ssh_session session) {
if (ssh_send_banner(session, 1) < 0) {
return -1;
}
@@ -529,7 +529,7 @@ int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len) {
/* messages */
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};
ssh_string methods = NULL;
int rc = SSH_ERROR;
@@ -650,7 +650,7 @@ static int ssh_message_service_request_reply_default(SSH_MESSAGE *msg) {
int ssh_message_service_reply_success(SSH_MESSAGE *msg) {
struct ssh_string_struct *service;
- SSH_SESSION *session=msg->session;
+ ssh_session session=msg->session;
if (msg == NULL) {
return SSH_ERROR;
}
@@ -828,12 +828,12 @@ char *ssh_message_channel_request_subsystem(SSH_MESSAGE *msg){
* 0 if the message has been parsed and treated sucessfuly, 1 otherwise (libssh
* must take care of the response).
*/
-void ssh_set_message_callback(SSH_SESSION *session,
+void ssh_set_message_callback(ssh_session session,
int(*ssh_message_callback)(ssh_session session, ssh_message msg)){
session->ssh_message_callback=ssh_message_callback;
}
-int ssh_execute_message_callbacks(SSH_SESSION *session){
+int ssh_execute_message_callbacks(ssh_session session){
SSH_MESSAGE *msg=NULL;
int ret;
if(!session->ssh_message_list)
diff --git a/libssh/session.c b/libssh/session.c
index 38e1b114..c412038b 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -38,15 +38,14 @@
/** \brief creates a new ssh session
* \returns new ssh_session pointer
*/
-SSH_SESSION *ssh_new(void) {
- SSH_SESSION *session;
+ssh_session ssh_new(void) {
+ ssh_session session;
- session = malloc(sizeof (SSH_SESSION));
+ session = malloc(sizeof (struct ssh_session_struct));
if (session == NULL) {
return NULL;
}
-
- memset(session, 0, sizeof(SSH_SESSION));
+ ZERO_STRUCTP(session);
session->next_crypto = crypto_new();
if (session->next_crypto == NULL) {
@@ -87,7 +86,7 @@ err:
return NULL;
}
-void ssh_cleanup(SSH_SESSION *session) {
+void ssh_cleanup(ssh_session session) {
int i;
enter_function();
@@ -138,8 +137,7 @@ void ssh_cleanup(SSH_SESSION *session) {
ssh_options_free(session->options);
/* burn connection, it could hang sensitive datas */
- memset(session,'X',sizeof(SSH_SESSION));
-
+ ZERO_STRUCTP(session);
SAFE_FREE(session);
/* FIXME: leave_function(); ??? */
}
@@ -147,7 +145,7 @@ void ssh_cleanup(SSH_SESSION *session) {
/** \brief disconnect impolitely from remote host
* \param session current ssh session
*/
-void ssh_silent_disconnect(SSH_SESSION *session) {
+void ssh_silent_disconnect(ssh_session session) {
enter_function();
if (session == NULL) {
@@ -166,7 +164,7 @@ void ssh_silent_disconnect(SSH_SESSION *session) {
* \see ssh_new()
* \see ssh_options_new()
*/
-void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options) {
+void ssh_set_options(ssh_session session, SSH_OPTIONS *options) {
if (session == NULL || options == NULL) {
return;
}
@@ -180,7 +178,7 @@ void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options) {
* \param blocking zero for nonblocking mode
* \bug nonblocking code is in development and won't work as expected
*/
-void ssh_set_blocking(SSH_SESSION *session, int blocking) {
+void ssh_set_blocking(ssh_session session, int blocking) {
if (session == NULL) {
return;
}
@@ -195,7 +193,7 @@ void ssh_set_blocking(SSH_SESSION *session, int blocking) {
* \return file descriptor of the connection, or -1 if it is
* not connected
*/
-socket_t ssh_get_fd(SSH_SESSION *session) {
+socket_t ssh_get_fd(ssh_session session) {
if (session == NULL) {
return -1;
}
@@ -206,7 +204,7 @@ socket_t ssh_get_fd(SSH_SESSION *session) {
/** \brief say to the session it has data to read on the file descriptor without blocking
* \param session ssh session
*/
-void ssh_set_fd_toread(SSH_SESSION *session) {
+void ssh_set_fd_toread(ssh_session session) {
if (session == NULL) {
return;
}
@@ -217,7 +215,7 @@ void ssh_set_fd_toread(SSH_SESSION *session) {
/** \brief say the session it may write to the file descriptor without blocking
* \param session ssh session
*/
-void ssh_set_fd_towrite(SSH_SESSION *session) {
+void ssh_set_fd_towrite(ssh_session session) {
if (session == NULL) {
return;
}
@@ -228,7 +226,7 @@ void ssh_set_fd_towrite(SSH_SESSION *session) {
/** \brief say the session it has an exception to catch on the file descriptor
* \param session ssh session
*/
-void ssh_set_fd_except(SSH_SESSION *session) {
+void ssh_set_fd_except(ssh_session session) {
if (session == NULL) {
return;
}
@@ -239,7 +237,7 @@ void ssh_set_fd_except(SSH_SESSION *session) {
/** \warning I don't remember if this should be internal or not
*/
/* looks if there is data to read on the socket and parse it. */
-int ssh_handle_packets(SSH_SESSION *session) {
+int ssh_handle_packets(ssh_session session) {
int w = 0;
int e = 0;
int rc = -1;
@@ -277,7 +275,7 @@ int ssh_handle_packets(SSH_SESSION *session) {
* which respectively means the session is closed, has data to read on
* the connection socket and session was closed due to an error.
*/
-int ssh_get_status(SSH_SESSION *session) {
+int ssh_get_status(ssh_session session) {
int socketstate;
int r = 0;
@@ -305,7 +303,7 @@ int ssh_get_status(SSH_SESSION *session) {
* \return message sent by the server along with the disconnect, or NULL in which case the reason of the disconnect may be found with ssh_get_error.
* \see ssh_get_error()
*/
-const char *ssh_get_disconnect_message(SSH_SESSION *session) {
+const char *ssh_get_disconnect_message(ssh_session session) {
if (session == NULL) {
return NULL;
}
@@ -333,7 +331,7 @@ const char *ssh_get_disconnect_message(SSH_SESSION *session) {
*
* @return 1 or 2, for ssh1 or ssh2, < 0 on error.
*/
-int ssh_get_version(SSH_SESSION *session) {
+int ssh_get_version(ssh_session session) {
if (session == NULL) {
return -1;
}
diff --git a/libssh/sftp.c b/libssh/sftp.c
index 49eb565c..668ad6e2 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -95,7 +95,7 @@ static void sftp_ext_free(sftp_ext ext) {
SAFE_FREE(ext);
}
-SFTP_SESSION *sftp_new(SSH_SESSION *session){
+SFTP_SESSION *sftp_new(ssh_session session){
SFTP_SESSION *sftp;
enter_function();
@@ -145,7 +145,7 @@ SFTP_SESSION *sftp_new(SSH_SESSION *session){
}
#ifdef WITH_SERVER
-SFTP_SESSION *sftp_server_new(SSH_SESSION *session, ssh_channel chan){
+SFTP_SESSION *sftp_server_new(ssh_session session, ssh_channel chan){
SFTP_SESSION *sftp = NULL;
sftp = malloc(sizeof(SFTP_SESSION));
diff --git a/libssh/socket.c b/libssh/socket.c
index 1c332625..2011b48c 100644
--- a/libssh/socket.c
+++ b/libssh/socket.c
@@ -49,7 +49,7 @@ struct socket {
int data_except;
ssh_buffer out_buffer;
ssh_buffer in_buffer;
- SSH_SESSION *session;
+ ssh_session session;
};
/*
@@ -71,7 +71,7 @@ int ssh_socket_init(void) {
* \internal
* \brief creates a new Socket object
*/
-struct socket *ssh_socket_new(SSH_SESSION *session) {
+struct socket *ssh_socket_new(ssh_session session) {
struct socket *s;
s = malloc(sizeof(struct socket));
@@ -285,7 +285,7 @@ int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len) {
* \brief Blocking write of len bytes
*/
int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len) {
- SSH_SESSION *session = s->session;
+ ssh_session session = s->session;
int written = -1;
enter_function();
@@ -315,7 +315,7 @@ int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len)
* \returns SSH_AGAIN in nonblocking mode
*/
int ssh_socket_read(struct socket *s, void *buffer, int len){
- SSH_SESSION *session = s->session;
+ ssh_session session = s->session;
int rc = SSH_ERROR;
enter_function();
@@ -340,7 +340,7 @@ int ssh_socket_read(struct socket *s, void *buffer, int len){
* \warning has no effect on socket before a flush
*/
int ssh_socket_write(struct socket *s, const void *buffer, int len) {
- SSH_SESSION *session = s->session;
+ ssh_session session = s->session;
int rc = SSH_ERROR;
enter_function();
@@ -369,7 +369,7 @@ int ssh_socket_write(struct socket *s, const void *buffer, int len) {
* \returns SSH_AGAIN need to call later for data
* \returns SSH_ERROR error happened
*/
-int ssh_socket_wait_for_data(struct socket *s, SSH_SESSION *session, uint32_t len) {
+int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len) {
char buffer[4096] = {0};
char *buf = NULL;
int except;
@@ -457,7 +457,7 @@ int ssh_socket_wait_for_data(struct socket *s, SSH_SESSION *session, uint32_t le
/* ssh_socket_poll */
int ssh_socket_poll(struct socket *s, int *writeable, int *except) {
- SSH_SESSION *session = s->session;
+ ssh_session session = s->session;
ssh_pollfd_t fd[1];
int rc = -1;
@@ -508,7 +508,7 @@ int ssh_socket_poll(struct socket *s, int *writeable, int *except) {
* \brief nonblocking flush of the output buffer
*/
int ssh_socket_nonblocking_flush(struct socket *s) {
- SSH_SESSION *session = s->session;
+ ssh_session session = s->session;
int except;
int can_write;
int w;
@@ -577,7 +577,7 @@ int ssh_socket_nonblocking_flush(struct socket *s) {
* \brief locking flush of the output packet buffer
*/
int ssh_socket_blocking_flush(struct socket *s) {
- SSH_SESSION *session = s->session;
+ ssh_session session = s->session;
enter_function();
diff --git a/libssh/wrapper.c b/libssh/wrapper.c
index 99815497..4110c4ec 100644
--- a/libssh/wrapper.c
+++ b/libssh/wrapper.c
@@ -803,7 +803,7 @@ void crypto_free(CRYPTO *crypto){
SAFE_FREE(crypto);
}
-static int crypt_set_algorithms2(SSH_SESSION *session){
+static int crypt_set_algorithms2(ssh_session session){
const char *wanted;
int i = 0;
@@ -860,7 +860,7 @@ static int crypt_set_algorithms2(SSH_SESSION *session){
return SSH_OK;
}
-static int crypt_set_algorithms1(SSH_SESSION *session) {
+static int crypt_set_algorithms1(ssh_session session) {
int i = 0;
/* right now, we force 3des-cbc to be taken */
@@ -889,13 +889,13 @@ static int crypt_set_algorithms1(SSH_SESSION *session) {
return SSH_OK;
}
-int crypt_set_algorithms(SSH_SESSION *session) {
+int crypt_set_algorithms(ssh_session session) {
return (session->version == 1) ? crypt_set_algorithms1(session) :
crypt_set_algorithms2(session);
}
// TODO Obviously too much cut and paste here
-int crypt_set_algorithms_server(SSH_SESSION *session){
+int crypt_set_algorithms_server(ssh_session session){
char *server = NULL;
char *client = NULL;
char *match = NULL;
diff --git a/sample.c b/sample.c
index dade687c..e63cf1b3 100644
--- a/sample.c
+++ b/sample.c
@@ -39,7 +39,7 @@ char *user;
int sftp;
char *cmds[MAXCMD];
struct termios terminal;
-void do_sftp(SSH_SESSION *session);
+void do_sftp(ssh_session session);
static void add_cmd(char *cmd){
int n;
@@ -130,7 +130,7 @@ static void sizechanged(void){
// printf("Changed pty size\n");
setsignal();
}
-static void select_loop(SSH_SESSION *session,ssh_channel channel){
+static void select_loop(ssh_session session,ssh_channel channel){
fd_set fds;
struct timeval timeout;
char buffer[10];
@@ -229,7 +229,7 @@ static void select_loop(SSH_SESSION *session,ssh_channel channel){
}
-static void shell(SSH_SESSION *session){
+static void shell(ssh_session session){
ssh_channel channel;
struct termios terminal_local;
int interactive=isatty(0);
@@ -260,7 +260,7 @@ static void shell(SSH_SESSION *session){
select_loop(session,channel);
}
-static void batch_shell(SSH_SESSION *session){
+static void batch_shell(ssh_session session){
ssh_channel channel;
char buffer[1024];
int i,s=0;
@@ -277,7 +277,7 @@ static void batch_shell(SSH_SESSION *session){
#ifdef WITH_SFTP
/* it's just a proof of concept code for sftp, till i write a real documentation about it */
-void do_sftp(SSH_SESSION *session){
+void do_sftp(ssh_session session){
SFTP_SESSION *sftp_session=sftp_new(session);
SFTP_DIR *dir;
SFTP_ATTRIBUTES *file;
@@ -461,7 +461,7 @@ void do_sftp(SSH_SESSION *session){
}
#endif
-static int auth_kbdint(SSH_SESSION *session){
+static int auth_kbdint(ssh_session session){
int err=ssh_userauth_kbdint(session,NULL,NULL);
const char *name, *instruction, *prompt;
char *ptr;
@@ -501,7 +501,7 @@ static int auth_kbdint(SSH_SESSION *session){
}
int main(int argc, char **argv){
- SSH_SESSION *session;
+ ssh_session session;
SSH_OPTIONS *options;
int auth=0;
char *password;
diff --git a/samplesshd.c b/samplesshd.c
index a3d688ea..6fd97a83 100644
--- a/samplesshd.c
+++ b/samplesshd.c
@@ -41,7 +41,7 @@ static int auth_password(char *user, char *password){
int main(int argc, char **argv){
SSH_OPTIONS *options=ssh_options_new();
- SSH_SESSION *session;
+ ssh_session session;
SSH_BIND *ssh_bind;
SSH_MESSAGE *message;
ssh_channel chan=0;