aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
Diffstat (limited to 'libssh')
-rw-r--r--libssh/agent.c26
-rw-r--r--libssh/auth.c2
-rw-r--r--libssh/buffer.c58
-rw-r--r--libssh/keys.c8
-rw-r--r--libssh/messages.c2
-rw-r--r--libssh/string.c24
6 files changed, 60 insertions, 60 deletions
diff --git a/libssh/agent.c b/libssh/agent.c
index 3f5edb41..b0bcbe4e 100644
--- a/libssh/agent.c
+++ b/libssh/agent.c
@@ -137,7 +137,7 @@ AGENT *agent_new(struct ssh_session *session) {
return agent;
}
-void agent_close(struct agent_struct *agent) {
+void agent_close(struct ssh_agent_struct *agent) {
if (agent == NULL) {
return;
}
@@ -200,7 +200,7 @@ static int agent_decode_reply(struct ssh_session *session, int type) {
#endif
static int agent_talk(struct ssh_session *session,
- struct buffer_struct *request, struct buffer_struct *reply) {
+ struct ssh_buffer_struct *request, struct ssh_buffer_struct *reply) {
u32 len = 0;
u8 payload[1024] = {0};
@@ -335,7 +335,7 @@ int agent_get_ident_count(struct ssh_session *session) {
}
/* caller has to free commment */
-struct public_key_struct *agent_get_first_ident(struct ssh_session *session,
+struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session *session,
char **comment) {
if (agent_get_ident_count(session) > 0) {
return agent_get_next_ident(session, comment);
@@ -345,11 +345,11 @@ struct public_key_struct *agent_get_first_ident(struct ssh_session *session,
}
/* caller has to free commment */
-struct public_key_struct *agent_get_next_ident(struct ssh_session *session,
+struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session *session,
char **comment) {
- struct public_key_struct *pubkey = NULL;
- struct string_struct *blob = NULL;
- struct string_struct *tmp = NULL;
+ struct ssh_public_key_struct *pubkey = NULL;
+ struct ssh_string_struct *blob = NULL;
+ struct ssh_string_struct *tmp = NULL;
if (session->agent->count == 0) {
return NULL;
@@ -395,12 +395,12 @@ struct public_key_struct *agent_get_next_ident(struct ssh_session *session,
}
STRING *agent_sign_data(struct ssh_session *session,
- struct buffer_struct *data,
- struct public_key_struct *pubkey) {
- struct string_struct *blob = NULL;
- struct string_struct *sig = NULL;
- struct buffer_struct *request = NULL;
- struct buffer_struct *reply = NULL;
+ struct ssh_buffer_struct *data,
+ struct ssh_public_key_struct *pubkey) {
+ struct ssh_string_struct *blob = NULL;
+ struct ssh_string_struct *sig = NULL;
+ struct ssh_buffer_struct *request = NULL;
+ struct ssh_buffer_struct *reply = NULL;
int type = SSH2_AGENT_FAILURE;
int flags = 0;
u32 dlen = 0;
diff --git a/libssh/auth.c b/libssh/auth.c
index 77d4d218..8ad1310e 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -795,7 +795,7 @@ static struct keys_struct keytab[] = {
* @see ssh_options_set_identity()
*/
int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) {
- struct public_key_struct *publickey;
+ struct ssh_public_key_struct *publickey;
STRING *pubkey;
PRIVATE_KEY *privkey;
char *privkeyfile = NULL;
diff --git a/libssh/buffer.c b/libssh/buffer.c
index ea8c7a13..b3d5186a 100644
--- a/libssh/buffer.c
+++ b/libssh/buffer.c
@@ -70,13 +70,13 @@ static void buffer_verify(struct buffer_struct *buf){
/** \brief creates a new buffer
* \return a new initialized buffer, NULL on error.
*/
-struct buffer_struct *buffer_new(void) {
- struct buffer_struct *buf = malloc(sizeof(struct buffer_struct));
+struct ssh_buffer_struct *buffer_new(void) {
+ struct ssh_buffer_struct *buf = malloc(sizeof(struct ssh_buffer_struct));
if (buf == NULL) {
return NULL;
}
- memset(buf, 0, sizeof(struct buffer_struct));
+ memset(buf, 0, sizeof(struct ssh_buffer_struct));
buffer_verify(buf);
return buf;
}
@@ -84,7 +84,7 @@ struct buffer_struct *buffer_new(void) {
/** \brief deallocate a buffer
* \param buffer buffer to free
*/
-void buffer_free(struct buffer_struct *buffer) {
+void buffer_free(struct ssh_buffer_struct *buffer) {
if (buffer == NULL) {
return;
}
@@ -99,7 +99,7 @@ void buffer_free(struct buffer_struct *buffer) {
SAFE_FREE(buffer);
}
-static int realloc_buffer(struct buffer_struct *buffer, int needed) {
+static int realloc_buffer(struct ssh_buffer_struct *buffer, int needed) {
int smallest = 1;
char *new = NULL;
buffer_verify(buffer);
@@ -123,7 +123,7 @@ static int realloc_buffer(struct buffer_struct *buffer, int needed) {
* \param buffer buffer
* \return 0 on sucess, < 0 on error
*/
-int buffer_reinit(struct buffer_struct *buffer) {
+int buffer_reinit(struct ssh_buffer_struct *buffer) {
buffer_verify(buffer);
memset(buffer->data, 0, buffer->used);
buffer->used = 0;
@@ -143,7 +143,7 @@ int buffer_reinit(struct buffer_struct *buffer) {
* \param data data pointer
* \param len length of data
*/
-int buffer_add_data(struct buffer_struct *buffer, const void *data, u32 len) {
+int buffer_add_data(struct ssh_buffer_struct *buffer, const void *data, u32 len) {
buffer_verify(buffer);
if (buffer->allocated < (buffer->used + len)) {
if (realloc_buffer(buffer, buffer->used + len) < 0) {
@@ -163,8 +163,8 @@ int buffer_add_data(struct buffer_struct *buffer, const void *data, u32 len) {
* \param string SSH String to add
* \return 0 on success, -1 on error.
*/
-int buffer_add_ssh_string(struct buffer_struct *buffer,
- struct string_struct *string) {
+int buffer_add_ssh_string(struct ssh_buffer_struct *buffer,
+ struct ssh_string_struct *string) {
u32 len = 0;
len = ntohl(string->size);
@@ -180,7 +180,7 @@ int buffer_add_ssh_string(struct buffer_struct *buffer,
* \param data 32 bits integer
* \return 0 on success, -1 on error.
*/
-int buffer_add_u32(struct buffer_struct *buffer,u32 data){
+int buffer_add_u32(struct ssh_buffer_struct *buffer,u32 data){
if (buffer_add_data(buffer, &data, sizeof(data)) < 0) {
return -1;
}
@@ -194,7 +194,7 @@ int buffer_add_u32(struct buffer_struct *buffer,u32 data){
* \param data 64 bits integer
* \return 0 on success, -1 on error.
*/
-int buffer_add_u64(struct buffer_struct *buffer, u64 data){
+int buffer_add_u64(struct ssh_buffer_struct *buffer, u64 data){
if (buffer_add_data(buffer, &data, sizeof(data)) < 0) {
return -1;
}
@@ -207,7 +207,7 @@ int buffer_add_u64(struct buffer_struct *buffer, u64 data){
* \param data 8 bits integer
* \return 0 on success, -1 on error.
*/
-int buffer_add_u8(struct buffer_struct *buffer,u8 data){
+int buffer_add_u8(struct ssh_buffer_struct *buffer,u8 data){
if (buffer_add_data(buffer, &data, sizeof(u8)) < 0) {
return -1;
}
@@ -222,7 +222,7 @@ int buffer_add_u8(struct buffer_struct *buffer,u8 data){
* \param len length of data
* \return 0 on success, -1 on error.
*/
-int buffer_prepend_data(struct buffer_struct *buffer, const void *data,
+int buffer_prepend_data(struct ssh_buffer_struct *buffer, const void *data,
u32 len) {
buffer_verify(buffer);
if (buffer->allocated < (buffer->used + len)) {
@@ -243,8 +243,8 @@ int buffer_prepend_data(struct buffer_struct *buffer, const void *data,
* \param source source buffer. Doesn't take position in buffer into account
* \return 0 on success, -1 on error.
*/
-int buffer_add_buffer(struct buffer_struct *buffer,
- struct buffer_struct *source) {
+int buffer_add_buffer(struct ssh_buffer_struct *buffer,
+ struct ssh_buffer_struct *source) {
if (buffer_add_data(buffer, buffer_get(source), buffer_get_len(source)) < 0) {
return -1;
}
@@ -259,7 +259,7 @@ int buffer_add_buffer(struct buffer_struct *buffer,
* \see buffer_get_rest()
* \see buffer_get_len()
*/
-void *buffer_get(struct buffer_struct *buffer){
+void *buffer_get(struct ssh_buffer_struct *buffer){
return buffer->data;
}
@@ -270,7 +270,7 @@ void *buffer_get(struct buffer_struct *buffer){
* \see buffer_get_rest_len()
* \see buffer_get()
*/
-void *buffer_get_rest(struct buffer_struct *buffer){
+void *buffer_get_rest(struct ssh_buffer_struct *buffer){
return buffer->data + buffer->pos;
}
@@ -279,7 +279,7 @@ void *buffer_get_rest(struct buffer_struct *buffer){
* \return length of the buffer
* \see buffer_get()
*/
-u32 buffer_get_len(struct buffer_struct *buffer){
+u32 buffer_get_len(struct ssh_buffer_struct *buffer){
return buffer->used;
}
@@ -289,7 +289,7 @@ u32 buffer_get_len(struct buffer_struct *buffer){
* \return length of the buffer
* \see buffer_get_rest()
*/
-u32 buffer_get_rest_len(struct buffer_struct *buffer){
+u32 buffer_get_rest_len(struct ssh_buffer_struct *buffer){
buffer_verify(buffer);
return buffer->used - buffer->pos;
}
@@ -301,7 +301,7 @@ u32 buffer_get_rest_len(struct buffer_struct *buffer){
* \param len number of bytes to eat
* \return new size of the buffer
*/
-u32 buffer_pass_bytes(struct buffer_struct *buffer, u32 len){
+u32 buffer_pass_bytes(struct ssh_buffer_struct *buffer, u32 len){
buffer_verify(buffer);
if(buffer->used < buffer->pos+len)
return 0;
@@ -321,7 +321,7 @@ u32 buffer_pass_bytes(struct buffer_struct *buffer, u32 len){
* \param len number of bytes to remove from tail
* \return new size of the buffer
*/
-u32 buffer_pass_bytes_end(struct buffer_struct *buffer, u32 len){
+u32 buffer_pass_bytes_end(struct ssh_buffer_struct *buffer, u32 len){
buffer_verify(buffer);
if(buffer->used < buffer->pos + len)
return 0;
@@ -338,7 +338,7 @@ u32 buffer_pass_bytes_end(struct buffer_struct *buffer, u32 len){
* \returns 0 if there is not enough data in buffer
* \returns len otherwise.
*/
-u32 buffer_get_data(struct buffer_struct *buffer, void *data, u32 len){
+u32 buffer_get_data(struct ssh_buffer_struct *buffer, void *data, u32 len){
if(buffer->pos+len>buffer->used)
return 0; /*no enough data in buffer */
memcpy(data,buffer->data+buffer->pos,len);
@@ -352,7 +352,7 @@ u32 buffer_get_data(struct buffer_struct *buffer, void *data, u32 len){
* \returns 0 if there is not enough data in buffer
* \returns 1 otherwise.
*/
-int buffer_get_u8(struct buffer_struct *buffer, u8 *data){
+int buffer_get_u8(struct ssh_buffer_struct *buffer, u8 *data){
return buffer_get_data(buffer,data,sizeof(u8));
}
@@ -363,7 +363,7 @@ int buffer_get_u8(struct buffer_struct *buffer, u8 *data){
* \returns 0 if there is not enough data in buffer
* \returns 4 otherwise.
*/
-int buffer_get_u32(struct buffer_struct *buffer, u32 *data){
+int buffer_get_u32(struct ssh_buffer_struct *buffer, u32 *data){
return buffer_get_data(buffer,data,sizeof(u32));
}
/** \internal
@@ -373,7 +373,7 @@ int buffer_get_u32(struct buffer_struct *buffer, u32 *data){
* \returns 0 if there is not enough data in buffer
* \returns 8 otherwise.
*/
-int buffer_get_u64(struct buffer_struct *buffer, u64 *data){
+int buffer_get_u64(struct ssh_buffer_struct *buffer, u64 *data){
return buffer_get_data(buffer,data,sizeof(u64));
}
/** \internal
@@ -382,10 +382,10 @@ int buffer_get_u64(struct buffer_struct *buffer, u64 *data){
* \returns The SSH String read
* \returns NULL otherwise.
*/
-struct string_struct *buffer_get_ssh_string(struct buffer_struct *buffer) {
+struct ssh_string_struct *buffer_get_ssh_string(struct ssh_buffer_struct *buffer) {
u32 stringlen;
u32 hostlen;
- struct string_struct *str = NULL;
+ struct ssh_string_struct *str = NULL;
if (buffer_get_u32(buffer, &stringlen) == 0) {
return NULL;
@@ -415,10 +415,10 @@ struct string_struct *buffer_get_ssh_string(struct buffer_struct *buffer) {
* \returns NULL otherwise
*/
-struct string_struct *buffer_get_mpint(struct buffer_struct *buffer) {
+struct ssh_string_struct *buffer_get_mpint(struct ssh_buffer_struct *buffer) {
u16 bits;
u32 len;
- struct string_struct *str = NULL;
+ struct ssh_string_struct *str = NULL;
if (buffer_get_data(buffer, &bits, sizeof(u16)) != sizeof(u16)) {
return NULL;
diff --git a/libssh/keys.c b/libssh/keys.c
index c53559df..828a87d4 100644
--- a/libssh/keys.c
+++ b/libssh/keys.c
@@ -1100,10 +1100,10 @@ static STRING *RSA_do_sign(const unsigned char *payload, int len, RSA *privkey)
#ifndef _WIN32
STRING *ssh_do_sign_with_agent(struct ssh_session *session,
- struct buffer_struct *buf, struct public_key_struct *publickey) {
- struct buffer_struct *sigbuf = NULL;
- struct string_struct *signature = NULL;
- struct string_struct *session_id = NULL;
+ struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey) {
+ struct ssh_buffer_struct *sigbuf = NULL;
+ struct ssh_string_struct *signature = NULL;
+ struct ssh_string_struct *session_id = NULL;
struct ssh_crypto_struct *crypto = NULL;
if (session->current_crypto) {
diff --git a/libssh/messages.c b/libssh/messages.c
index d67f9982..8bcb918d 100644
--- a/libssh/messages.c
+++ b/libssh/messages.c
@@ -92,7 +92,7 @@ static int ssh_message_service_request_reply_default(SSH_MESSAGE *msg) {
return ssh_message_service_reply_success(msg);
}
int ssh_message_service_reply_success(SSH_MESSAGE *msg) {
- struct string_struct *service;
+ struct ssh_string_struct *service;
SSH_SESSION *session=msg->session;
if (msg == NULL) {
return SSH_ERROR;
diff --git a/libssh/string.c b/libssh/string.c
index 9fb6c3a0..933d32c8 100644
--- a/libssh/string.c
+++ b/libssh/string.c
@@ -42,8 +42,8 @@
* \param size size of the string
* \return the newly allocated string
*/
-struct string_struct *string_new(size_t size) {
- struct string_struct *str = NULL;
+struct ssh_string_struct *string_new(size_t size) {
+ struct ssh_string_struct *str = NULL;
str = malloc(size + 4);
if (str == NULL) {
@@ -65,7 +65,7 @@ struct string_struct *string_new(size_t size) {
*
* @return 0 on success, < 0 on error.
*/
-int string_fill(struct string_struct *s, const void *data, size_t len) {
+int string_fill(struct ssh_string_struct *s, const void *data, size_t len) {
if ((s == NULL) || (data == NULL) ||
(len == 0) || (len > s->size)) {
return -1;
@@ -81,8 +81,8 @@ int string_fill(struct string_struct *s, const void *data, size_t len) {
* \return the newly allocated string.
* \warning The nul byte is not copied nor counted in the ouput string.
*/
-struct string_struct *string_from_char(const char *what) {
- struct string_struct *ptr = NULL;
+struct ssh_string_struct *string_from_char(const char *what) {
+ struct ssh_string_struct *ptr = NULL;
size_t len = strlen(what);
ptr = malloc(4 + len);
@@ -100,7 +100,7 @@ struct string_struct *string_from_char(const char *what) {
* \param str the input SSH string
* \return size of the content of str, 0 on error
*/
-size_t string_len(struct string_struct *s) {
+size_t string_len(struct ssh_string_struct *s) {
if (s == NULL) {
return ntohl(0);
}
@@ -115,7 +115,7 @@ size_t string_len(struct string_struct *s) {
* \warning If the input SSH string contains zeroes, some parts of
* the output string may not be readable with regular libc functions.
*/
-char *string_to_char(struct string_struct *s) {
+char *string_to_char(struct ssh_string_struct *s) {
size_t len = ntohl(s->size) + 1;
char *new = malloc(len);
@@ -135,8 +135,8 @@ char *string_to_char(struct string_struct *s) {
*
* @return Newly allocated copy of the string, NULL on error.
*/
-struct string_struct *string_copy(struct string_struct *s) {
- struct string_struct *new = malloc(ntohl(s->size) + 4);
+struct ssh_string_struct *string_copy(struct ssh_string_struct *s) {
+ struct ssh_string_struct *new = malloc(ntohl(s->size) + 4);
if (new == NULL) {
return NULL;
@@ -150,7 +150,7 @@ struct string_struct *string_copy(struct string_struct *s) {
/** \brief destroy data in a string so it couldn't appear in a core dump
* \param s string to burn
*/
-void string_burn(struct string_struct *s) {
+void string_burn(struct ssh_string_struct *s) {
if (s == NULL) {
return;
}
@@ -164,7 +164,7 @@ void string_burn(struct string_struct *s) {
*
* @return Return the data of the string or NULL on error.
*/
-void *string_data(struct string_struct *s) {
+void *string_data(struct ssh_string_struct *s) {
if (s == NULL) {
return NULL;
}
@@ -176,7 +176,7 @@ void *string_data(struct string_struct *s) {
* \brief deallocate a STRING object
* \param s String to delete
*/
-void string_free(struct string_struct *s) {
+void string_free(struct ssh_string_struct *s) {
SAFE_FREE(s);
}