summaryrefslogtreecommitdiff
path: root/daemon/gkd-glue.c
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2018-02-23 16:37:01 +0100
committerDaiki Ueno <dueno@src.gnome.org>2018-02-25 07:16:09 +0100
commit90fb7fec727081d28946827e31f4330715dad283 (patch)
tree8594d803d7a0162911f940c0516f184a133afebf /daemon/gkd-glue.c
parentd0d059cb6e1de1a925f6853877648b1fc79807a8 (diff)
downloadgnome-keyring-90fb7fec727081d28946827e31f4330715dad283.tar.gz
ssh-agent: Use stock ssh-agentwip/dueno/ssh-agent-2
This patch removes our own implementation of ssh-agent and switches to using the ssh-agent program provided by OpenSSH. We can't simply drop the ssh-agent functionality from gnome-keyring, as it enables the following: * Automatic loading and unlocking of keys * Prompting in the UI Instead we wrap the ssh-agent program as a subprocess and augment the protocol as we need. Signed-off-by: Stef Walter <stefw@gnome.org> Signed-off-by: Daiki Ueno <dueno@src.gnome.org> https://bugzilla.gnome.org/show_bug.cgi?id=775981
Diffstat (limited to 'daemon/gkd-glue.c')
-rw-r--r--daemon/gkd-glue.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/daemon/gkd-glue.c b/daemon/gkd-glue.c
index 329a37ed..44ee2136 100644
--- a/daemon/gkd-glue.c
+++ b/daemon/gkd-glue.c
@@ -23,46 +23,44 @@
#include "gkd-glue.h"
#include "gkd-util.h"
-#include "ssh-agent/gkd-ssh-agent.h"
+#include "ssh-agent/gkd-ssh-agent-service.h"
+#include "ssh-agent/gkd-ssh-agent-interaction.h"
#include "egg/egg-cleanup.h"
static void
-pkcs11_ssh_cleanup (gpointer unused)
+pkcs11_ssh_cleanup (gpointer data)
{
- gkd_ssh_agent_shutdown ();
-}
-
-static gboolean
-accept_ssh_client (GIOChannel *channel, GIOCondition cond, gpointer unused)
-{
- if (cond == G_IO_IN)
- gkd_ssh_agent_accept ();
- return TRUE;
+ GkdSshAgentService *service = GKD_SSH_AGENT_SERVICE (data);
+ gkd_ssh_agent_service_stop (service);
+ g_object_unref (service);
}
gboolean
gkd_daemon_startup_ssh (void)
{
- GIOChannel *channel;
const gchar *base_dir;
- int sock;
+ GTlsInteraction *interaction;
+ GkdSshAgentPreload *preload;
+ GkdSshAgentService *service;
base_dir = gkd_util_get_master_directory ();
g_return_val_if_fail (base_dir, FALSE);
- sock = gkd_ssh_agent_startup (base_dir);
- if (sock == -1)
- return FALSE;
+ interaction = gkd_ssh_agent_interaction_new (NULL);
+ preload = gkd_ssh_agent_preload_new ("~/.ssh");
+
+ service = gkd_ssh_agent_service_new (base_dir, interaction, preload);
+ g_object_unref (interaction);
+ g_object_unref (preload);
- channel = g_io_channel_unix_new (sock);
- g_io_add_watch (channel, G_IO_IN | G_IO_HUP, accept_ssh_client, NULL);
- g_io_channel_unref (channel);
+ if (!gkd_ssh_agent_service_start (service))
+ return FALSE;
/* ssh-agent sets the environment variable */
gkd_util_push_environment ("SSH_AUTH_SOCK", g_getenv ("SSH_AUTH_SOCK"));
- egg_cleanup_register (pkcs11_ssh_cleanup, NULL);
+ egg_cleanup_register (pkcs11_ssh_cleanup, service);
return TRUE;
}