diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-09-23 23:51:04 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-09-23 23:51:04 +0200 |
commit | f84ebc2e2770b16b43c62ecb67cf8d4bd1b99d72 (patch) | |
tree | 82abdf7a1e84c9a281f622e38247e67563d68ffa /libssh | |
parent | b359229a2ea6f8b623add9bea02015991c8d6e9d (diff) | |
download | libssh-f84ebc2e2770b16b43c62ecb67cf8d4bd1b99d72.tar.gz libssh-f84ebc2e2770b16b43c62ecb67cf8d4bd1b99d72.tar.xz libssh-f84ebc2e2770b16b43c62ecb67cf8d4bd1b99d72.zip |
Moved lots of declaration out of priv.h
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/agent.c | 3 | ||||
-rw-r--r-- | libssh/auth.c | 5 | ||||
-rw-r--r-- | libssh/auth1.c | 4 | ||||
-rw-r--r-- | libssh/base64.c | 1 | ||||
-rw-r--r-- | libssh/buffer.c | 8 | ||||
-rw-r--r-- | libssh/channels.c | 7 | ||||
-rw-r--r-- | libssh/channels1.c | 6 | ||||
-rw-r--r-- | libssh/client.c | 4 | ||||
-rw-r--r-- | libssh/connect.c | 3 | ||||
-rw-r--r-- | libssh/crypt.c | 1 | ||||
-rw-r--r-- | libssh/dh.c | 7 | ||||
-rw-r--r-- | libssh/gzip.c | 2 | ||||
-rw-r--r-- | libssh/init.c | 2 | ||||
-rw-r--r-- | libssh/kex.c | 9 | ||||
-rw-r--r-- | libssh/keyfiles.c | 6 | ||||
-rw-r--r-- | libssh/keys.c | 17 | ||||
-rw-r--r-- | libssh/log.c | 1 | ||||
-rw-r--r-- | libssh/messages.c | 5 | ||||
-rw-r--r-- | libssh/packet.c | 5 | ||||
-rw-r--r-- | libssh/poll.c | 1 | ||||
-rw-r--r-- | libssh/scp.c | 1 | ||||
-rw-r--r-- | libssh/server.c | 6 | ||||
-rw-r--r-- | libssh/session.c | 5 | ||||
-rw-r--r-- | libssh/sftp.c | 7 | ||||
-rw-r--r-- | libssh/sftpserver.c | 5 | ||||
-rw-r--r-- | libssh/socket.c | 4 | ||||
-rw-r--r-- | libssh/string.c | 2 | ||||
-rw-r--r-- | libssh/wrapper.c | 1 |
28 files changed, 104 insertions, 24 deletions
diff --git a/libssh/agent.c b/libssh/agent.c index 81233c1..1f425b6 100644 --- a/libssh/agent.c +++ b/libssh/agent.c @@ -50,6 +50,9 @@ #include "libssh/agent.h" #include "libssh/priv.h" +#include "libssh/socket.h" +#include "libssh/buffer.h" +#include "libssh/session.h" /* macro to check for "agent failure" message */ #define agent_failed(x) \ diff --git a/libssh/auth.c b/libssh/auth.c index 8dc17f8..e16f344 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -32,6 +32,11 @@ #include "libssh/priv.h" #include "libssh/ssh2.h" +#include "libssh/buffer.h" +#include "libssh/agent.h" +#include "libssh/keyfiles.h" +#include "libssh/packet.h" +#include "libssh/session.h" /** \defgroup ssh_auth SSH Authentication functions * \brief functions to authenticate to servers diff --git a/libssh/auth1.c b/libssh/auth1.c index 8a3f819..83f0e69 100644 --- a/libssh/auth1.c +++ b/libssh/auth1.c @@ -26,6 +26,10 @@ #include "libssh/priv.h" #include "libssh/ssh1.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/session.h" +#include "libssh/string.h" #ifdef WITH_SSH1 static int wait_auth1_status(ssh_session session) { diff --git a/libssh/base64.c b/libssh/base64.c index f4d64fb..5f4f440 100644 --- a/libssh/base64.c +++ b/libssh/base64.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include "libssh/priv.h" +#include "libssh/buffer.h" static char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" diff --git a/libssh/buffer.c b/libssh/buffer.c index 2f450b5..a24dc68 100644 --- a/libssh/buffer.c +++ b/libssh/buffer.c @@ -29,7 +29,7 @@ #endif #include "libssh/priv.h" - +#include "libssh/buffer.h" /** \defgroup ssh_buffer SSH Buffers * \brief buffer handling */ @@ -167,7 +167,7 @@ int buffer_add_ssh_string(struct ssh_buffer_struct *buffer, struct ssh_string_struct *string) { uint32_t len = 0; - len = ntohl(string->size); + len = string_len(string); if (buffer_add_data(buffer, string, len + sizeof(uint32_t)) < 0) { return -1; } @@ -404,7 +404,7 @@ struct ssh_string_struct *buffer_get_ssh_string(struct ssh_buffer_struct *buffer if (str == NULL) { return NULL; } - if (buffer_get_data(buffer, str->string, hostlen) != hostlen) { + if (buffer_get_data(buffer, string_data(str), hostlen) != hostlen) { /* should never happen */ SAFE_FREE(str); return NULL; @@ -437,7 +437,7 @@ struct ssh_string_struct *buffer_get_mpint(struct ssh_buffer_struct *buffer) { if (str == NULL) { return NULL; } - if (buffer_get_data(buffer, str->string, len) != len) { + if (buffer_get_data(buffer, string_data(str), len) != len) { SAFE_FREE(str); return NULL; } diff --git a/libssh/channels.c b/libssh/channels.c index 9910370..cb7e543 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -34,6 +34,11 @@ #include "libssh/priv.h" #include "libssh/ssh2.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/socket.h" +#include "libssh/channels.h" +#include "libssh/session.h" #define WINDOWBASE 128000 #define WINDOWLIMIT (WINDOWBASE/2) @@ -384,7 +389,7 @@ static void channel_rcv_data(ssh_session session,int is_stderr) { channel->local_window); } - if (channel_default_bufferize(channel, str->string, len, + if (channel_default_bufferize(channel, string_data(str), len, is_stderr) < 0) { string_free(str); leave_function(); diff --git a/libssh/channels1.c b/libssh/channels1.c index 5285f17..daa851c 100644 --- a/libssh/channels1.c +++ b/libssh/channels1.c @@ -28,6 +28,10 @@ #include <stdio.h> #include "libssh/priv.h" #include "libssh/ssh1.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/channels.h" +#include "libssh/session.h" #ifdef WITH_SSH1 @@ -218,7 +222,7 @@ static int channel_rcv_data1(ssh_session session, int is_stderr) { "Adding %zu bytes data in %d", string_len(str), is_stderr); - if (channel_default_bufferize(channel, str->string, string_len(str), + if (channel_default_bufferize(channel, string_data(str), string_len(str), is_stderr) < 0) { string_free(str); return -1; diff --git a/libssh/client.c b/libssh/client.c index 5844095..1c69e15 100644 --- a/libssh/client.c +++ b/libssh/client.c @@ -31,6 +31,10 @@ #include "libssh/priv.h" #include "libssh/ssh2.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/socket.h" +#include "libssh/session.h" #define set_status(opt,status) do {\ if (opt->callbacks && opt->callbacks->connect_status_function) \ diff --git a/libssh/connect.c b/libssh/connect.c index df9c0eb..977dfac 100644 --- a/libssh/connect.c +++ b/libssh/connect.c @@ -64,6 +64,9 @@ #endif /* _WIN32 */ #include "libssh/priv.h" +#include "libssh/socket.h" +#include "libssh/channels.h" +#include "libssh/session.h" #ifndef HAVE_SELECT #error "Your system must have select()" diff --git a/libssh/crypt.c b/libssh/crypt.c index d353772..498a5ea 100644 --- a/libssh/crypt.c +++ b/libssh/crypt.c @@ -37,6 +37,7 @@ #include "libssh/priv.h" #include "libssh/crypto.h" +#include "libssh/session.h" uint32_t packet_decrypt_len(ssh_session session, char *crypted){ uint32_t decrypted; diff --git a/libssh/dh.c b/libssh/dh.c index 3290e0b..c1845d7 100644 --- a/libssh/dh.c +++ b/libssh/dh.c @@ -50,7 +50,10 @@ #include "libssh/priv.h" #include "libssh/crypto.h" - +#include "libssh/buffer.h" +#include "libssh/session.h" +/* todo: remove it */ +#include "libssh/string.h" #ifdef HAVE_LIBCRYPTO #include <openssl/rand.h> #include <openssl/evp.h> @@ -340,7 +343,7 @@ ssh_string make_bignum_string(bignum num) { #ifdef DEBUG_CRYPTO fprintf(stderr, "%d bits, %d bytes, %d padding\n", bits, len, pad); #endif /* DEBUG_CRYPTO */ - +/* TODO: fix that crap !! */ ptr = malloc(4 + len + pad); if (ptr == NULL) { return NULL; diff --git a/libssh/gzip.c b/libssh/gzip.c index 000e777..c9b0545 100644 --- a/libssh/gzip.c +++ b/libssh/gzip.c @@ -24,6 +24,8 @@ #include "config.h" #include "libssh/priv.h" +#include "libssh/buffer.h" +#include "libssh/session.h" #if defined(HAVE_LIBZ) && defined(WITH_LIBZ) diff --git a/libssh/init.c b/libssh/init.c index 2df3f5d..9928820 100644 --- a/libssh/init.c +++ b/libssh/init.c @@ -22,6 +22,8 @@ */ #include "libssh/priv.h" +#include "libssh/socket.h" + #ifdef _WIN32 #include <winsock2.h> #endif diff --git a/libssh/kex.c b/libssh/kex.c index 95468c4..ad2acc4 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -33,6 +33,9 @@ #include "libssh/priv.h" #include "libssh/ssh2.h" #include "libssh/ssh1.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/session.h" #ifdef HAVE_LIBGCRYPT #define BLOWFISH "blowfish-cbc," @@ -488,8 +491,8 @@ static int build_session_id1(ssh_session session, ssh_string servern, ssh_print_hexa("host modulus",hostn->string,string_len(hostn)); ssh_print_hexa("server modulus",servern->string,string_len(servern)); #endif - md5_update(md5,hostn->string,string_len(hostn)); - md5_update(md5,servern->string,string_len(servern)); + md5_update(md5,string_data(hostn),string_len(hostn)); + md5_update(md5,string_data(servern),string_len(servern)); md5_update(md5,session->server_kex.cookie,8); md5_final(session->next_crypto->session_id,md5); #ifdef DEBUG_CRYPTO @@ -741,7 +744,7 @@ int ssh_get_kex1(ssh_session session) { if (buffer_add_data(session->out_buffer, &bits, sizeof(uint16_t)) < 0) { goto error; } - if (buffer_add_data(session->out_buffer, enc_session->string, + if (buffer_add_data(session->out_buffer, string_data(enc_session), string_len(enc_session)) < 0) { goto error; } diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index c292d5d..2a197aa 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -36,6 +36,11 @@ #endif #include "libssh/priv.h" +#include "libssh/buffer.h" +#include "libssh/keyfiles.h" +#include "libssh/session.h" +/*todo: remove this include */ +#include "libssh/string.h" #ifdef HAVE_LIBGCRYPT #include <gcrypt.h> @@ -1194,6 +1199,7 @@ static int check_public_key(ssh_session session, char **tokens) { bignum_free(tmpbn); return -1; } + /* TODO: fix the hardcoding */ tmpstring->size = htonl(len); #ifdef HAVE_LIBGCRYPT bignum_bn2bin(tmpbn, len, tmpstring->string); diff --git a/libssh/keys.c b/libssh/keys.c index 8df0b05..8ffa439 100644 --- a/libssh/keys.c +++ b/libssh/keys.c @@ -30,6 +30,9 @@ #include "libssh/priv.h" #include "libssh/ssh2.h" #include "libssh/server.h" +#include "libssh/buffer.h" +#include "libssh/agent.h" +#include "libssh/session.h" /** \addtogroup ssh_auth * @{ @@ -258,7 +261,7 @@ ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s) { return NULL; } - if (buffer_add_data(tmpbuf, pubkey_s->string, string_len(pubkey_s)) < 0) { + if (buffer_add_data(tmpbuf, string_data(pubkey_s), string_len(pubkey_s)) < 0) { goto error; } @@ -778,8 +781,8 @@ static ssh_string signature_to_string(SIGNATURE *sign) { return NULL; } - memcpy(buffer, r->string + string_len(r) - 20, 20); - memcpy(buffer + 20, s->string + string_len(s) - 20, 20); + memcpy(buffer, (char *)string_data(r) + string_len(r) - 20, 20); + memcpy(buffer + 20, (char *)string_data(s) + string_len(s) - 20, 20); string_free(r); string_free(s); @@ -879,7 +882,7 @@ SIGNATURE *signature_from_string(ssh_session session, ssh_string signature, return NULL; } - if (buffer_add_data(tmpbuf, signature->string, string_len(signature)) < 0) { + if (buffer_add_data(tmpbuf, string_data(signature), string_len(signature)) < 0) { signature_free(sign); buffer_free(tmpbuf); return NULL; @@ -943,8 +946,8 @@ SIGNATURE *signature_from_string(ssh_session session, ssh_string signature, return NULL; } - string_fill(r, rs->string, 20); - string_fill(s, rs->string + 20, 20); + string_fill(r, string_data(rs), 20); + string_fill(s, (char *)string_data(rs) + 20, 20); sig = DSA_SIG_new(); if (sig == NULL) { @@ -1368,7 +1371,7 @@ ssh_string ssh_encrypt_rsa1(ssh_session session, ssh_string data, ssh_public_key return NULL; } - if (RSA_public_encrypt(len, data->string, str->string, key->rsa_pub, + if (RSA_public_encrypt(len, string_data(data), string_data(str), key->rsa_pub, RSA_PKCS1_PADDING) < 0) { string_free(str); return NULL; diff --git a/libssh/log.c b/libssh/log.c index fb2d666..2e1c0db 100644 --- a/libssh/log.c +++ b/libssh/log.c @@ -26,6 +26,7 @@ #include <string.h> #include "libssh/priv.h" +#include "libssh/session.h" /** * @defgroup ssh_log SSH Logging diff --git a/libssh/messages.c b/libssh/messages.c index 22d150f..1cf6e5e 100644 --- a/libssh/messages.c +++ b/libssh/messages.c @@ -42,7 +42,10 @@ #include "libssh/libssh.h" #include "libssh/priv.h" #include "libssh/ssh2.h" - +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/channels.h" +#include "libssh/session.h" static ssh_message message_new(ssh_session session){ ssh_message msg = malloc(sizeof(struct ssh_message_struct)); diff --git a/libssh/packet.c b/libssh/packet.c index d52c542..7c7178c 100644 --- a/libssh/packet.c +++ b/libssh/packet.c @@ -35,6 +35,11 @@ #include "libssh/ssh2.h" #include "libssh/ssh1.h" #include "libssh/crypto.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/socket.h" +#include "libssh/channels.h" +#include "libssh/session.h" /* XXX include selected mac size */ static int macsize=SHA_DIGEST_LEN; diff --git a/libssh/poll.c b/libssh/poll.c index ee45e5e..023a488 100644 --- a/libssh/poll.c +++ b/libssh/poll.c @@ -31,6 +31,7 @@ #include "config.h" #include "libssh/priv.h" #include "libssh/libssh.h" +#include "libssh/poll.h" #ifndef SSH_POLL_CTX_CHUNK #define SSH_POLL_CTX_CHUNK 5 diff --git a/libssh/scp.c b/libssh/scp.c index 2f800ef..54e60d8 100644 --- a/libssh/scp.c +++ b/libssh/scp.c @@ -25,6 +25,7 @@ #include <string.h> #include "libssh/priv.h" +#include "libssh/scp.h" /** @brief Creates a new scp session * @param session the SSH session to use diff --git a/libssh/server.c b/libssh/server.c index 3e37291..5a89c93 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -37,6 +37,12 @@ #include "libssh/libssh.h" #include "libssh/server.h" #include "libssh/ssh2.h" +#include "libssh/keyfiles.h" +#include "libssh/buffer.h" +#include "libssh/packet.h" +#include "libssh/socket.h" +#include "libssh/channels.h" +#include "libssh/session.h" #ifdef _WIN32 diff --git a/libssh/session.c b/libssh/session.c index 4c6a81e..5f48023 100644 --- a/libssh/session.c +++ b/libssh/session.c @@ -27,6 +27,11 @@ #include "libssh/priv.h" #include "libssh/server.h" #include "libssh/callback.h" +#include "libssh/socket.h" +#include "libssh/agent.h" +#include "libssh/packet.h" +#include "libssh/session.h" + #define FIRST_CHANNEL 42 // why not ? it helps to find bugs. /** \defgroup ssh_session SSH Session diff --git a/libssh/sftp.c b/libssh/sftp.c index 668ad6e..e0b082e 100644 --- a/libssh/sftp.c +++ b/libssh/sftp.c @@ -46,6 +46,9 @@ #include "libssh/priv.h" #include "libssh/ssh2.h" #include "libssh/sftp.h" +#include "libssh/buffer.h" +#include "libssh/channels.h" +#include "libssh/session.h" #ifdef WITH_SFTP @@ -1668,7 +1671,7 @@ ssize_t sftp_read(SFTP_FILE *handle, void *buf, size_t count) { } count = string_len(datastring); handle->offset += count; - memcpy(buf, datastring->string, count); + memcpy(buf, string_data(datastring), count); string_free(datastring); return count; default: @@ -1787,7 +1790,7 @@ int sftp_async_read(SFTP_FILE *file, void *data, uint32_t size, uint32_t id){ //handle->offset+=len; /* We already have set the offset previously. All we can do is warn that the expected len * and effective lengths are different */ - memcpy(data, datastring->string, len); + memcpy(data, string_data(datastring), len); string_free(datastring); sftp_leave_function(); return len; diff --git a/libssh/sftpserver.c b/libssh/sftpserver.c index 4d234e4..d42d0eb 100644 --- a/libssh/sftpserver.c +++ b/libssh/sftpserver.c @@ -33,6 +33,7 @@ #include "libssh/sftp.h" #include "libssh/ssh2.h" #include "libssh/priv.h" +#include "libssh/buffer.h" SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp) { SFTP_PACKET *packet; @@ -448,7 +449,7 @@ ssh_string sftp_handle_alloc(SFTP_SESSION *sftp, void *info) { return NULL; } - memcpy(ret->string, &val, sizeof(uint32_t)); + memcpy(string_data(ret), &val, sizeof(uint32_t)); sftp->handles[i] = info; return ret; @@ -465,7 +466,7 @@ void *sftp_handle(SFTP_SESSION *sftp, ssh_string handle){ return NULL; } - memcpy(&val, handle->string, sizeof(uint32_t)); + memcpy(&val, string_data(handle), sizeof(uint32_t)); if (val > SFTP_HANDLES) { return NULL; diff --git a/libssh/socket.c b/libssh/socket.c index 2011b48..933119f 100644 --- a/libssh/socket.c +++ b/libssh/socket.c @@ -34,6 +34,10 @@ #include <sys/un.h> #endif #include "libssh/priv.h" +#include "libssh/socket.h" +#include "libssh/buffer.h" +#include "libssh/poll.h" +#include "libssh/session.h" /** \defgroup ssh_socket SSH Sockets * \addtogroup ssh_socket diff --git a/libssh/string.c b/libssh/string.c index c952084..d06fab6 100644 --- a/libssh/string.c +++ b/libssh/string.c @@ -29,7 +29,7 @@ #endif #include "libssh/priv.h" - +#include "libssh/string.h" /** \defgroup ssh_string SSH Strings * \brief string manipulations */ diff --git a/libssh/wrapper.c b/libssh/wrapper.c index 4110c4e..f82ae3e 100644 --- a/libssh/wrapper.c +++ b/libssh/wrapper.c @@ -36,6 +36,7 @@ #include <string.h> #include "libssh/priv.h" +#include "libssh/session.h" #ifdef HAVE_LIBGCRYPT #include <gcrypt.h> |