[gnome-keyring/wip/dueno/ssh-agent: 97/105] WIP ssh agent



commit 874c5cf7dbddbeb0eff9686079f2a928ab93bf5a
Author: Stef Walter <stefw redhat com>
Date:   Fri Aug 29 15:52:25 2014 +0200

    WIP ssh agent

 configure.ac                            |    5 +++++
 daemon/ssh-agent/Makefile.am            |    4 ++--
 daemon/ssh-agent/gkd-ssh-agent-client.c |   26 +++++++++++++++++++-------
 daemon/ssh-agent/gkd-ssh-agent-client.h |   18 +++++++++---------
 4 files changed, 35 insertions(+), 18 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bbc07d8..db09505 100644
--- a/configure.ac
+++ b/configure.ac
@@ -348,6 +348,11 @@ AC_ARG_ENABLE([ssh-agent],
                [Don't include SSH agent in gnome-keyring]))
 
 if test "$enable_ssh_agent" != "no"; then
+       AC_PATH_PROG([SSH_AGENT], [ssh-agent], [no])
+       if test "$SSH_AGENT" = "no"; then
+               AC_MSG_ERROR([the ssh-agent command was not found])
+       fi
+       AC_DEFINE_UNQUOTED(SSH_AGENT, "$SSH_AGENT", [The path to ssh-agent]) 
        AC_DEFINE(WITH_SSH, 1, [Whether to build SSH agent or not])
        ssh_status="yes"
 else
diff --git a/daemon/ssh-agent/Makefile.am b/daemon/ssh-agent/Makefile.am
index 014c9c6..86b47ba 100644
--- a/daemon/ssh-agent/Makefile.am
+++ b/daemon/ssh-agent/Makefile.am
@@ -9,8 +9,8 @@ libgkd_ssh_agent_la_SOURCES = \
        daemon/ssh-agent/gkd-ssh-agent.c \
        daemon/ssh-agent/gkd-ssh-agent.h \
        daemon/ssh-agent/gkd-ssh-agent-client.h \
+       daemon/ssh-agent/gkd-ssh-agent-client.c \
        daemon/ssh-agent/gkd-ssh-agent-private.h \
-       daemon/ssh-agent/gkd-ssh-agent-ops.c \
-       daemon/ssh-agent/gkd-ssh-agent-proto.c
+       daemon/ssh-agent/gkd-ssh-agent-ops.c
 libgkd_ssh_agent_la_CFLAGS = \
        $(DAEMON_CFLAGS)
diff --git a/daemon/ssh-agent/gkd-ssh-agent-client.c b/daemon/ssh-agent/gkd-ssh-agent-client.c
index 2f4b340..3fa6d4d 100644
--- a/daemon/ssh-agent/gkd-ssh-agent-client.c
+++ b/daemon/ssh-agent/gkd-ssh-agent-client.c
@@ -20,10 +20,12 @@
 
 #include "config.h"
 
-gint
+#include "gkd-ssh-agent-client.h"
+
+static gint
 agent_start (const char *socket)
 {
-       gchar *argv[] = { SSH_AGENT, "-a", socket, NULL };
+       const gchar *argv[] = { SSH_AGENT, "-d", "-a", socket, NULL };
        gchar *standard_error = NULL;
        gchar *standard_output = NULL;
        GError *error = NULL;
@@ -31,8 +33,10 @@ agent_start (const char *socket)
        gint ret = 0;
        gchar *cmd;
 
-       if (!g_spawn_sync ("/", argv, NULL, NULL, NULL, &standard_output,
-                          &standard_error, &exit_status, &error) ||
+       if (!g_spawn_async ("/", argv, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL,
+                           NULL, NULL, 
+                           NULL, NULL, &standard_output,
+                           &standard_error, &exit_status, &error) ||
            !g_spawn_check_exit_status (exit_status, NULL)) {
                cmd = g_strjoinv (" ", argv);
                if (error != NULL) {
@@ -100,8 +104,8 @@ G_LOCK (ssh_agent_process);
 static gchar *ssh_agent_path = NULL;
 static gint ssh_agent_pid;
 
-GIOStream *
-gkd_ssh_agent_process_connect (void)
+GkdSshAgentClient *
+gkd_ssh_agent_client_connect (void)
 {
        GSocketConnection *connection;
        GSocketAddress *address;
@@ -150,7 +154,7 @@ gkd_ssh_agent_process_connect (void)
 }
 
 void
-gkd_ssh_agent_process_cleanup (void)
+gkd_ssh_agent_client_cleanup (void)
 {
        G_LOCK (ssh_agent_process);
 
@@ -163,3 +167,11 @@ gkd_ssh_agent_process_cleanup (void)
 
        G_UNLOCK (ssh_agent_process);
 }
+
+gboolean
+gkd_ssh_agent_client_transact (GkdSshAgentClient *self,
+                               EggBuffer *req,
+                               EggBuffer *resp)
+{
+
+}
diff --git a/daemon/ssh-agent/gkd-ssh-agent-client.h b/daemon/ssh-agent/gkd-ssh-agent-client.h
index 4328fe4..cd5919d 100644
--- a/daemon/ssh-agent/gkd-ssh-agent-client.h
+++ b/daemon/ssh-agent/gkd-ssh-agent-client.h
@@ -43,22 +43,22 @@ GType                gkd_ssh_agent_client_get_type            (void);
 GkdSshAgentClient *  gkd_ssh_agent_client_connect             (void);
 
 gboolean             gkd_ssh_agent_client_transact            (GkdSshAgentClient *self,
-                                                              EggBuffer *req,
-                                                              EggBuffer *resp);
+                                                               EggBuffer *req,
+                                                               EggBuffer *resp);
 
-GList *              gkd_ssh_agent_client_preload_keys        (GkdSshAgentClient *self);
+GList *              gkd_ssh_agent_preload_keys               (GkdSshAgentClient *self);
 
-gchar *              gkd_ssh_agent_client_preload_comment     (GkdSshAgentClient *self,
+gchar *              gkd_ssh_agent_preload_comment            (GkdSshAgentClient *self,
                                                                GBytes *key);
 
-GBytes *             gkd_ssh_agent_client_preload_unlock      (GkdSshAgentClient *self,
-                                                              GBytes *key);
+GBytes *             gkd_ssh_agent_preload_unlock             (GkdSshAgentClient *self,
+                                                               GBytes *key);
 
-void                 gkd_ssh_agent_client_preload_clear       (GkdSshAgentClient *self,
+void                 gkd_ssh_agent_preload_clear              (GkdSshAgentClient *self,
                                                                GBytes *key);
 
-void                 gkd_ssh_agent_client_preload_clear_all   (GkdSshAgentClient *self);
+void                 gkd_ssh_agent_preload_clear_all          (GkdSshAgentClient *self);
 
-void                 gkd_ssh_agent_client_cleanup             (void);
+void                 gkd_ssh_agent_preload_cleanup            (void);
 
 #endif /* __GKD_SSH_AGENT_CLIENT_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]