1
1

Fixed namespace problem in public structures

changed
struct string_struct to ssh_string_struct
buffer_struct to ssh_buffer_struct
and so on.

Should not break apps using the caps version of these
Этот коммит содержится в:
Aris Adamantiadis 2009-07-24 20:49:46 +02:00
родитель 9450a3c987
Коммит e776dc16c9
8 изменённых файлов: 82 добавлений и 82 удалений

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

@ -71,13 +71,13 @@ typedef unsigned long long uint64_t;
extern "C" {
#endif
typedef struct string_struct STRING;
typedef struct buffer_struct BUFFER;
typedef struct public_key_struct PUBLIC_KEY;
typedef struct private_key_struct PRIVATE_KEY;
typedef struct ssh_string_struct STRING;
typedef struct ssh_buffer_struct BUFFER;
typedef struct ssh_public_key_struct PUBLIC_KEY;
typedef struct ssh_private_key_struct PRIVATE_KEY;
typedef struct ssh_options_struct SSH_OPTIONS;
typedef struct channel_struct CHANNEL;
typedef struct agent_struct AGENT;
typedef struct ssh_channel_struct CHANNEL;
typedef struct ssh_agent_struct AGENT;
typedef struct ssh_session SSH_SESSION;
typedef struct ssh_kbdint SSH_KBDINT;
struct keys_struct;

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

@ -172,7 +172,7 @@ void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len);
/* strings and buffers */
/* must be 32 bits number + immediatly our data */
struct string_struct {
struct ssh_string_struct {
u32 size;
unsigned char string[MAX_PACKET_LEN];
}
@ -183,7 +183,7 @@ __attribute__ ((packed))
/** Describes a buffer state at a moment
*/
struct buffer_struct {
struct ssh_buffer_struct {
char *data;
u32 used;
u32 allocated;
@ -202,7 +202,7 @@ typedef struct kex_struct {
char **methods;
} KEX;
struct public_key_struct {
struct ssh_public_key_struct {
int type;
const char *type_c; /* Don't free it ! it is static */
#ifdef HAVE_LIBGCRYPT
@ -214,7 +214,7 @@ struct public_key_struct {
#endif
};
struct private_key_struct {
struct ssh_private_key_struct {
int type;
#ifdef HAVE_LIBGCRYPT
gcry_sexp_t dsa_priv;
@ -295,9 +295,9 @@ typedef struct ssh_crypto_struct {
void *compress_in_ctx; /* really, don't */
} CRYPTO;
struct channel_struct {
struct channel_struct *prev;
struct channel_struct *next;
struct ssh_channel_struct {
struct ssh_channel_struct *prev;
struct ssh_channel_struct *next;
SSH_SESSION *session; /* SSH_SESSION pointer */
u32 local_channel;
u32 local_window;
@ -318,7 +318,7 @@ struct channel_struct {
int exit_status;
};
struct agent_struct {
struct ssh_agent_struct {
struct socket *sock;
BUFFER *ident;
unsigned int count;
@ -476,16 +476,16 @@ struct ssh_message {
*
* @return An allocated ssh agent structure or NULL on error.
*/
struct agent_struct *agent_new(struct ssh_session *session);
struct ssh_agent_struct *agent_new(struct ssh_session *session);
void agent_close(struct agent_struct *agent);
void agent_close(struct ssh_agent_struct *agent);
/**
* @brief Free an allocated ssh agent structure.
*
* @param agent The ssh agent structure to free.
*/
void agent_free(struct agent_struct *agent);
void agent_free(struct ssh_agent_struct *agent);
/**
* @brief Check if the ssh agent is running.
@ -498,15 +498,15 @@ int agent_is_running(struct ssh_session *session);
int agent_get_ident_count(struct ssh_session *session);
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 *agent_get_first_ident(struct ssh_session *session,
struct ssh_public_key_struct *agent_get_first_ident(struct ssh_session *session,
char **comment);
STRING *agent_sign_data(struct ssh_session *session,
struct buffer_struct *data,
struct public_key_struct *pubkey);
struct ssh_buffer_struct *data,
struct ssh_public_key_struct *pubkey);
#endif
/* poll.c */
@ -668,7 +668,7 @@ PUBLIC_KEY *publickey_from_string(SSH_SESSION *session, STRING *pubkey_s);
SIGNATURE *signature_from_string(SSH_SESSION *session, STRING *signature,PUBLIC_KEY *pubkey,int needed_type);
void signature_free(SIGNATURE *sign);
STRING *ssh_do_sign_with_agent(struct ssh_session *session,
struct buffer_struct *buf, struct public_key_struct *publickey);
struct ssh_buffer_struct *buf, struct ssh_public_key_struct *publickey);
STRING *ssh_do_sign(SSH_SESSION *session,BUFFER *sigbuf,
PRIVATE_KEY *privatekey);
STRING *ssh_sign_session_id(SSH_SESSION *session, PRIVATE_KEY *privatekey);

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

@ -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;

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

@ -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;

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

@ -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;

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

@ -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) {

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

@ -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;

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

@ -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);
}