diff options
| author | Aris Adamantiadis <aris@0xbadc0de.be> | 2011-07-19 22:16:28 +0200 |
|---|---|---|
| committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2011-07-19 22:16:28 +0200 |
| commit | da954c2c5ee85bcbe2f5ad9f507a6306b0f5f8b9 (patch) | |
| tree | b13cc18e78ff7a0549974b4823678f189fe82b6a /include/libssh | |
| parent | dc9ac022f5590272cc7a3dc18726802ffdc73c8f (diff) | |
| download | libssh-da954c2c5ee85bcbe2f5ad9f507a6306b0f5f8b9.tar.gz libssh-da954c2c5ee85bcbe2f5ad9f507a6306b0f5f8b9.tar.xz libssh-da954c2c5ee85bcbe2f5ad9f507a6306b0f5f8b9.zip | |
Fixes the ssh_log issue on ssh_bind handles.
Diffstat (limited to 'include/libssh')
| -rw-r--r-- | include/libssh/bind.h | 7 | ||||
| -rw-r--r-- | include/libssh/priv.h | 12 | ||||
| -rw-r--r-- | include/libssh/session.h | 13 |
3 files changed, 19 insertions, 13 deletions
diff --git a/include/libssh/bind.h b/include/libssh/bind.h index 705d2759..ef3a0e82 100644 --- a/include/libssh/bind.h +++ b/include/libssh/bind.h @@ -23,11 +23,10 @@ #define BIND_H_ #include "libssh/priv.h" +#include "libssh/session.h" struct ssh_bind_struct { - struct error_struct error; - - ssh_callbacks callbacks; /* Callbacks to user functions */ + struct ssh_common_struct common; /* stuff common to ssh_bind and ssh_session */ struct ssh_bind_callbacks_struct *bind_callbacks; void *bind_callbacks_userdata; @@ -40,8 +39,6 @@ struct ssh_bind_struct { char *bindaddr; socket_t bindfd; unsigned int bindport; - unsigned int log_verbosity; - int blocking; int toaccept; }; diff --git a/include/libssh/priv.h b/include/libssh/priv.h index de965f51..0859f4b9 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -141,6 +141,7 @@ struct ssh_keys_struct { }; struct ssh_message_struct; +struct ssh_common_struct; /* server data */ @@ -216,6 +217,9 @@ int match_hostname(const char *host, const char *pattern, unsigned int len); int message_handle(ssh_session session, void *user, uint8_t type, ssh_buffer packet); /* log.c */ +void ssh_log_common(struct ssh_common_struct *common, int verbosity, + const char *format, ...) PRINTF_ATTRIBUTE(3, 4); + /* misc.c */ #ifdef _WIN32 int gettimeofday(struct timeval *__p, void *__t); @@ -229,16 +233,16 @@ int gettimeofday(struct timeval *__p, void *__t); #define _enter_function(sess) \ do {\ - if((sess)->log_verbosity >= SSH_LOG_FUNCTIONS){ \ + if((sess)->common.log_verbosity >= SSH_LOG_FUNCTIONS){ \ ssh_log((sess),SSH_LOG_FUNCTIONS,"entering function %s line %d in " __FILE__ , __FUNCTION__,__LINE__);\ - (sess)->log_indent++; \ + (sess)->common.log_indent++; \ } \ } while(0) #define _leave_function(sess) \ do { \ - if((sess)->log_verbosity >= SSH_LOG_FUNCTIONS){ \ - (sess)->log_indent--; \ + if((sess)->common.log_verbosity >= SSH_LOG_FUNCTIONS){ \ + (sess)->common.log_indent--; \ ssh_log((sess),SSH_LOG_FUNCTIONS,"leaving function %s line %d in " __FILE__ , __FUNCTION__,__LINE__);\ }\ } while(0) diff --git a/include/libssh/session.h b/include/libssh/session.h index 2d4b05bc..3b79f428 100644 --- a/include/libssh/session.h +++ b/include/libssh/session.h @@ -62,8 +62,16 @@ enum ssh_pending_call_e { /* libssh calls may block an undefined amount of time */ #define SSH_SESSION_FLAG_BLOCKING 1 -struct ssh_session_struct { +/* members that are common to ssh_session and ssh_bind */ +struct ssh_common_struct { struct error_struct error; + ssh_callbacks callbacks; /* Callbacks to user functions */ + int log_verbosity; /* verbosity of the log functions */ + int log_indent; /* indentation level in enter_function logs */ +}; + +struct ssh_session_struct { + struct ssh_common_struct common; struct ssh_socket_struct *socket; char *serverbanner; char *clientbanner; @@ -129,11 +137,8 @@ struct ssh_session_struct { struct ssh_list *ssh_message_list; /* list of delayed SSH messages */ int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg, void *userdata); void *ssh_message_callback_data; - int log_verbosity; /*cached copy of the option structure */ - int log_indent; /* indentation level in enter_function logs */ void (*ssh_connection_callback)( struct ssh_session_struct *session); - ssh_callbacks callbacks; /* Callbacks to user functions */ struct ssh_packet_callbacks_struct default_packet_callbacks; struct ssh_list *packet_callbacks; struct ssh_socket_callbacks_struct socket_callbacks; |
