1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

Fix several build warnings.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@214 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-02-02 16:09:38 +00:00
parent 5e03a95a93
commit 974a160fd3
10 changed files with 34 additions and 28 deletions

View File

@@ -271,7 +271,7 @@ SSH_SESSION *channel_get_session(CHANNEL *channel);
typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len, typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len,
int echo, int verify, void *userdata); int echo, int verify, void *userdata);
SSH_OPTIONS *ssh_options_new(); SSH_OPTIONS *ssh_options_new(void);
SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt); SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt);
int ssh_options_set_wanted_algos(SSH_OPTIONS *opt, int algo, const char *list); int ssh_options_set_wanted_algos(SSH_OPTIONS *opt, int algo, const char *list);
void ssh_options_set_username(SSH_OPTIONS *opt, const char *username); void ssh_options_set_username(SSH_OPTIONS *opt, const char *username);
@@ -290,6 +290,7 @@ void ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow); void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow);
void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey); void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);
void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey); void ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey);
void ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner);
void ssh_options_set_log_function(SSH_OPTIONS *opt, void ssh_options_set_log_function(SSH_OPTIONS *opt,
void (*callback)(const char *message, SSH_SESSION *session, int verbosity )); void (*callback)(const char *message, SSH_SESSION *session, int verbosity ));
void ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity); void ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity);
@@ -339,7 +340,8 @@ void ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int i, const c
/* init.c */ /* init.c */
int ssh_finalize(); int ssh_finalize(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -633,7 +633,7 @@ int ssh_userauth1_password(SSH_SESSION *session, char *username,
char *password); char *password);
/* in misc.c */ /* in misc.c */
/* gets the user home dir. */ /* gets the user home dir. */
char *ssh_get_user_home_dir(); char *ssh_get_user_home_dir(void);
int ssh_file_readaccess_ok(char *file); int ssh_file_readaccess_ok(char *file);
/* macro for byte ordering */ /* macro for byte ordering */

View File

@@ -33,7 +33,7 @@ MA 02111-1307, USA. */
* \brief finalize and cleanup all libssh and cryptographic data structures * \brief finalize and cleanup all libssh and cryptographic data structures
* \returns 0 * \returns 0
*/ */
int ssh_finalize() int ssh_finalize(void)
{ {
ssh_crypto_finalize(); ssh_crypto_finalize();
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT

View File

@@ -348,7 +348,7 @@ static int modulus_smaller(PUBLIC_KEY *k1, PUBLIC_KEY *k2){
} }
#define ABS(A) ( (A)<0 ? -(A):(A) ) #define ABS(A) ( (A)<0 ? -(A):(A) )
STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey, static STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey,
PUBLIC_KEY *hostkey,int slen, int hlen ){ PUBLIC_KEY *hostkey,int slen, int hlen ){
unsigned char buffer[32]; unsigned char buffer[32];
int i; int i;

View File

@@ -466,6 +466,9 @@ int read_dsa_privatekey(FILE *fp, gcry_sexp_t *r, ssh_auth_callback cb, void *us
static int pem_get_password(char *buf, int size, int rwflag, void *userdata) { static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
SSH_SESSION *session = userdata; SSH_SESSION *session = userdata;
/* unused flag */
(void) rwflag;
ZERO_STRUCTP(buf); ZERO_STRUCTP(buf);
if (session && session->options->auth_function) { if (session && session->options->auth_function) {

View File

@@ -360,7 +360,7 @@ STRING *publickey_to_string(PUBLIC_KEY *key){
/* Signature decoding functions */ /* Signature decoding functions */
STRING *signature_to_string(SIGNATURE *sign){ static STRING *signature_to_string(SIGNATURE *sign){
STRING *str; STRING *str;
STRING *rs; STRING *rs;
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
@@ -692,6 +692,10 @@ STRING *ssh_encrypt_rsa1(SSH_SESSION *session, STRING *data, PUBLIC_KEY *key){
RSA_public_encrypt(len,data->string,ret->string,key->rsa_pub, RSA_public_encrypt(len,data->string,ret->string,key->rsa_pub,
RSA_PKCS1_PADDING); RSA_PKCS1_PADDING);
#endif #endif
/* unused member variable */
(void) session;
return ret; return ret;
} }

View File

@@ -43,9 +43,7 @@
* and * as wildcards), and zero if it does not match. * and * as wildcards), and zero if it does not match.
*/ */
int static int match_pattern(const char *s, const char *pattern) {
match_pattern(const char *s, const char *pattern)
{
for (;;) { for (;;) {
/* If at end of pattern, accept if also at end of string. */ /* If at end of pattern, accept if also at end of string. */
if (!*pattern) if (!*pattern)
@@ -108,10 +106,8 @@ match_pattern(const char *s, const char *pattern)
* a positive match, 0 if there is no match at all. * a positive match, 0 if there is no match at all.
*/ */
int static int match_pattern_list(const char *string, const char *pattern,
match_pattern_list(const char *string, const char *pattern, u_int len, u_int len, int dolower) {
int dolower)
{
char sub[1024]; char sub[1024];
int negated; int negated;
int got_positive; int got_positive;
@@ -168,8 +164,6 @@ match_pattern_list(const char *string, const char *pattern, u_int len,
* indicate negation). Returns -1 if negation matches, 1 if there is * indicate negation). Returns -1 if negation matches, 1 if there is
* a positive match, 0 if there is no match at all. * a positive match, 0 if there is no match at all.
*/ */
int static int match_hostname(const char *host, const char *pattern, u_int len) {
match_hostname(const char *host, const char *pattern, u_int len)
{
return match_pattern_list(host, pattern, len, 1); return match_pattern_list(host, pattern, len, 1);
} }

View File

@@ -169,11 +169,13 @@ int ssh_message_auth_reply_success(SSH_MESSAGE *msg,int partial){
} }
static SSH_MESSAGE *handle_channel_request_open(SSH_SESSION *session){ static SSH_MESSAGE *handle_channel_request_open(SSH_SESSION *session){
enter_function(); SSH_MESSAGE *msg;
SSH_MESSAGE *msg=message_new(session);
STRING *type; STRING *type;
char *type_c; char *type_c;
u32 sender, window, packet; u32 sender, window, packet;
enter_function();
msg=message_new(session);
msg->type=SSH_CHANNEL_REQUEST_OPEN; msg->type=SSH_CHANNEL_REQUEST_OPEN;
type=buffer_get_ssh_string(session->in_buffer); type=buffer_get_ssh_string(session->in_buffer);
type_c=string_to_char(type); type_c=string_to_char(type);
@@ -199,8 +201,10 @@ static SSH_MESSAGE *handle_channel_request_open(SSH_SESSION *session){
CHANNEL *ssh_message_channel_request_open_reply_accept(SSH_MESSAGE *msg){ CHANNEL *ssh_message_channel_request_open_reply_accept(SSH_MESSAGE *msg){
SSH_SESSION *session=msg->session; SSH_SESSION *session=msg->session;
CHANNEL *chan;
enter_function(); enter_function();
CHANNEL *chan=channel_new(session); chan=channel_new(session);
chan->local_channel=ssh_channel_new_id(session); chan->local_channel=ssh_channel_new_id(session);
chan->local_maxpacket=35000; chan->local_maxpacket=35000;
chan->local_window=32000; chan->local_window=32000;

View File

@@ -36,10 +36,10 @@ MA 02111-1307, USA. */
#include <pwd.h> #include <pwd.h>
#endif #endif
#include "libssh/libssh.h" #include "libssh/priv.h"
#ifndef _WIN32 #ifndef _WIN32
char *ssh_get_user_home_dir(){ char *ssh_get_user_home_dir(void) {
static char szPath[PATH_MAX] = {0}; static char szPath[PATH_MAX] = {0};
struct passwd *pwd = NULL; struct passwd *pwd = NULL;
@@ -55,7 +55,7 @@ char *ssh_get_user_home_dir(){
#else /* _WIN32 */ #else /* _WIN32 */
char *ssh_get_user_home_dir(){ char *ssh_get_user_home_dir(void) {
static char szPath[MAX_PATH]; static char szPath[MAX_PATH];
if (SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, TRUE)) if (SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, TRUE))
return szPath; return szPath;
@@ -72,7 +72,6 @@ int ssh_file_readaccess_ok(char *file){
return 0; return 0;
} }
u64 ntohll(u64 a){ u64 ntohll(u64 a){
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
return a; return a;

View File

@@ -45,7 +45,7 @@ MA 02111-1307, USA. */
* \see ssh_options_getopt() * \see ssh_options_getopt()
*/ */
SSH_OPTIONS *ssh_options_new(){ SSH_OPTIONS *ssh_options_new(void) {
SSH_OPTIONS *option=malloc(sizeof(SSH_OPTIONS)); SSH_OPTIONS *option=malloc(sizeof(SSH_OPTIONS));
memset(option,0,sizeof(SSH_OPTIONS)); memset(option,0,sizeof(SSH_OPTIONS));
option->port=22; /* set the default port */ option->port=22; /* set the default port */