Initiate agent forwarding if supported.

This commit is contained in:
Michael Jumper 2013-12-02 02:00:37 -08:00
parent 755c677304
commit a2921825b7
2 changed files with 14 additions and 1 deletions

View File

@ -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@

View File

@ -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) {