From a2921825b76dd141bc3a8c2104090d228212ba60 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 2 Dec 2013 02:00:37 -0800 Subject: [PATCH] Initiate agent forwarding if supported. --- src/protocols/ssh/Makefile.am | 2 +- src/protocols/ssh/ssh_client.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/protocols/ssh/Makefile.am b/src/protocols/ssh/Makefile.am index 952c109d..7ba1114b 100644 --- a/src/protocols/ssh/Makefile.am +++ b/src/protocols/ssh/Makefile.am @@ -81,7 +81,7 @@ libguac_client_ssh_la_SOURCES += ssh_agent.c noinst_HEADERS += ssh_agent.h endif -libguac_client_ssh_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ @LIBGUAC_INCLUDE@ +libguac_client_ssh_la_CFLAGS = -Werror -Wall -Iinclude @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ @LIBGUAC_INCLUDE@ libguac_client_ssh_la_LIBADD = @LIBGUAC_LTLIB@ libguac_client_ssh_la_LDFLAGS = -version-info 0:0:0 @SSH_LIBS@ @SSL_LIBS@ @PTHREAD_LIBS@ @PANGO_LIBS@ @PANGOCAIRO_LIBS@ @CAIRO_LIBS@ diff --git a/src/protocols/ssh/ssh_client.c b/src/protocols/ssh/ssh_client.c index 6dd0d62d..f4fbfb31 100644 --- a/src/protocols/ssh/ssh_client.c +++ b/src/protocols/ssh/ssh_client.c @@ -59,6 +59,10 @@ #include "sftp.h" #include "ssh_key.h" +#ifdef ENABLE_SSH_AGENT +#include "ssh_agent.h" +#endif + /** * Reads a single line from STDIN. */ @@ -367,6 +371,15 @@ void* ssh_client_thread(void* data) { return NULL; } +#ifdef ENABLE_SSH_AGENT + libssh2_session_callback_set(client_data->session, + LIBSSH2_CALLBACK_AUTH_AGENT, (void*) ssh_auth_agent_callback); + + /* Request agent forwarding */ + if (libssh2_channel_request_auth_agent(client_data->term_channel)) + guac_client_log_error(client, "Agent forwarding request failed"); +#endif + /* Start SFTP session as well, if enabled */ if (client_data->enable_sftp) {