This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository libx2goclient. from bc2d448 src/x2goclient-network-ssh.c: implement IPv6 scope ID handling. new 392ff84 configure.ac: bump GIO version requirement to 2.46+ for GNativeSocketAddress support. new 301166a src/x2goclient-network-ssh.c: add some whitespace (only). new 69f7df6 src/x2goclient-network-ssh.c: explain what X2GoClientNetworkOptionsSSH is supposed to do eventually. new 309c011 src/x2goclient-network-ssh.c: implement FQDN/alias socket parsing. new 91db732 src/x2goclient-network-ssh.c: remove duplicated code. new 46cfad5 src/: add gnativesocketaddress.h due to a bug in glib/gio. new 322620e src/x2goclient-network.h: include "private copy" of gnativesocketaddress.h. new 1a2ac19 src/x2goclient-network.c: check object type for parse_sockspec(). The 8 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: configure.ac | 2 +- src/gnativesocketaddress.h | 58 ++++++++++++++++++ src/x2goclient-network-ssh.c | 139 ++++++++++++++++++++++++++++++++++++++++--- src/x2goclient-network.c | 2 + src/x2goclient-network.h | 9 +++ 5 files changed, 200 insertions(+), 10 deletions(-) create mode 100644 src/gnativesocketaddress.h -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 392ff8452e357890df17607098db48886bfcf910 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 19:47:27 2019 +0200 configure.ac: bump GIO version requirement to 2.46+ for GNativeSocketAddress support. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 031b0d9..44e36b3 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,7 @@ if test "x$enable_deprecation_flags" = "xyes"; then fi GLIB_REQUIRED=2.37.0 -GIO_REQUIRED=2.26.0 +GIO_REQUIRED=2.46.0 GTK3_REQUIRED_VERSION=3.6 GOBJECT_INTROSPECTION_CHECK([0.9.7]) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 301166a6c21f723f73e39b8e7d430096200e9174 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 20:06:12 2019 +0200 src/x2goclient-network-ssh.c: add some whitespace (only). --- src/x2goclient-network-ssh.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index c103007..b13342a 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -46,6 +46,7 @@ #include "x2goclient.h" #include "x2goclient-network-ssh.h" + /* * Error handling helpers. */ @@ -57,6 +58,7 @@ enum { X2GOCLIENT_NETWORK_SSH_ERROR_IPV4_CONV }; + struct _X2GoClientNetworkOptionsSSH { X2GoClientNetworkOptions parent_class; }; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 69f7df67df90d678f1f5fa5e82152f724526c0dc Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 20:06:44 2019 +0200 src/x2goclient-network-ssh.c: explain what X2GoClientNetworkOptionsSSH is supposed to do eventually. --- src/x2goclient-network-ssh.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index b13342a..3bb1285 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -61,6 +61,11 @@ enum { struct _X2GoClientNetworkOptionsSSH { X2GoClientNetworkOptions parent_class; + + /* + * Eventually, this class should encapsulate/handle every ssh_config option, + * but for now it's a stub. + */ }; G_DEFINE_TYPE (X2GoClientNetworkOptionsSSH, x2goclient_network_options_ssh, X2GOCLIENT_TYPE_NETWORK_OPTIONS); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 309c0119a6fbb539401f37f2221d0c2406aef96a Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 21:28:08 2019 +0200 src/x2goclient-network-ssh.c: implement FQDN/alias socket parsing. --- src/x2goclient-network-ssh.c | 123 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 1 deletion(-) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index 3bb1285..768b974 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -55,7 +55,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_IPV4_CONV, + X2GOCLIENT_NETWORK_SSH_ERROR_ALIAS_CONV }; @@ -77,6 +78,19 @@ static void x2goclient_network_options_ssh_init (X2GoClientNetworkOptionsSSH *se } +/* + * Custom sockaddr structure used to represent socket endpoints based on a FQDN + * or ssh_config-specific host alias. + */ +typedef struct sockaddr_ho { + sa_family_t sho_family; + in_port_t sho_port; + char sho_addr[256]; +} sockaddr_ho; + +#define AF_HOST 33 + + struct _X2GoClientNetworkSSH { X2GoClientNetwork parent_class; }; @@ -168,6 +182,18 @@ static guint16 x2goclient_network_ssh_parse_sockspec_port (const GString *portsp return (ret); } +static GString* x2goclient_network_ssh_sanitize_sockspec (const GString *sockspec) { + GString *ret = NULL; + + gchar *sanitize_sockspec = g_strdup (sockspec->str); + g_strstrip (sanitize_sockspec); + ret = g_string_new (g_strstrip (sanitize_sockspec)); + g_free (sanitize_sockspec); + sanitize_sockspec = NULL; + + return (ret); +} + static GSocketAddress* x2goclient_network_ssh_parse_sockspec_ip (const GString *sockspec, const gboolean want_v6, GError **err) { GSocketAddress *ret = NULL; @@ -340,6 +366,85 @@ static GSocketAddress* x2goclient_network_ssh_parse_sockspec_ip (const GString * return (ret); } +static GSocketAddress* x2goclient_network_ssh_parse_sockspec_alias (const GString *sockspec, GError **err) { + GSocketAddress *ret = NULL; + + g_return_val_if_fail (err == NULL || *err == NULL, ret); + + /* We're free to sanitize the string now. */ + GString *work_sockspec = x2goclient_network_ssh_sanitize_sockspec (sockspec); + + gchar *tmp_start = work_sockspec->str, + *tmp_end = NULL; + GString *address = NULL; + guint16 port = 0; + + /* + * For FQDN or alias addresses (like for IPv4 addresses), we'll accept any + * input of the form address:port. + */ + tmp_end = g_strstr_len (tmp_start, -1, ":"); + + if (tmp_end) { + --tmp_end; + + address = g_string_new_len (tmp_start, tmp_end - tmp_start); + } + else { + address = g_string_new_len (tmp_start, work_sockspec->len); + } + + /* + * Check validity. + * + * FIXME: for now only the size, but maybe we should do extra checks on the + * name. + */ + const gsize max_len = (sizeof (((struct sockaddr_ho*)(NULL))->sho_addr) - 1); + if (max_len < address->len) { + g_set_error (err, X2GOCLIENT_NETWORK_SSH_ERROR, X2GOCLIENT_NETWORK_SSH_ERROR_ALIAS_CONV, "Unable to parse FQDN or alias pseudo-address: name too long, expected at most %" G_GSIZE_FORMAT " bytes, got %" G_GSIZE_FORMAT " bytes.", max_len, address->len); + } + + if (!err) { + if (tmp_end) { + /* + * No encapsulation whatsoever, so the colon must be at the next + * position. + */ + GString *portspec = g_string_new (tmp_end + 1); + + GError *tmp_err = NULL; + port = x2goclient_network_ssh_parse_sockspec_port (portspec, &tmp_err); + g_string_free (portspec, TRUE); + portspec = NULL; + + if (tmp_err) { + g_set_error (err, X2GOCLIENT_NETWORK_SSH_ERROR, X2GOCLIENT_NETWORK_SSH_ERROR_ALIAS_CONV, "Unable to parse FQDN or alias pseudo-address: %s", tmp_err->message); + g_clear_error (&tmp_err); + } + } + } + + if (!err) { + /* + * Parsed everything successfully so far, so create native socket address + * object. + */ + struct sockaddr_ho tmp_sockaddr = { AF_HOST, }; + g_strlcpy (tmp_sockaddr.sho_addr, address->str, max_len + 1); + tmp_sockaddr.sho_port = port; + ret = g_native_socket_address_new (&tmp_sockaddr, sizeof (struct sockaddr_ho)); + } + + g_string_free (work_sockspec, TRUE); + work_sockspec = NULL; + + g_string_free (address, TRUE); + address = NULL; + + return (ret); +} + static GSocketAddress* x2goclient_network_ssh_parse_sockspec (X2GoClientNetworkSSH *self, const GString *sockspec) { GSocketAddress *ret = NULL; @@ -378,6 +483,22 @@ static GSocketAddress* x2goclient_network_ssh_parse_sockspec (X2GoClientNetworkS g_clear_error (&tmp_err); } } + + if (!ret) { + g_log (NULL, G_LOG_LEVEL_INFO, "Failed to parse socket specification as IPv4 socket.\n" + "Continuing with FQDN/alias parsing."); + + GError *tmp_err = NULL; + ret = x2goclient_network_ssh_parse_sockspec_alias (sockspec, &tmp_err); + + if (tmp_err) { + g_assert (!ret); + + g_log (NULL, G_LOG_LEVEL_WARNING, "Socket specification looked like a FQDN or alias socket, but parsing as such failed: %s", tmp_err->message); + + g_clear_error (&tmp_err); + } + } } return ret; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 91db7321f4716eb2f62d0067ed5afa39336585d3 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 21:29:01 2019 +0200 src/x2goclient-network-ssh.c: remove duplicated code. --- src/x2goclient-network-ssh.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index 768b974..938f88e 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -200,14 +200,7 @@ static GSocketAddress* x2goclient_network_ssh_parse_sockspec_ip (const GString * g_return_val_if_fail (err == NULL || *err == NULL, ret); /* We're free to sanitize the string now. */ - GString *work_sockspec = NULL; - { - gchar *sanitize_sockspec = g_strdup (sockspec->str); - g_strstrip (sanitize_sockspec); - work_sockspec = g_string_new (g_strstrip (sanitize_sockspec)); - g_free (sanitize_sockspec); - sanitize_sockspec = NULL; - } + GString *work_sockspec = x2goclient_network_ssh_sanitize_sockspec (sockspec); gchar *tmp_start = work_sockspec->str, *tmp_end = NULL; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 46cfad5fac52c0f257db99ce1be0d9196dab63a8 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 22:42:25 2019 +0200 src/: add gnativesocketaddress.h due to a bug in glib/gio. --- src/gnativesocketaddress.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/gnativesocketaddress.h b/src/gnativesocketaddress.h new file mode 100644 index 0000000..5caac30 --- /dev/null +++ b/src/gnativesocketaddress.h @@ -0,0 +1,58 @@ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. + * + * Authors: Christian Kellner <gicmo@gnome.org> + * Samuel Cormier-Iijima <sciyoshi@gmail.com> + */ + +#ifndef __G_NATIVE_SOCKET_ADDRESS_H__ +#define __G_NATIVE_SOCKET_ADDRESS_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_NATIVE_SOCKET_ADDRESS (g_native_socket_address_get_type ()) +#define G_NATIVE_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddress)) +#define G_NATIVE_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddressClass)) +#define G_IS_NATIVE_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NATIVE_SOCKET_ADDRESS)) +#define G_IS_NATIVE_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NATIVE_SOCKET_ADDRESS)) +#define G_NATIVE_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddressClass)) + +typedef struct _GNativeSocketAddressClass GNativeSocketAddressClass; +typedef struct _GNativeSocketAddressPrivate GNativeSocketAddressPrivate; + +struct _GNativeSocketAddress +{ + GSocketAddress parent_instance; + + /*< private >*/ + GNativeSocketAddressPrivate *priv; +}; + +struct _GNativeSocketAddressClass +{ + GSocketAddressClass parent_class; +}; + +GType g_native_socket_address_get_type (void) G_GNUC_CONST; + +GSocketAddress *g_native_socket_address_new (gpointer native, + gsize len); + +G_END_DECLS + +#endif /* __G_NATIVE_SOCKET_ADDRESS_H__ */ -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 322620e2158278b960a50473cfa44fe2699414b9 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 22:44:17 2019 +0200 src/x2goclient-network.h: include "private copy" of gnativesocketaddress.h. --- src/x2goclient-network.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/x2goclient-network.h b/src/x2goclient-network.h index d05b3dc..23156ff 100644 --- a/src/x2goclient-network.h +++ b/src/x2goclient-network.h @@ -28,6 +28,15 @@ #include <glib-object.h> #include <gio/gio.h> +/* + * We need this due to a bug in glib/gio. + * + * For more information, check https://gitlab.gnome.org/GNOME/glib/issues/1854 + */ +#if (!(GLIB_CHECK_VERSION(2, 62, 0))) +#include "gnativesocketaddress.h" +#endif + G_BEGIN_DECLS #define X2GOCLIENT_TYPE_NETWORK_OPTIONS (x2goclient_network_options_get_type ()) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit 1a2ac193fa4e308026f827417e0c941a6cc053a3 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jul 31 23:09:10 2019 +0200 src/x2goclient-network.c: check object type for parse_sockspec(). --- src/x2goclient-network.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/x2goclient-network.c b/src/x2goclient-network.c index 27ba691..3cac5b9 100644 --- a/src/x2goclient-network.c +++ b/src/x2goclient-network.c @@ -73,6 +73,8 @@ enum { static GParamSpec *net_obj_properties[X2GO_NET_N_PROPERTIES] = { NULL, }; static GSocketAddress* x2goclient_network_parse_sockspec (X2GoClientNetwork *self, const GString *sockspec) { + g_return_val_if_fail (X2GOCLIENT_IS_NETWORK (self), NULL); + return X2GOCLIENT_NETWORK_GET_CLASS (self)->parse_sockspec (self, sockspec); } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git