diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-10-13 18:45:55 +0200 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-12-15 15:08:35 +0100 |
commit | 3b3182685c54ea67d536062aecad2b5e15fdc551 (patch) | |
tree | 780319c7848dd648f7a7d9f9cd903f83d9a5421a | |
parent | 10157aecf3083b63bfe48e2bae071d6c59080c29 (diff) | |
download | virt-viewer-3b3182685c54ea67d536062aecad2b5e15fdc551.tar.gz virt-viewer-3b3182685c54ea67d536062aecad2b5e15fdc551.tar.xz virt-viewer-3b3182685c54ea67d536062aecad2b5e15fdc551.zip |
spice: enable/disable ssh-agent forward
Connect/disconnect ssh channel to enable/disable ssh-agent forward
-rw-r--r-- | src/virt-viewer-session-spice.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c index b9cae5e..c146e33 100644 --- a/src/virt-viewer-session-spice.c +++ b/src/virt-viewer-session-spice.c @@ -217,6 +217,36 @@ update_share_folder(VirtViewerSessionSpice *self) } static void +enable_ssh_agent_forward(VirtViewerSessionSpice *self) +{ + gboolean enable; + SpiceSession *session = self->priv->session; + GList *l, *channels; + + /** + * FIXME: + * Also check if the channel is secure. + **/ + + g_object_get(self, "forward-ssh-agent", &enable, NULL); + + channels = spice_session_get_channels(session); + for (l = channels; l != NULL; l = l->next) { + SpiceChannel *channel = l->data; + + if (!SPICE_IS_SSH_CHANNEL(channel)) + continue; + + if (enable) + spice_channel_connect(channel); + else + spice_channel_disconnect(channel, SPICE_CHANNEL_NONE); + } + + g_list_free(channels); +} + +static void virt_viewer_session_spice_constructed(GObject *obj) { VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(obj); @@ -232,6 +262,10 @@ virt_viewer_session_spice_constructed(GObject *obj) G_CALLBACK(update_share_folder), self, G_CONNECT_SWAPPED); + virt_viewer_signal_connect_object(self, "notify::forward-ssh-agent", + G_CALLBACK(enable_ssh_agent_forward), self, + G_CONNECT_SWAPPED); + G_OBJECT_CLASS(virt_viewer_session_spice_parent_class)->constructed(obj); } |