aboutsummaryrefslogtreecommitdiffstats
path: root/extcap/ssh-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'extcap/ssh-base.c')
-rw-r--r--extcap/ssh-base.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c
index d67ef91fef..75d1572a0f 100644
--- a/extcap/ssh-base.c
+++ b/extcap/ssh-base.c
@@ -17,6 +17,13 @@
#include <extcap/extcap-base.h>
#include <log.h>
#include <string.h>
+#include <libssh/callbacks.h>
+#include <ws_attributes.h>
+
+void extcap_log(int priority _U_, const char *function, const char *buffer, void *userdata _U_)
+{
+ g_debug("[%s] %s", function, buffer);
+}
ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info)
{
@@ -48,6 +55,12 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf
goto failure;
}
+ if (ssh_params->debug) {
+ int debug_level = SSH_LOG_INFO;
+ ssh_options_set(sshs, SSH_OPTIONS_LOG_VERBOSITY, &debug_level);
+ ssh_set_log_callback(extcap_log);
+ }
+
if (ssh_params->port != 0) {
port = ssh_params->port;
if (ssh_options_set(sshs, SSH_OPTIONS_PORT, &port)) {