1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

Changed all occurences of BUFFER * to ssh_buffer

This commit is contained in:
Aris Adamantiadis
2009-07-24 21:56:11 +02:00
parent fb5769b4be
commit 91d0660cc3
15 changed files with 131 additions and 131 deletions

View File

@@ -73,8 +73,8 @@ extern "C" {
#ifdef SSH_SAFE_NAMESPACE #ifdef SSH_SAFE_NAMESPACE
typedef struct ssh_string_struct STRING; typedef struct ssh_string_struct STRING;
#endif
typedef struct ssh_buffer_struct BUFFER; typedef struct ssh_buffer_struct BUFFER;
#endif
typedef struct ssh_public_key_struct PUBLIC_KEY; typedef struct ssh_public_key_struct PUBLIC_KEY;
typedef struct ssh_private_key_struct PRIVATE_KEY; typedef struct ssh_private_key_struct PRIVATE_KEY;
typedef struct ssh_channel_struct CHANNEL; typedef struct ssh_channel_struct CHANNEL;
@@ -294,7 +294,7 @@ int channel_write(CHANNEL *channel, const void *data, u32 len);
int channel_send_eof(CHANNEL *channel); int channel_send_eof(CHANNEL *channel);
int channel_is_eof(CHANNEL *channel); int channel_is_eof(CHANNEL *channel);
int channel_read(CHANNEL *channel, void *dest, u32 count, int is_stderr); int channel_read(CHANNEL *channel, void *dest, u32 count, int is_stderr);
int channel_read_buffer(CHANNEL *channel, BUFFER *buffer, u32 count, int channel_read_buffer(CHANNEL *channel, ssh_buffer buffer, u32 count,
int is_stderr); int is_stderr);
int channel_poll(CHANNEL *channel, int is_stderr); int channel_poll(CHANNEL *channel, int is_stderr);
int channel_close(CHANNEL *channel); int channel_close(CHANNEL *channel);
@@ -357,12 +357,12 @@ int ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
/** creates a new buffer /** creates a new buffer
*/ */
BUFFER *buffer_new(void); ssh_buffer buffer_new(void);
void buffer_free(BUFFER *buffer); void buffer_free(ssh_buffer buffer);
/* buffer_get returns a pointer to the begining of the buffer. no position is taken into account */ /* buffer_get returns a pointer to the begining of the buffer. no position is taken into account */
void *buffer_get(BUFFER *buffer); void *buffer_get(ssh_buffer buffer);
/* same here */ /* same here */
u32 buffer_get_len(BUFFER *buffer); u32 buffer_get_len(ssh_buffer buffer);
/* in auth.c */ /* in auth.c */

View File

@@ -310,8 +310,8 @@ struct ssh_channel_struct {
u32 remote_maxpacket; u32 remote_maxpacket;
int open; /* shows if the channel is still opened */ int open; /* shows if the channel is still opened */
int delayed_close; int delayed_close;
BUFFER *stdout_buffer; ssh_buffer stdout_buffer;
BUFFER *stderr_buffer; ssh_buffer stderr_buffer;
void *userarg; void *userarg;
int version; int version;
int blocking; int blocking;
@@ -320,7 +320,7 @@ struct ssh_channel_struct {
struct ssh_agent_struct { struct ssh_agent_struct {
struct socket *sock; struct socket *sock;
BUFFER *ident; ssh_buffer ident;
unsigned int count; unsigned int count;
}; };
@@ -361,9 +361,9 @@ struct ssh_session {
remote host. */ remote host. */
char *discon_msg; /* disconnect message from char *discon_msg; /* disconnect message from
the remote host */ the remote host */
BUFFER *in_buffer; ssh_buffer in_buffer;
PACKET in_packet; PACKET in_packet;
BUFFER *out_buffer; ssh_buffer out_buffer;
/* the states are used by the nonblocking stuff to remember */ /* the states are used by the nonblocking stuff to remember */
/* where it was before being interrupted */ /* where it was before being interrupted */
@@ -373,8 +373,8 @@ struct ssh_session {
KEX server_kex; KEX server_kex;
KEX client_kex; KEX client_kex;
BUFFER *in_hashbuf; ssh_buffer in_hashbuf;
BUFFER *out_hashbuf; ssh_buffer out_hashbuf;
CRYPTO *current_crypto; CRYPTO *current_crypto;
CRYPTO *next_crypto; /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */ CRYPTO *next_crypto; /* next_crypto is going to be used after a SSH2_MSG_NEWKEYS */
@@ -618,7 +618,7 @@ u32 packet_decrypt_len(SSH_SESSION *session,char *crypted);
int packet_decrypt(SSH_SESSION *session, void *packet,unsigned int len); int packet_decrypt(SSH_SESSION *session, void *packet,unsigned int len);
unsigned char *packet_encrypt(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*/ /* it returns the hmac buffer if exists*/
int packet_hmac_verify(SSH_SESSION *session,BUFFER *buffer,unsigned char *mac); int packet_hmac_verify(SSH_SESSION *session,ssh_buffer buffer,unsigned char *mac);
/* in packet.c */ /* in packet.c */
@@ -660,19 +660,19 @@ ssh_string try_publickey_from_file(SSH_SESSION *session,
const char *ssh_type_to_char(int type); const char *ssh_type_to_char(int type);
int ssh_type_from_name(const char *name); int ssh_type_from_name(const char *name);
PRIVATE_KEY *privatekey_make_dss(SSH_SESSION *session, BUFFER *buffer); PRIVATE_KEY *privatekey_make_dss(SSH_SESSION *session, ssh_buffer buffer);
PRIVATE_KEY *privatekey_make_rsa(SSH_SESSION *session, BUFFER *buffer, PRIVATE_KEY *privatekey_make_rsa(SSH_SESSION *session, ssh_buffer buffer,
const char *type); const char *type);
PRIVATE_KEY *privatekey_from_string(SSH_SESSION *session, ssh_string privkey_s); PRIVATE_KEY *privatekey_from_string(SSH_SESSION *session, ssh_string privkey_s);
PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, BUFFER *buffer); PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer);
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer, int type); PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer, int type);
PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s); PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s);
SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,PUBLIC_KEY *pubkey,int needed_type); SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,PUBLIC_KEY *pubkey,int needed_type);
void signature_free(SIGNATURE *sign); void signature_free(SIGNATURE *sign);
ssh_string ssh_do_sign_with_agent(struct ssh_session *session, ssh_string ssh_do_sign_with_agent(struct ssh_session *session,
struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey); struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey);
ssh_string ssh_do_sign(SSH_SESSION *session,BUFFER *sigbuf, ssh_string ssh_do_sign(SSH_SESSION *session,ssh_buffer sigbuf,
PRIVATE_KEY *privatekey); PRIVATE_KEY *privatekey);
ssh_string ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey); ssh_string ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);
ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, PUBLIC_KEY *key); ssh_string ssh_encrypt_rsa1(SSH_SESSION *session, ssh_string data, PUBLIC_KEY *key);
@@ -692,41 +692,41 @@ int ssh_options_default_ssh_dir(SSH_OPTIONS *opt);
int ssh_options_default_known_hosts_file(SSH_OPTIONS *opt); int ssh_options_default_known_hosts_file(SSH_OPTIONS *opt);
/* buffer.c */ /* buffer.c */
int buffer_add_ssh_string(BUFFER *buffer, ssh_string string); int buffer_add_ssh_string(ssh_buffer buffer, ssh_string string);
int buffer_add_u8(BUFFER *buffer, u8 data); int buffer_add_u8(ssh_buffer buffer, u8 data);
int buffer_add_u32(BUFFER *buffer, u32 data); int buffer_add_u32(ssh_buffer buffer, u32 data);
int buffer_add_u64(BUFFER *buffer, u64 data); int buffer_add_u64(ssh_buffer buffer, u64 data);
int buffer_add_data(BUFFER *buffer, const void *data, u32 len); int buffer_add_data(ssh_buffer buffer, const void *data, u32 len);
int buffer_prepend_data(BUFFER *buffer, const void *data, u32 len); int buffer_prepend_data(ssh_buffer buffer, const void *data, u32 len);
int buffer_add_buffer(BUFFER *buffer, BUFFER *source); int buffer_add_buffer(ssh_buffer buffer, ssh_buffer source);
int buffer_reinit(BUFFER *buffer); int buffer_reinit(ssh_buffer buffer);
/* buffer_get_rest returns a pointer to the current position into the buffer */ /* buffer_get_rest returns a pointer to the current position into the buffer */
void *buffer_get_rest(BUFFER *buffer); void *buffer_get_rest(ssh_buffer buffer);
/* buffer_get_rest_len returns the number of bytes which can be read */ /* buffer_get_rest_len returns the number of bytes which can be read */
u32 buffer_get_rest_len(BUFFER *buffer); u32 buffer_get_rest_len(ssh_buffer buffer);
/* buffer_read_*() returns the number of bytes read, except for ssh strings */ /* buffer_read_*() returns the number of bytes read, except for ssh strings */
int buffer_get_u8(BUFFER *buffer, u8 *data); int buffer_get_u8(ssh_buffer buffer, u8 *data);
int buffer_get_u32(BUFFER *buffer, u32 *data); int buffer_get_u32(ssh_buffer buffer, u32 *data);
int buffer_get_u64(BUFFER *buffer, u64 *data); int buffer_get_u64(ssh_buffer buffer, u64 *data);
u32 buffer_get_data(BUFFER *buffer, void *data, u32 requestedlen); u32 buffer_get_data(ssh_buffer buffer, void *data, u32 requestedlen);
/* buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */ /* buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */
ssh_string buffer_get_ssh_string(BUFFER *buffer); ssh_string buffer_get_ssh_string(ssh_buffer buffer);
/* gets a string out of a SSH-1 mpint */ /* gets a string out of a SSH-1 mpint */
ssh_string buffer_get_mpint(BUFFER *buffer); ssh_string buffer_get_mpint(ssh_buffer buffer);
/* buffer_pass_bytes acts as if len bytes have been read (used for padding) */ /* buffer_pass_bytes acts as if len bytes have been read (used for padding) */
u32 buffer_pass_bytes_end(BUFFER *buffer, u32 len); u32 buffer_pass_bytes_end(ssh_buffer buffer, u32 len);
u32 buffer_pass_bytes(BUFFER *buffer, u32 len); u32 buffer_pass_bytes(ssh_buffer buffer, u32 len);
/* in base64.c */ /* in base64.c */
BUFFER *base64_to_bin(const char *source); ssh_buffer base64_to_bin(const char *source);
unsigned char *bin_to_base64(const unsigned char *source, int len); unsigned char *bin_to_base64(const unsigned char *source, int len);
/* gzip.c */ /* gzip.c */
int compress_buffer(SSH_SESSION *session,BUFFER *buf); int compress_buffer(SSH_SESSION *session,ssh_buffer buf);
int decompress_buffer(SSH_SESSION *session,BUFFER *buf); int decompress_buffer(SSH_SESSION *session,ssh_buffer buf);
/* wrapper.c */ /* wrapper.c */
int crypt_set_algorithms(SSH_SESSION *); int crypt_set_algorithms(SSH_SESSION *);

View File

@@ -73,7 +73,7 @@ typedef struct sftp_session_struct {
typedef struct { typedef struct {
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
u8 type; u8 type;
BUFFER *payload; ssh_buffer payload;
} SFTP_PACKET; } SFTP_PACKET;
/* file handler */ /* file handler */
@@ -90,7 +90,7 @@ typedef struct sftp_dir {
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
char *name; char *name;
ssh_string handle; /* handle to directory */ ssh_string handle; /* handle to directory */
BUFFER *buffer; /* contains raw attributes from server which haven't been parsed */ ssh_buffer buffer; /* contains raw attributes from server which haven't been parsed */
u32 count; /* counts the number of following attributes structures into buffer */ u32 count; /* counts the number of following attributes structures into buffer */
int eof; /* end of directory listing */ int eof; /* end of directory listing */
} SFTP_DIR; } SFTP_DIR;
@@ -98,7 +98,7 @@ typedef struct sftp_dir {
typedef struct { typedef struct {
SFTP_SESSION *sftp; SFTP_SESSION *sftp;
u8 packet_type; u8 packet_type;
BUFFER *payload; ssh_buffer payload;
u32 id; u32 id;
} SFTP_MESSAGE; } SFTP_MESSAGE;
@@ -114,7 +114,7 @@ typedef struct sftp_client_message{
u64 offset; u64 offset;
u32 len; u32 len;
int attr_num; int attr_num;
BUFFER *attrbuf; /* used by sftp_reply_attrs */ ssh_buffer attrbuf; /* used by sftp_reply_attrs */
ssh_string data; /* can be newpath of rename() */ ssh_string data; /* can be newpath of rename() */
} SFTP_CLIENT_MESSAGE; } SFTP_CLIENT_MESSAGE;
@@ -637,10 +637,10 @@ int sftp_server_init(SFTP_SESSION *sftp);
/* this is not a public interface */ /* this is not a public interface */
#define SFTP_HANDLES 256 #define SFTP_HANDLES 256
SFTP_PACKET *sftp_packet_read(SFTP_SESSION *sftp); SFTP_PACKET *sftp_packet_read(SFTP_SESSION *sftp);
int sftp_packet_write(SFTP_SESSION *sftp,u8 type, BUFFER *payload); int sftp_packet_write(SFTP_SESSION *sftp,u8 type, ssh_buffer payload);
void sftp_packet_free(SFTP_PACKET *packet); void sftp_packet_free(SFTP_PACKET *packet);
int buffer_add_attributes(BUFFER *buffer, SFTP_ATTRIBUTES *attr); int buffer_add_attributes(ssh_buffer buffer, SFTP_ATTRIBUTES *attr);
SFTP_ATTRIBUTES *sftp_parse_attr(SFTP_SESSION *session, BUFFER *buf,int expectname); SFTP_ATTRIBUTES *sftp_parse_attr(SFTP_SESSION *session, ssh_buffer buf,int expectname);
/* sftpserver.c */ /* sftpserver.c */
SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp); SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp);

View File

@@ -263,8 +263,8 @@ static int agent_talk(struct ssh_session *session,
} }
int agent_get_ident_count(struct ssh_session *session) { int agent_get_ident_count(struct ssh_session *session) {
BUFFER *request = NULL; ssh_buffer request = NULL;
BUFFER *reply = NULL; ssh_buffer reply = NULL;
unsigned int type = 0; unsigned int type = 0;
unsigned int c1 = 0, c2 = 0; unsigned int c1 = 0, c2 = 0;
u8 buf[4] = {0}; u8 buf[4] = {0};

View File

@@ -55,8 +55,8 @@ static int get_equals(char *string);
* @returns A buffer containing the decoded string, NULL if something went * @returns A buffer containing the decoded string, NULL if something went
* wrong (e.g. incorrect char). * wrong (e.g. incorrect char).
*/ */
BUFFER *base64_to_bin(const char *source) { ssh_buffer base64_to_bin(const char *source) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
unsigned char block[3]; unsigned char block[3];
char *base64; char *base64;
char *ptr; char *ptr;

View File

@@ -107,7 +107,7 @@ u32 ssh_channel_new_id(SSH_SESSION *session) {
} }
static int channel_open(CHANNEL *channel, const char *type_c, int window, static int channel_open(CHANNEL *channel, const char *type_c, int window,
int maxpacket, BUFFER *payload) { int maxpacket, ssh_buffer payload) {
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
ssh_string type = NULL; ssh_string type = NULL;
u32 tmp = 0; u32 tmp = 0;
@@ -673,7 +673,7 @@ int channel_open_session(CHANNEL *channel) {
int channel_open_forward(CHANNEL *channel, const char *remotehost, int channel_open_forward(CHANNEL *channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport) { int remoteport, const char *sourcehost, int localport) {
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
BUFFER *payload = NULL; ssh_buffer payload = NULL;
ssh_string str = NULL; ssh_string str = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
@@ -1005,7 +1005,7 @@ void channel_set_blocking(CHANNEL *channel, int blocking) {
} }
static int channel_request(CHANNEL *channel, const char *request, static int channel_request(CHANNEL *channel, const char *request,
BUFFER *buffer, int reply) { ssh_buffer buffer, int reply) {
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
ssh_string req = NULL; ssh_string req = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
@@ -1086,7 +1086,7 @@ int channel_request_pty_size(CHANNEL *channel, const char *terminal,
int col, int row) { int col, int row) {
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
ssh_string term = NULL; ssh_string term = NULL;
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
enter_function(); enter_function();
@@ -1154,7 +1154,7 @@ int channel_request_pty(CHANNEL *channel) {
*/ */
int channel_change_pty_size(CHANNEL *channel, int cols, int rows) { int channel_change_pty_size(CHANNEL *channel, int cols, int rows) {
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
enter_function(); enter_function();
@@ -1215,7 +1215,7 @@ int channel_request_shell(CHANNEL *channel) {
* @warning You normally don't have to call it for sftp, see sftp_new(). * @warning You normally don't have to call it for sftp, see sftp_new().
*/ */
int channel_request_subsystem(CHANNEL *channel, const char *sys) { int channel_request_subsystem(CHANNEL *channel, const char *sys) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
ssh_string subsystem = NULL; ssh_string subsystem = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
@@ -1259,7 +1259,7 @@ int channel_request_sftp( CHANNEL *channel){
* @warning Some environement variables may be refused by security reasons. * @warning Some environement variables may be refused by security reasons.
* */ * */
int channel_request_env(CHANNEL *channel, const char *name, const char *value) { int channel_request_env(CHANNEL *channel, const char *name, const char *value) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
ssh_string str = NULL; ssh_string str = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
@@ -1310,7 +1310,7 @@ error:
* @see channel_request_shell() * @see channel_request_shell()
*/ */
int channel_request_exec(CHANNEL *channel, const char *cmd) { int channel_request_exec(CHANNEL *channel, const char *cmd) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
ssh_string command = NULL; ssh_string command = NULL;
int rc = SSH_ERROR; int rc = SSH_ERROR;
@@ -1359,10 +1359,10 @@ error:
* *
* @return The number of bytes read, 0 on end of file or SSH_ERROR on error. * @return The number of bytes read, 0 on end of file or SSH_ERROR on error.
*/ */
int channel_read_buffer(CHANNEL *channel, BUFFER *buffer, u32 count, int channel_read_buffer(CHANNEL *channel, ssh_buffer buffer, u32 count,
int is_stderr) { int is_stderr) {
SSH_SESSION *session=channel->session; SSH_SESSION *session=channel->session;
BUFFER *stdbuf = channel->stdout_buffer; ssh_buffer stdbuf = channel->stdout_buffer;
u32 maxread = count; u32 maxread = count;
u32 len; u32 len;
@@ -1470,7 +1470,7 @@ int channel_read_buffer(CHANNEL *channel, BUFFER *buffer, u32 count,
*/ */
int channel_read(CHANNEL *channel, void *dest, u32 count, int is_stderr) { int channel_read(CHANNEL *channel, void *dest, u32 count, int is_stderr) {
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
BUFFER *stdbuf = channel->stdout_buffer; ssh_buffer stdbuf = channel->stdout_buffer;
u32 len; u32 len;
enter_function(); enter_function();
@@ -1606,7 +1606,7 @@ int channel_read_nonblocking(CHANNEL *channel, void *dest, u32 count,
*/ */
int channel_poll(CHANNEL *channel, int is_stderr){ int channel_poll(CHANNEL *channel, int is_stderr){
SSH_SESSION *session = channel->session; SSH_SESSION *session = channel->session;
BUFFER *stdbuf = channel->stdout_buffer; ssh_buffer stdbuf = channel->stdout_buffer;
enter_function(); enter_function();

View File

@@ -174,7 +174,7 @@ unsigned char *packet_encrypt(SSH_SESSION *session, void *data, u32 len) {
* @return 0 if hmac and mac are equal, < 0 if not or an error * @return 0 if hmac and mac are equal, < 0 if not or an error
* occured. * occured.
*/ */
int packet_hmac_verify(SSH_SESSION *session, BUFFER *buffer, int packet_hmac_verify(SSH_SESSION *session, ssh_buffer buffer,
unsigned char *mac) { unsigned char *mac) {
unsigned char hmacbuf[EVP_MAX_MD_SIZE] = {0}; unsigned char hmacbuf[EVP_MAX_MD_SIZE] = {0};
HMACCTX ctx; HMACCTX ctx;

View File

@@ -477,9 +477,9 @@ int make_sessionid(SSH_SESSION *session) {
SHACTX ctx; SHACTX ctx;
ssh_string num = NULL; ssh_string num = NULL;
ssh_string str = NULL; ssh_string str = NULL;
BUFFER *server_hash = NULL; ssh_buffer server_hash = NULL;
BUFFER *client_hash = NULL; ssh_buffer client_hash = NULL;
BUFFER *buf = NULL; ssh_buffer buf = NULL;
u32 len; u32 len;
int rc = SSH_ERROR; int rc = SSH_ERROR;

View File

@@ -54,11 +54,11 @@ static z_stream *initcompress(SSH_SESSION *session, int level) {
return stream; return stream;
} }
static BUFFER *gzip_compress(SSH_SESSION *session,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; z_stream *zout = session->current_crypto->compress_out_ctx;
void *in_ptr = buffer_get(source); void *in_ptr = buffer_get(source);
unsigned long in_size = buffer_get_len(source); unsigned long in_size = buffer_get_len(source);
BUFFER *dest = NULL; ssh_buffer dest = NULL;
static unsigned char out_buf[BLOCKSIZE] = {0}; static unsigned char out_buf[BLOCKSIZE] = {0};
unsigned long len; unsigned long len;
int status; int status;
@@ -98,8 +98,8 @@ static BUFFER *gzip_compress(SSH_SESSION *session,BUFFER *source,int level){
return dest; return dest;
} }
int compress_buffer(SSH_SESSION *session, BUFFER *buf) { int compress_buffer(SSH_SESSION *session, ssh_buffer buf) {
BUFFER *dest = NULL; ssh_buffer dest = NULL;
dest = gzip_compress(session, buf, 9); dest = gzip_compress(session, buf, 9);
if (dest == NULL) { if (dest == NULL) {
@@ -143,12 +143,12 @@ static z_stream *initdecompress(SSH_SESSION *session) {
return stream; return stream;
} }
static BUFFER *gzip_decompress(SSH_SESSION *session, BUFFER *source) { static ssh_buffer gzip_decompress(SSH_SESSION *session, ssh_buffer source) {
z_stream *zin = session->current_crypto->compress_in_ctx; z_stream *zin = session->current_crypto->compress_in_ctx;
void *in_ptr = buffer_get_rest(source); void *in_ptr = buffer_get_rest(source);
unsigned long in_size = buffer_get_rest_len(source); unsigned long in_size = buffer_get_rest_len(source);
static unsigned char out_buf[BLOCKSIZE] = {0}; static unsigned char out_buf[BLOCKSIZE] = {0};
BUFFER *dest = NULL; ssh_buffer dest = NULL;
unsigned long len; unsigned long len;
int status; int status;
@@ -190,8 +190,8 @@ static BUFFER *gzip_decompress(SSH_SESSION *session, BUFFER *source) {
return dest; return dest;
} }
int decompress_buffer(SSH_SESSION *session,BUFFER *buf){ int decompress_buffer(SSH_SESSION *session,ssh_buffer buf){
BUFFER *dest = NULL; ssh_buffer dest = NULL;
dest = gzip_decompress(session,buf); dest = gzip_decompress(session,buf);
if (dest == NULL) { if (dest == NULL) {

View File

@@ -445,7 +445,7 @@ int verify_existing_algo(int algo, const char *name){
/* makes a STRING contating 3 strings : ssh-rsa1,e and n */ /* makes a STRING contating 3 strings : ssh-rsa1,e and n */
/* this is a public key in openssh's format */ /* this is a public key in openssh's format */
static ssh_string make_rsa1_string(ssh_string e, ssh_string n){ static ssh_string make_rsa1_string(ssh_string e, ssh_string n){
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
ssh_string rsa = NULL; ssh_string rsa = NULL;
ssh_string ret = NULL; ssh_string ret = NULL;

View File

@@ -96,7 +96,7 @@ static u32 char_to_u32(unsigned char *data, u32 size) {
return ret; return ret;
} }
static u32 asn1_get_len(BUFFER *buffer) { static u32 asn1_get_len(ssh_buffer buffer) {
u32 len; u32 len;
unsigned char tmp[4]; unsigned char tmp[4];
@@ -120,7 +120,7 @@ static u32 asn1_get_len(BUFFER *buffer) {
return len; return len;
} }
static ssh_string asn1_get_int(BUFFER *buffer) { static ssh_string asn1_get_int(ssh_buffer buffer) {
ssh_string str; ssh_string str;
unsigned char type; unsigned char type;
u32 size; u32 size;
@@ -146,7 +146,7 @@ static ssh_string asn1_get_int(BUFFER *buffer) {
return str; return str;
} }
static int asn1_check_sequence(BUFFER *buffer) { static int asn1_check_sequence(ssh_buffer buffer) {
unsigned char *j = NULL; unsigned char *j = NULL;
unsigned char tmp; unsigned char tmp;
int i; int i;
@@ -228,7 +228,7 @@ static int passphrase_to_key(char *data, unsigned int datalen,
static int privatekey_decrypt(int algo, int mode, unsigned int key_len, static int privatekey_decrypt(int algo, int mode, unsigned int key_len,
unsigned char *iv, unsigned int iv_len, unsigned char *iv, unsigned int iv_len,
BUFFER *data, ssh_auth_callback cb, ssh_buffer data, ssh_auth_callback cb,
void *userdata, void *userdata,
const char *desc) const char *desc)
{ {
@@ -329,10 +329,10 @@ static int privatekey_dek_header(char *header, unsigned int header_len,
return load_iv(header + iv_pos, *iv, *iv_len); return load_iv(header + iv_pos, *iv, *iv_len);
} }
static BUFFER *privatekey_file_to_buffer(FILE *fp, int type, static ssh_buffer privatekey_file_to_buffer(FILE *fp, int type,
ssh_auth_callback cb, void *userdata, const char *desc) { ssh_auth_callback cb, void *userdata, const char *desc) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
BUFFER *out = NULL; ssh_buffer out = NULL;
char buf[MAXLINESIZE] = {0}; char buf[MAXLINESIZE] = {0};
unsigned char *iv = NULL; unsigned char *iv = NULL;
const char *header_begin; const char *header_begin;
@@ -452,7 +452,7 @@ static int read_rsa_privatekey(FILE *fp, gcry_sexp_t *r,
ssh_string unused2 = NULL; ssh_string unused2 = NULL;
ssh_string u = NULL; ssh_string u = NULL;
ssh_string v = NULL; ssh_string v = NULL;
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
int rc = 1; int rc = 1;
buffer = privatekey_file_to_buffer(fp, TYPE_RSA, cb, userdata, desc); buffer = privatekey_file_to_buffer(fp, TYPE_RSA, cb, userdata, desc);
@@ -515,7 +515,7 @@ error:
static int read_dsa_privatekey(FILE *fp, gcry_sexp_t *r, ssh_auth_callback cb, static int read_dsa_privatekey(FILE *fp, gcry_sexp_t *r, ssh_auth_callback cb,
void *userdata, const char *desc) { void *userdata, const char *desc) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
ssh_string p = NULL; ssh_string p = NULL;
ssh_string q = NULL; ssh_string q = NULL;
ssh_string g = NULL; ssh_string g = NULL;
@@ -855,7 +855,7 @@ void privatekey_free(PRIVATE_KEY *prv) {
*/ */
ssh_string publickey_from_file(SSH_SESSION *session, const char *filename, ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
int *type) { int *type) {
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
char buf[4096] = {0}; char buf[4096] = {0};
ssh_string str = NULL; ssh_string str = NULL;
char *ptr = NULL; char *ptr = NULL;
@@ -1138,7 +1138,7 @@ static char **ssh_get_knownhost_line(SSH_SESSION *session, FILE **file,
*/ */
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_string pubkey = session->current_crypto->server_pubkey;
BUFFER *pubkey_buffer; ssh_buffer pubkey_buffer;
char *pubkey_64; char *pubkey_64;
/* ok we found some public key in known hosts file. now un-base64it */ /* ok we found some public key in known hosts file. now un-base64it */
@@ -1243,8 +1243,8 @@ static int match_hashed_host(SSH_SESSION *session, const char *host,
* hash := HMAC_SHA1(key=salt,data=host) * hash := HMAC_SHA1(key=salt,data=host)
*/ */
unsigned char buffer[256] = {0}; unsigned char buffer[256] = {0};
BUFFER *salt; ssh_buffer salt;
BUFFER *hash; ssh_buffer hash;
HMACCTX mac; HMACCTX mac;
char *source; char *source;
char *b64hash; char *b64hash;

View File

@@ -65,7 +65,7 @@ int ssh_type_from_name(const char *name) {
return -1; return -1;
} }
PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, BUFFER *buffer) { PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, ssh_buffer buffer) {
ssh_string p = NULL; ssh_string p = NULL;
ssh_string q = NULL; ssh_string q = NULL;
ssh_string g = NULL; ssh_string g = NULL;
@@ -151,7 +151,7 @@ error:
return NULL; return NULL;
} }
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer, PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, ssh_buffer buffer,
int type) { int type) {
ssh_string e = NULL; ssh_string e = NULL;
ssh_string n = NULL; ssh_string n = NULL;
@@ -246,7 +246,7 @@ void publickey_free(PUBLIC_KEY *key) {
} }
PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s) { PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, ssh_string pubkey_s) {
BUFFER *tmpbuf = NULL; ssh_buffer tmpbuf = NULL;
ssh_string type_s = NULL; ssh_string type_s = NULL;
char *type_c = NULL; char *type_c = NULL;
int type; int type;
@@ -478,9 +478,9 @@ error:
} }
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
static int dsa_public_to_string(gcry_sexp_t key, BUFFER *buffer) { static int dsa_public_to_string(gcry_sexp_t key, ssh_buffer buffer) {
#elif defined HAVE_LIBCRYPTO #elif defined HAVE_LIBCRYPTO
static int dsa_public_to_string(DSA *key, BUFFER *buffer) { static int dsa_public_to_string(DSA *key, ssh_buffer buffer) {
#endif #endif
ssh_string p = NULL; ssh_string p = NULL;
ssh_string q = NULL; ssh_string q = NULL;
@@ -583,9 +583,9 @@ error:
} }
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
static int rsa_public_to_string(gcry_sexp_t key, BUFFER *buffer) { static int rsa_public_to_string(gcry_sexp_t key, ssh_buffer buffer) {
#elif defined HAVE_LIBCRYPTO #elif defined HAVE_LIBCRYPTO
static int rsa_public_to_string(RSA *key, BUFFER *buffer) { static int rsa_public_to_string(RSA *key, ssh_buffer buffer) {
#endif #endif
ssh_string e = NULL; ssh_string e = NULL;
@@ -658,7 +658,7 @@ error:
ssh_string publickey_to_string(PUBLIC_KEY *key) { ssh_string publickey_to_string(PUBLIC_KEY *key) {
ssh_string type = NULL; ssh_string type = NULL;
ssh_string ret = NULL; ssh_string ret = NULL;
BUFFER *buf = NULL; ssh_buffer buf = NULL;
buf = buffer_new(); buf = buffer_new();
if (buf == NULL) { if (buf == NULL) {
@@ -704,7 +704,7 @@ error:
/* Signature decoding functions */ /* Signature decoding functions */
static ssh_string signature_to_string(SIGNATURE *sign) { static ssh_string signature_to_string(SIGNATURE *sign) {
unsigned char buffer[40] = {0}; unsigned char buffer[40] = {0};
BUFFER *tmpbuf = NULL; ssh_buffer tmpbuf = NULL;
ssh_string str = NULL; ssh_string str = NULL;
ssh_string tmp = NULL; ssh_string tmp = NULL;
ssh_string rs = NULL; ssh_string rs = NULL;
@@ -849,7 +849,7 @@ static ssh_string signature_to_string(SIGNATURE *sign) {
SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature, SIGNATURE *signature_from_string(SSH_SESSION *session, ssh_string signature,
PUBLIC_KEY *pubkey, int needed_type) { PUBLIC_KEY *pubkey, int needed_type) {
SIGNATURE *sign = NULL; SIGNATURE *sign = NULL;
BUFFER *tmpbuf = NULL; ssh_buffer tmpbuf = NULL;
ssh_string rs = NULL; ssh_string rs = NULL;
ssh_string type_s = NULL; ssh_string type_s = NULL;
ssh_string e = NULL; ssh_string e = NULL;
@@ -1150,7 +1150,7 @@ ssh_string ssh_do_sign_with_agent(struct ssh_session *session,
/* /*
* This function signs the session id (known as H) as a string then * This function signs the session id (known as H) as a string then
* the content of sigbuf */ * the content of sigbuf */
ssh_string ssh_do_sign(SSH_SESSION *session, BUFFER *sigbuf, ssh_string ssh_do_sign(SSH_SESSION *session, ssh_buffer sigbuf,
PRIVATE_KEY *privatekey) { PRIVATE_KEY *privatekey) {
CRYPTO *crypto = session->current_crypto ? session->current_crypto : CRYPTO *crypto = session->current_crypto ? session->current_crypto :
session->next_crypto; session->next_crypto;

View File

@@ -111,7 +111,7 @@ SFTP_SESSION *sftp_server_new(SSH_SESSION *session, CHANNEL *chan){
int sftp_server_init(SFTP_SESSION *sftp){ int sftp_server_init(SFTP_SESSION *sftp){
struct ssh_session *session = sftp->session; struct ssh_session *session = sftp->session;
SFTP_PACKET *packet = NULL; SFTP_PACKET *packet = NULL;
BUFFER *reply = NULL; ssh_buffer reply = NULL;
u32 version; u32 version;
sftp_enter_function(); sftp_enter_function();
@@ -196,7 +196,7 @@ void sftp_free(SFTP_SESSION *sftp){
SAFE_FREE(sftp); SAFE_FREE(sftp);
} }
int sftp_packet_write(SFTP_SESSION *sftp,u8 type, BUFFER *payload){ int sftp_packet_write(SFTP_SESSION *sftp,u8 type, ssh_buffer payload){
int size; int size;
if (buffer_prepend_data(payload, &type, sizeof(u8)) < 0) { if (buffer_prepend_data(payload, &type, sizeof(u8)) < 0) {
@@ -418,7 +418,7 @@ void sftp_packet_free(SFTP_PACKET *packet) {
/* Initialize the sftp session with the server. */ /* Initialize the sftp session with the server. */
int sftp_init(SFTP_SESSION *sftp) { int sftp_init(SFTP_SESSION *sftp) {
SFTP_PACKET *packet = NULL; SFTP_PACKET *packet = NULL;
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
ssh_string ext_name_s = NULL; ssh_string ext_name_s = NULL;
ssh_string ext_data_s = NULL; ssh_string ext_data_s = NULL;
char *ext_name = NULL; char *ext_name = NULL;
@@ -673,7 +673,7 @@ SFTP_DIR *sftp_opendir(SFTP_SESSION *sftp, const char *path){
SFTP_DIR *dir = NULL; SFTP_DIR *dir = NULL;
STATUS_MESSAGE *status; STATUS_MESSAGE *status;
ssh_string path_s; ssh_string path_s;
BUFFER *payload; ssh_buffer payload;
u32 id; u32 id;
payload = buffer_new(); payload = buffer_new();
@@ -757,7 +757,7 @@ SFTP_DIR *sftp_opendir(SFTP_SESSION *sftp, const char *path){
* baselines from the protocol version 4. * baselines from the protocol version 4.
* This code is more or less dead but maybe we need it in future. * This code is more or less dead but maybe we need it in future.
*/ */
static SFTP_ATTRIBUTES *sftp_parse_attr_4(SFTP_SESSION *sftp, BUFFER *buf, static SFTP_ATTRIBUTES *sftp_parse_attr_4(SFTP_SESSION *sftp, ssh_buffer buf,
int expectnames) { int expectnames) {
SFTP_ATTRIBUTES *attr; SFTP_ATTRIBUTES *attr;
ssh_string owner = NULL; ssh_string owner = NULL;
@@ -933,7 +933,7 @@ static SFTP_ATTRIBUTES *sftp_parse_attr_4(SFTP_SESSION *sftp, BUFFER *buf,
string extended_data string extended_data
... more extended data (extended_type - extended_data pairs), ... more extended data (extended_type - extended_data pairs),
so that number of pairs equals extended_count */ so that number of pairs equals extended_count */
static SFTP_ATTRIBUTES *sftp_parse_attr_3(SFTP_SESSION *sftp, BUFFER *buf, static SFTP_ATTRIBUTES *sftp_parse_attr_3(SFTP_SESSION *sftp, ssh_buffer buf,
int expectname) { int expectname) {
ssh_string longname = NULL; ssh_string longname = NULL;
ssh_string name = NULL; ssh_string name = NULL;
@@ -1075,7 +1075,7 @@ static SFTP_ATTRIBUTES *sftp_parse_attr_3(SFTP_SESSION *sftp, BUFFER *buf,
} }
/* FIXME is this really needed as a public function? */ /* FIXME is this really needed as a public function? */
int buffer_add_attributes(BUFFER *buffer, SFTP_ATTRIBUTES *attr) { int buffer_add_attributes(ssh_buffer buffer, SFTP_ATTRIBUTES *attr) {
u32 flags = (attr ? attr->flags : 0); u32 flags = (attr ? attr->flags : 0);
flags &= (SSH_FILEXFER_ATTR_SIZE | SSH_FILEXFER_ATTR_UIDGID | flags &= (SSH_FILEXFER_ATTR_SIZE | SSH_FILEXFER_ATTR_UIDGID |
@@ -1117,7 +1117,7 @@ int buffer_add_attributes(BUFFER *buffer, SFTP_ATTRIBUTES *attr) {
} }
SFTP_ATTRIBUTES *sftp_parse_attr(SFTP_SESSION *session, BUFFER *buf, SFTP_ATTRIBUTES *sftp_parse_attr(SFTP_SESSION *session, ssh_buffer buf,
int expectname) { int expectname) {
switch(session->version) { switch(session->version) {
case 4: case 4:
@@ -1143,7 +1143,7 @@ SFTP_ATTRIBUTES *sftp_readdir(SFTP_SESSION *sftp, SFTP_DIR *dir) {
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
STATUS_MESSAGE *status; STATUS_MESSAGE *status;
SFTP_ATTRIBUTES *attr; SFTP_ATTRIBUTES *attr;
BUFFER *payload; ssh_buffer payload;
u32 id; u32 id;
if (dir->buffer == NULL) { if (dir->buffer == NULL) {
@@ -1266,7 +1266,7 @@ void sftp_attributes_free(SFTP_ATTRIBUTES *file){
static int sftp_handle_close(SFTP_SESSION *sftp, ssh_string handle) { static int sftp_handle_close(SFTP_SESSION *sftp, ssh_string handle) {
STATUS_MESSAGE *status; STATUS_MESSAGE *status;
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
BUFFER *buffer = NULL; ssh_buffer buffer = NULL;
u32 id; u32 id;
buffer = buffer_new(); buffer = buffer_new();
@@ -1367,7 +1367,7 @@ SFTP_FILE *sftp_open(SFTP_SESSION *sftp, const char *file, int flags,
SFTP_ATTRIBUTES attr; SFTP_ATTRIBUTES attr;
SFTP_FILE *handle; SFTP_FILE *handle;
ssh_string filename; ssh_string filename;
BUFFER *buffer; ssh_buffer buffer;
u32 sftp_flags = 0; u32 sftp_flags = 0;
u32 id; u32 id;
@@ -1464,7 +1464,7 @@ ssize_t sftp_read(SFTP_FILE *handle, void *buf, size_t count) {
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
STATUS_MESSAGE *status; STATUS_MESSAGE *status;
ssh_string datastring; ssh_string datastring;
BUFFER *buffer; ssh_buffer buffer;
int id; int id;
if (handle->eof) { if (handle->eof) {
@@ -1555,7 +1555,7 @@ ssize_t sftp_read(SFTP_FILE *handle, void *buf, size_t count) {
/* Start an asynchronous read from a file using an opened sftp file handle. */ /* Start an asynchronous read from a file using an opened sftp file handle. */
int sftp_async_read_begin(SFTP_FILE *file, u32 len){ int sftp_async_read_begin(SFTP_FILE *file, u32 len){
SFTP_SESSION *sftp = file->sftp; SFTP_SESSION *sftp = file->sftp;
BUFFER *buffer; ssh_buffer buffer;
u32 id; u32 id;
sftp_enter_function(); sftp_enter_function();
@@ -1678,7 +1678,7 @@ ssize_t sftp_write(SFTP_FILE *file, const void *buf, size_t count) {
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
STATUS_MESSAGE *status; STATUS_MESSAGE *status;
ssh_string datastring; ssh_string datastring;
BUFFER *buffer; ssh_buffer buffer;
u32 id; u32 id;
int len; int len;
int packetlen; int packetlen;
@@ -1795,7 +1795,7 @@ int sftp_unlink(SFTP_SESSION *sftp, const char *file) {
STATUS_MESSAGE *status = NULL; STATUS_MESSAGE *status = NULL;
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
ssh_string filename; ssh_string filename;
BUFFER *buffer; ssh_buffer buffer;
u32 id; u32 id;
buffer = buffer_new(); buffer = buffer_new();
@@ -1864,7 +1864,7 @@ int sftp_rmdir(SFTP_SESSION *sftp, const char *directory) {
STATUS_MESSAGE *status = NULL; STATUS_MESSAGE *status = NULL;
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
ssh_string filename; ssh_string filename;
BUFFER *buffer; ssh_buffer buffer;
u32 id; u32 id;
buffer = buffer_new(); buffer = buffer_new();
@@ -1932,7 +1932,7 @@ int sftp_mkdir(SFTP_SESSION *sftp, const char *directory, mode_t mode) {
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
SFTP_ATTRIBUTES *errno_attr = NULL; SFTP_ATTRIBUTES *errno_attr = NULL;
SFTP_ATTRIBUTES attr; SFTP_ATTRIBUTES attr;
BUFFER *buffer; ssh_buffer buffer;
ssh_string path; ssh_string path;
u32 id; u32 id;
@@ -2019,7 +2019,7 @@ int sftp_mkdir(SFTP_SESSION *sftp, const char *directory, mode_t mode) {
int sftp_rename(SFTP_SESSION *sftp, const char *original, const char *newname) { int sftp_rename(SFTP_SESSION *sftp, const char *original, const char *newname) {
STATUS_MESSAGE *status = NULL; STATUS_MESSAGE *status = NULL;
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
BUFFER *buffer; ssh_buffer buffer;
ssh_string oldpath; ssh_string oldpath;
ssh_string newpath; ssh_string newpath;
u32 id; u32 id;
@@ -2102,7 +2102,7 @@ int sftp_rename(SFTP_SESSION *sftp, const char *original, const char *newname) {
/* Set file attributes on a file, directory or symbolic link. */ /* Set file attributes on a file, directory or symbolic link. */
int sftp_setstat(SFTP_SESSION *sftp, const char *file, SFTP_ATTRIBUTES *attr) { int sftp_setstat(SFTP_SESSION *sftp, const char *file, SFTP_ATTRIBUTES *attr) {
u32 id = sftp_get_new_id(sftp); u32 id = sftp_get_new_id(sftp);
BUFFER *buffer = buffer_new(); ssh_buffer buffer = buffer_new();
ssh_string path = string_from_char(file); ssh_string path = string_from_char(file);
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
STATUS_MESSAGE *status = NULL; STATUS_MESSAGE *status = NULL;
@@ -2218,7 +2218,7 @@ char *sftp_canonicalize_path(SFTP_SESSION *sftp, const char *path) {
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
ssh_string name = NULL; ssh_string name = NULL;
ssh_string pathstr; ssh_string pathstr;
BUFFER *buffer; ssh_buffer buffer;
char *cname; char *cname;
u32 ignored; u32 ignored;
u32 id; u32 id;
@@ -2292,7 +2292,7 @@ static SFTP_ATTRIBUTES *sftp_xstat(SFTP_SESSION *sftp, const char *path,
STATUS_MESSAGE *status = NULL; STATUS_MESSAGE *status = NULL;
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
ssh_string pathstr; ssh_string pathstr;
BUFFER *buffer; ssh_buffer buffer;
u32 id; u32 id;
buffer = buffer_new(); buffer = buffer_new();
@@ -2356,7 +2356,7 @@ SFTP_ATTRIBUTES *sftp_lstat(SFTP_SESSION *session, const char *path) {
SFTP_ATTRIBUTES *sftp_fstat(SFTP_FILE *file) { SFTP_ATTRIBUTES *sftp_fstat(SFTP_FILE *file) {
STATUS_MESSAGE *status = NULL; STATUS_MESSAGE *status = NULL;
SFTP_MESSAGE *msg = NULL; SFTP_MESSAGE *msg = NULL;
BUFFER *buffer; ssh_buffer buffer;
u32 id; u32 id;
buffer = buffer_new(); buffer = buffer_new();

View File

@@ -38,7 +38,7 @@
SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp) { SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp) {
SFTP_PACKET *packet; SFTP_PACKET *packet;
SFTP_CLIENT_MESSAGE *msg; SFTP_CLIENT_MESSAGE *msg;
BUFFER *payload; ssh_buffer payload;
ssh_string tmp; ssh_string tmp;
msg = malloc(sizeof (SFTP_CLIENT_MESSAGE)); msg = malloc(sizeof (SFTP_CLIENT_MESSAGE));
@@ -228,7 +228,7 @@ void sftp_client_message_free(SFTP_CLIENT_MESSAGE *msg) {
int sftp_reply_name(SFTP_CLIENT_MESSAGE *msg, const char *name, int sftp_reply_name(SFTP_CLIENT_MESSAGE *msg, const char *name,
SFTP_ATTRIBUTES *attr) { SFTP_ATTRIBUTES *attr) {
BUFFER *out; ssh_buffer out;
ssh_string file; ssh_string file;
out = buffer_new(); out = buffer_new();
@@ -259,7 +259,7 @@ int sftp_reply_name(SFTP_CLIENT_MESSAGE *msg, const char *name,
} }
int sftp_reply_handle(SFTP_CLIENT_MESSAGE *msg, ssh_string handle){ int sftp_reply_handle(SFTP_CLIENT_MESSAGE *msg, ssh_string handle){
BUFFER *out; ssh_buffer out;
out = buffer_new(); out = buffer_new();
if (out == NULL) { if (out == NULL) {
@@ -278,7 +278,7 @@ int sftp_reply_handle(SFTP_CLIENT_MESSAGE *msg, ssh_string handle){
} }
int sftp_reply_attr(SFTP_CLIENT_MESSAGE *msg, SFTP_ATTRIBUTES *attr) { int sftp_reply_attr(SFTP_CLIENT_MESSAGE *msg, SFTP_ATTRIBUTES *attr) {
BUFFER *out; ssh_buffer out;
out = buffer_new(); out = buffer_new();
if (out == NULL) { if (out == NULL) {
@@ -335,7 +335,7 @@ int sftp_reply_names_add(SFTP_CLIENT_MESSAGE *msg, const char *file,
} }
int sftp_reply_names(SFTP_CLIENT_MESSAGE *msg) { int sftp_reply_names(SFTP_CLIENT_MESSAGE *msg) {
BUFFER *out; ssh_buffer out;
out = buffer_new(); out = buffer_new();
if (out == NULL) { if (out == NULL) {
@@ -364,7 +364,7 @@ int sftp_reply_names(SFTP_CLIENT_MESSAGE *msg) {
int sftp_reply_status(SFTP_CLIENT_MESSAGE *msg, u32 status, int sftp_reply_status(SFTP_CLIENT_MESSAGE *msg, u32 status,
const char *message) { const char *message) {
BUFFER *out; ssh_buffer out;
ssh_string s; ssh_string s;
out = buffer_new(); out = buffer_new();
@@ -395,7 +395,7 @@ int sftp_reply_status(SFTP_CLIENT_MESSAGE *msg, u32 status,
} }
int sftp_reply_data(SFTP_CLIENT_MESSAGE *msg, const void *data, int len) { int sftp_reply_data(SFTP_CLIENT_MESSAGE *msg, const void *data, int len) {
BUFFER *out; ssh_buffer out;
out = buffer_new(); out = buffer_new();
if (out == NULL) { if (out == NULL) {

View File

@@ -48,8 +48,8 @@ struct socket {
not block */ not block */
int data_to_write; int data_to_write;
int data_except; int data_except;
BUFFER *out_buffer; ssh_buffer out_buffer;
BUFFER *in_buffer; ssh_buffer in_buffer;
SSH_SESSION *session; SSH_SESSION *session;
}; };