[X2Go-Commits] [libx2goclient] 18/18: src/x2goclient-network-ssh.{c, h}: start implementing connect () vfunc, create parent directory to control socket.

git-admin at x2go.org git-admin at x2go.org
Mon Aug 19 15:47:04 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository libx2goclient.

commit 5dbe21d4aaf37686fd6596dda9c8e8d86e5cfdae
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Aug 19 15:42:51 2019 +0200

    src/x2goclient-network-ssh.{c,h}: start implementing connect () vfunc, create parent directory to control socket.
---
 src/x2goclient-network-ssh.c | 23 ++++++++++++++++++++++-
 src/x2goclient-network-ssh.h |  3 ++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c
index 29d1984..b39357a 100644
--- a/src/x2goclient-network-ssh.c
+++ b/src/x2goclient-network-ssh.c
@@ -565,12 +565,33 @@ gboolean x2goclient_network_ssh_connect (X2GoClientNetworkSSH *self, GError **ge
 }
 
 static gboolean x2goclient_network_ssh_parent_connect (X2GoClientNetwork *parent, GError **gerr) {
-  gboolean ret = FALSE;
+  gboolean ret = TRUE;
 
   g_return_val_if_fail (X2GOCLIENT_IS_NETWORK_SSH (parent), ret);
   X2GoClientNetworkSSH *self = X2GOCLIENT_NETWORK_SSH (parent);
 
   /* Actual implementation here. */
 
+  /* "Calculate" socket path. */
+  gchar *session_path = NULL;
+  g_object_get (G_OBJECT (self), "session-path", &session_path, NULL);
+  g_assert (session_path);
+
+  GString *tmp_string = g_string_new (session_path);
+  g_string_append (tmp_string, "/ssh/control");
+  self->control_path = g_string_free (tmp_string, FALSE);
+
+  gchar *dirname = g_path_get_dirname (self->control_path);
+  errno = 0;
+  if (0 != g_mkdir_with_parents (dirname, 0700)) {
+    int saved_errno = errno;
+    g_set_error (gerr, X2GOCLIENT_NETWORK_SSH_ERROR, X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_DIR_CREATE, "Failed to create parent directory: %s", g_strerror (saved_errno));
+    ret = FALSE;
+  }
+
+  if (ret) {
+    ret = FALSE;
+  }
+
   return (ret);
 }
diff --git a/src/x2goclient-network-ssh.h b/src/x2goclient-network-ssh.h
index 3eea2a4..6c88c0e 100644
--- a/src/x2goclient-network-ssh.h
+++ b/src/x2goclient-network-ssh.h
@@ -50,7 +50,8 @@ enum {
   X2GOCLIENT_NETWORK_SSH_ERROR_PORT_CONV = 0,
   X2GOCLIENT_NETWORK_SSH_ERROR_IPV6_CONV,
   X2GOCLIENT_NETWORK_SSH_ERROR_IPV4_CONV,
-  X2GOCLIENT_NETWORK_SSH_ERROR_ALIAS_CONV
+  X2GOCLIENT_NETWORK_SSH_ERROR_ALIAS_CONV,
+  X2GOCLIENT_NETWORK_SSH_ERROR_CONNECT_DIR_CREATE
 };
 
 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git


More information about the x2go-commits mailing list