Re: [Spice-devel] guest agent windows binaries
On Wed, Feb 12, 2014 at 11:08:42AM +1000, Lindsay Mathieson wrote: Is there somewhere I can download the windows guest agent binaries (vdagent, vdservice) from, so I can manually install them on Windows 8? The link on the Spice Download page http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2 is only to source, not to binaries http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw32-spice-vdagent-0.7.2-1.fc19.noarch.rpm and http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw64-spice-vdagent-0.7.2-1.fc19.noarch.rpm contain the binaries: $ rpm -qpl ./mingw64-spice-vdagent-0.7.2-1.fc19.noarch.rpm /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdagent.exe /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdservice.exe Also - could someone *please* clarify the current and future status of windows 8/2012 drivers and guest tools? its extremely confusing trying to track down this information. No QXL driver, the virtio-win drivers (located at https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/ ) seem to have win8 versions, and the agent should be working as well on win8. I've never tried these though. Christophe pgpWvXkugfp5y.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] Can't subscribe to Spice-devel
Hi, When I subscribe to Spice-devel mail list, I encounter follow issue: url: http://lists.freedesktop.org/mailman/listinfo/spice-devel error info: Bug in Mailman version 2.1.13 We're sorry, we hit a bug! Please inform the webmaster for this site of this problem. Printing of traceback and other system information has been explicitly inhibited, but the webmaster can find this information in the Mailman error logs. Thanks and Regards, shan wang ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] Can't subscribe to Spice-devel
Hey, On Wed, Feb 12, 2014 at 10:36:13AM +0800, shan wang wrote: Hi, When I subscribe to Spice-devel mail list, I encounter follow issue: url: http://lists.freedesktop.org/mailman/listinfo/spice-devel error info: Bug in Mailman version 2.1.13 I replied offlist already, but I hit this issue when trying, and this seems to be a known bug https://bugs.freedesktop.org/show_bug.cgi?id=74749 :( Christophe pgphHN0cfDLWj.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 03/13] spice-proxy: parse user and pass
On Tue, Feb 11, 2014 at 06:15:15PM +0100, Marc-André Lureau wrote: I am not fond of super-extra-small changes, I tend to make things that belong together in the same patch. This one could be splitted in 5 patches or more, I don't see the point. All I want is a reasonable set of related changes that don't break things. Well, this makes review more complicated. I was focused on reviewing a change parsing user and password, so I tried to interpret this change as something helping with that. When it did not seem useful for parsing username and password, I was still stuck with am I missing something, or is it just a parsing improvement? If this small change were to be buggy in some corner cases a few years from now, we'd be misled again if git bisect points us at a commit adding user/password parsing rather than at a small commit doing some minor cleanup. And we'll also won't know anything about the intent of this change (was it a small and obvious cleanup? was it required for some reason? what was that reason?). So while it may make things more convenient now for the person doing the commit, it's in my opinion (well not just me) better to avoid having silent changes in commits. So should I split it or you agree it's fine as part of parsing changes? I initially was planning to tell you to just go with it, and now I just convinced myself that it's better to split it /o\ Christophe pgpeTDDg3ZTkj.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] Can't subscribe to Spice-devel
Hey, On Wed, Feb 12, 2014 at 10:36:13AM +0800, shan wang wrote: When I subscribe to Spice-devel mail list, I encounter follow issue: url: http://lists.freedesktop.org/mailman/listinfo/spice-devel After asking on IRC, it seems they had to disable subscriptions to mailing list using the web interface as they were getting a lot of spam subscriptions. Subscribing by using the email interface should still be possible (see http://www.list.org/mailman-member/node13.html ). The email address should be spice-devel-join lists.freedesktop.org Hope that helps, Christophe pgpaMDdrEedIA.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 03/13] spice-proxy: parse user and pass
On Wed, Feb 12, 2014 at 10:39 AM, Christophe Fergeau cferg...@redhat.com wrote: On Tue, Feb 11, 2014 at 06:15:15PM +0100, Marc-André Lureau wrote: I am not fond of super-extra-small changes, I tend to make things that belong together in the same patch. This one could be splitted in 5 patches or more, I don't see the point. All I want is a reasonable set of related changes that don't break things. Well, this makes review more complicated. I was focused on reviewing a change parsing user and password, so I tried to interpret this change as something helping with that. When it did not seem useful for parsing username and password, I was still stuck with am I missing something, or is it just a parsing improvement? ok If this small change were to be buggy in some corner cases a few years from now, we'd be misled again if git bisect points us at a commit adding user/password parsing rather than at a small commit doing some minor cleanup. And we'll also won't know anything about the intent of this change (was it a small and obvious cleanup? was it required for some reason? what was that reason?). In general, I agree, but I consider this to be simple, non-essential and hopefully replacable in a near future with a real GUri parser (or equivalent, like SoupUri) So while it may make things more convenient now for the person doing the commit, it's in my opinion (well not just me) better to avoid having silent changes in commits. So should I split it or you agree it's fine as part of parsing changes? I initially was planning to tell you to just go with it, and now I just convinced myself that it's better to split it /o\ I'll split this change off then. -- Marc-André Lureau ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCHv2 spice-gtk 00/14] Add https + basic auth proxy support
From: Marc-André Lureau marcandre.lur...@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, The following series allows to connect to an HTTPS proxy, with Basic authentication. It also allows clients to ask credentials when required. This will need some client side support, and a small patch is ready for virt-viewer. In v2: - address Christophe's comments from v1 review Marc-André Lureau (14): compat: add strtok_r fallback proxy: split uri with : in only 2 parts proxy: add user and pass properties proxy: parse user and pass from uri http-proxy: specify Basic scheme spice-proxy: parse https protocol http-proxy: add https proxy Fill g_proxy_address_new() with protocol, user and password openssl: learn to handle a new kind of BIO based on GIOStream channel: simplify has error code channel: talk to giostream instead of gsocket Make SpiceURI a public API channel: add spice_channel_get_error() session: add spice_session_get_proxy_uri() configure.ac | 2 +- doc/reference/Makefile.am| 1 + doc/reference/spice-gtk-docs.xml | 1 + doc/reference/spice-gtk-sections.txt | 28 +++ gtk/Makefile.am | 9 +- gtk/bio-gio.c| 135 + gtk/bio-gio.h| 34 gtk/bio-gsocket.c| 111 --- gtk/bio-gsocket.h| 30 --- gtk/glib-compat.c| 34 gtk/glib-compat.h| 8 + gtk/map-file | 14 ++ gtk/spice-channel-priv.h | 5 +- gtk/spice-channel.c | 137 - gtk/spice-channel.h | 2 + gtk/spice-client.h | 1 + gtk/spice-glib-sym-file | 14 ++ gtk/spice-proxy.c| 270 -- gtk/spice-proxy.h| 60 -- gtk/spice-session-priv.h | 5 +- gtk/spice-session.c | 50 +++-- gtk/spice-session.h | 2 + gtk/spice-uri-priv.h | 30 +++ gtk/spice-uri.c | 360 +++ gtk/spice-uri.h | 52 + gtk/spicy.c | 6 + gtk/wocky-http-proxy.c | 154 +-- gtk/wocky-http-proxy.h | 14 ++ 28 files changed, 1006 insertions(+), 563 deletions(-) create mode 100644 gtk/bio-gio.c create mode 100644 gtk/bio-gio.h delete mode 100644 gtk/bio-gsocket.c delete mode 100644 gtk/bio-gsocket.h delete mode 100644 gtk/spice-proxy.c delete mode 100644 gtk/spice-proxy.h create mode 100644 gtk/spice-uri-priv.h create mode 100644 gtk/spice-uri.c create mode 100644 gtk/spice-uri.h -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 01/14] compat: add strtok_r fallback
From: Marc-André Lureau marcandre.lur...@redhat.com The following Spice proxy URI parsing code makes use of it, but it is not available on Windows Origin: http://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;a=blob;f=compat/strtok_r.c --- configure.ac | 2 +- gtk/glib-compat.c | 34 ++ gtk/glib-compat.h | 8 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4dcd81c..3670863 100644 --- a/configure.ac +++ b/configure.ac @@ -235,7 +235,7 @@ else EXTERNAL_PNP_IDS=$with_pnp_ids_path fi -AC_CHECK_FUNCS(clearenv) +AC_CHECK_FUNCS(clearenv strtok_r) PKG_CHECK_MODULES(GLIB2, glib-2.0 = 2.22) AC_SUBST(GLIB2_CFLAGS) diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c index 9ffadbb..5714173 100644 --- a/gtk/glib-compat.c +++ b/gtk/glib-compat.c @@ -1,5 +1,8 @@ /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* + Copyright (C) 2012-2014 Red Hat, Inc. + Copyright © 1998-2009 VLC authors and VideoLAN + 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 @@ -14,6 +17,7 @@ License along with this library; if not, see http://www.gnu.org/licenses/. */ +#include string.h #include glib-compat.h #if !GLIB_CHECK_VERSION(2,26,0) @@ -105,3 +109,33 @@ guint64 g_get_monotonic_time(void) return (((gint64) tv.tv_sec) * 100) + tv.tv_usec; } #endif + +#ifndef HAVE_STRTOK_R +G_GNUC_INTERNAL +char *strtok_r(char *s, const char *delim, char **save_ptr) +{ +char *token; + +if (s == NULL) +s = *save_ptr; + +/* Scan leading delimiters. */ +s += strspn (s, delim); +if (*s == '\0') +return NULL; + +/* Find the end of the token. */ +token = s; +s = strpbrk (token, delim); +if (s == NULL) +/* This token finishes the string. */ +*save_ptr = strchr (token, '\0'); +else +{ +/* Terminate the token and make *SAVE_PTR point past it. */ +*s = '\0'; +*save_ptr = s + 1; +} +return token; +} +#endif diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h index c30a735..62580e2 100644 --- a/gtk/glib-compat.h +++ b/gtk/glib-compat.h @@ -1,5 +1,8 @@ /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* + Copyright (C) 2012-2014 Red Hat, Inc. + Copyright © 1998-2009 VLC authors and VideoLAN + 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 @@ -18,6 +21,7 @@ #include glib-object.h #include gio/gio.h +#include config.h #if !GLIB_CHECK_VERSION(2,26,0) #define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {}) @@ -133,4 +137,8 @@ GType spice_main_context_get_type (void) G_GNUC_CONST; guint64 g_get_monotonic_time(void); #endif +#ifndef HAVE_STRTOK_R +char* strtok_r(char *s, const char *delim, char **save_ptr); +#endif + #endif /* GLIB_COMPAT_H */ -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 02/14] proxy: split uri with : in only 2 parts
From: Marc-André Lureau marcandre.lur...@redhat.com We want just host:port here. --- gtk/spice-proxy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/spice-proxy.c b/gtk/spice-proxy.c index bc4037e..f338213 100644 --- a/gtk/spice-proxy.c +++ b/gtk/spice-proxy.c @@ -74,7 +74,8 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err spice_proxy_set_protocol(self, http); spice_proxy_set_port(self, 3128); -gchar **proxyv = g_strsplit(uri, :, 0); +/* max 2 parts, host:port */ +gchar **proxyv = g_strsplit(uri, :, 2); const gchar *proxy_port = NULL; if (proxyv[0] == NULL || strlen(proxyv[0]) == 0) { -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 05/14] http-proxy: specify Basic scheme
From: Marc-André Lureau marcandre.lur...@redhat.com Or Squid will fail with: WARNING: Unsupported or unconfigured/inactive proxy-auth scheme --- gtk/wocky-http-proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c index d73990b..11f557e 100644 --- a/gtk/wocky-http-proxy.c +++ b/gtk/wocky-http-proxy.c @@ -98,7 +98,7 @@ create_request (GProxyAddress *proxy_address, gboolean *has_cred) base64_cred = g_base64_encode ((guchar *) cred, strlen (cred)); g_free (cred); g_string_append_printf (request, - Proxy-Authorization: %s\r\n, + Proxy-Authorization: Basic %s\r\n, base64_cred); g_free (base64_cred); } -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 06/14] spice-proxy: parse https protocol
From: Marc-André Lureau marcandre.lur...@redhat.com --- gtk/spice-proxy.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk/spice-proxy.c b/gtk/spice-proxy.c index 35eec67..685c120 100644 --- a/gtk/spice-proxy.c +++ b/gtk/spice-proxy.c @@ -65,9 +65,17 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err uri = dup = g_strdup(proxyuri); /* FIXME: use GUri when it is ready... only support http atm */ /* the code is voluntarily not parsing thoroughly the uri */ -if (g_ascii_strncasecmp(http://;, uri, 7) == 0) +if (g_ascii_strncasecmp(http://;, uri, 7) == 0) { uri += 7; - +spice_proxy_set_protocol(self, http); +spice_proxy_set_port(self, 3128); +} else if (g_ascii_strncasecmp(https://;, uri, 8) == 0) { +uri += 8; +spice_proxy_set_protocol(self, https); +spice_proxy_set_port(self, 3129); +} else { +return FALSE; +} /* remove trailing slash */ len = strlen(uri); for (; len 0; len--) @@ -76,8 +84,6 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err else break; -spice_proxy_set_protocol(self, http); -spice_proxy_set_port(self, 3128); /* yes, that parser is bad, we need GUri... */ if (strstr(uri, @)) { -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 04/14] proxy: parse user and pass from uri
From: Marc-André Lureau marcandre.lur...@redhat.com --- gtk/spice-proxy.c | 13 + 1 file changed, 13 insertions(+) diff --git a/gtk/spice-proxy.c b/gtk/spice-proxy.c index 7711e83..35eec67 100644 --- a/gtk/spice-proxy.c +++ b/gtk/spice-proxy.c @@ -19,6 +19,7 @@ #include stdlib.h #include string.h +#include glib-compat.h #include spice-client.h #include spice-proxy.h @@ -78,6 +79,18 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err spice_proxy_set_protocol(self, http); spice_proxy_set_port(self, 3128); +/* yes, that parser is bad, we need GUri... */ +if (strstr(uri, @)) { +gchar *saveptr, *saveptr2; +gchar *next = strstr(uri, @) + 1; +gchar *auth = strtok_r(uri, @, saveptr); +const gchar *user = strtok_r(auth, :, saveptr2); +const gchar *pass = strtok_r(NULL, :, saveptr2); +spice_proxy_set_user(self, user); +spice_proxy_set_password(self, pass); +uri = next; +} + /* max 2 parts, host:port */ gchar **proxyv = g_strsplit(uri, :, 2); const gchar *proxy_port = NULL; -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 09/14] openssl: learn to handle a new kind of BIO based on GIOStream
From: Marc-André Lureau marcandre.lur...@redhat.com Although reusing BIO_new_socket() once again is a hack, it seems to be the easiest way... The proper solution is certainly to start using GTls instead, but that will require a glib 2.28 dep bump. --- gtk/Makefile.am | 4 +- gtk/bio-gio.c | 135 gtk/bio-gio.h | 34 + gtk/bio-gsocket.c | 111 -- gtk/bio-gsocket.h | 30 gtk/spice-channel.c | 2 +- 6 files changed, 172 insertions(+), 144 deletions(-) create mode 100644 gtk/bio-gio.c create mode 100644 gtk/bio-gio.h delete mode 100644 gtk/bio-gsocket.c delete mode 100644 gtk/bio-gsocket.h diff --git a/gtk/Makefile.am b/gtk/Makefile.am index a1a1e79..0740e96 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -212,8 +212,8 @@ USB_ACL_HELPER_SRCS = endif libspice_client_glib_2_0_la_SOURCES = \ - bio-gsocket.c \ - bio-gsocket.h \ + bio-gio.c \ + bio-gio.h \ glib-compat.c \ glib-compat.h \ spice-audio.c \ diff --git a/gtk/bio-gio.c b/gtk/bio-gio.c new file mode 100644 index 000..22d58b6 --- /dev/null +++ b/gtk/bio-gio.c @@ -0,0 +1,135 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + 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/. +*/ + +#include string.h +#include glib.h + +#include spice-util.h +#include bio-gio.h + +typedef struct bio_gsocket_method { +BIO_METHOD method; +#if GLIB_CHECK_VERSION(2, 28, 0) +GIOStream *stream; +#else +GSocket *gsocket; +#endif +} bio_gsocket_method; + +#define BIO_GET_GSOCKET(bio) (((bio_gsocket_method*)bio-method)-gsocket) +#define BIO_GET_ISTREAM(bio) (g_io_stream_get_input_stream(((bio_gsocket_method*)bio-method)-stream)) +#define BIO_GET_OSTREAM(bio) (g_io_stream_get_output_stream(((bio_gsocket_method*)bio-method)-stream)) + +static int bio_gio_write(BIO *bio, const char *in, int inl) +{ +gssize ret; +GError *error = NULL; + +#if GLIB_CHECK_VERSION(2, 28, 0) +ret = g_pollable_output_stream_write_nonblocking(G_POLLABLE_OUTPUT_STREAM(BIO_GET_OSTREAM(bio)), +#else +ret = g_socket_send(BIO_GET_GSOCKET(bio), +#endif +in, inl, NULL, error); +BIO_clear_retry_flags(bio); + +if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) +BIO_set_retry_write(bio); +if (error != NULL) { +g_warning(%s, error-message); +g_clear_error(error); +} + +return ret; +} + +static int bio_gio_read(BIO *bio, char *out, int outl) +{ +gssize ret; +GError *error = NULL; + +#if GLIB_CHECK_VERSION(2, 28, 0) +ret = g_pollable_input_stream_read_nonblocking(G_POLLABLE_INPUT_STREAM(BIO_GET_ISTREAM(bio)), +#else +ret = g_socket_receive(BIO_GET_GSOCKET(bio), +#endif + out, outl, NULL, error); +BIO_clear_retry_flags(bio); + +if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) +BIO_set_retry_read(bio); +else if (error != NULL) +g_warning(%s, error-message); + +g_clear_error(error); + +return ret; +} + +static int bio_gio_destroy(BIO *bio) +{ +if (bio == NULL || bio-method == NULL) +return 0; + +SPICE_DEBUG(bio gsocket destroy); +g_free(bio-method); +bio-method = NULL;; + +return 1; +} + +static int bio_gio_puts(BIO *bio, const char *str) +{ +int n, ret; + +n = strlen(str); +ret = bio_gio_write(bio, str, n); + +return ret; +} + +G_GNUC_INTERNAL +#if GLIB_CHECK_VERSION(2, 28, 0) +BIO* bio_new_giostream(GIOStream *stream) +{ +// TODO: make an actual new BIO type, or just switch to GTls already... +BIO *bio = BIO_new_socket(-1, BIO_NOCLOSE); +#else +BIO* bio_new_gsocket(GSocket *gsocket) +{ +BIO *bio = BIO_new_socket(g_socket_get_fd(gsocket), BIO_NOCLOSE); +#endif + +bio_gsocket_method *bio_method = g_new(bio_gsocket_method, 1); +bio_method-method = *bio-method; +#if GLIB_CHECK_VERSION(2, 28, 0) +bio_method-stream =
[Spice-devel] [PATCH spice-gtk 07/14] http-proxy: add https proxy
From: Marc-André Lureau marcandre.lur...@redhat.com This will require glib 2.28 for GTls support, atm --- gtk/spice-session.c| 3 + gtk/wocky-http-proxy.c | 152 ++--- gtk/wocky-http-proxy.h | 14 + 3 files changed, 150 insertions(+), 19 deletions(-) diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 5d1c1c1..475306a 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -637,6 +637,9 @@ static void spice_session_class_init(SpiceSessionClass *klass) #if GLIB_CHECK_VERSION(2, 26, 0) _wocky_http_proxy_get_type(); #endif +#if GLIB_CHECK_VERSION(2, 28, 0) +_wocky_https_proxy_get_type(); +#endif gobject_class-dispose = spice_session_dispose; gobject_class-finalize = spice_session_finalize; diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c index 11f557e..feb9816 100644 --- a/gtk/wocky-http-proxy.c +++ b/gtk/wocky-http-proxy.c @@ -1,7 +1,9 @@ /* wocky-http-proxy.c: Source for WockyHttpProxy * * Copyright (C) 2010 Collabora, Ltd. + * Copyright (C) 2014 Red Hat, Inc. * @author Nicolas Dufresne nicolas.dufre...@collabora.co.uk + * @author Marc-André Lureau marcandre.lur...@redhat.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -180,10 +182,34 @@ wocky_http_proxy_connect (GProxy *proxy, { GInputStream *in; GOutputStream *out; - GDataInputStream *data_in; - gchar *buffer; + GDataInputStream *data_in = NULL; + gchar *buffer = NULL; gboolean has_cred; +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) +{ + GIOStream *tlsconn; + + tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); + if (!tlsconn) + goto error; + + GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG + tls_validation_flags = ~(G_TLS_CERTIFICATE_UNKNOWN_CA | G_TLS_CERTIFICATE_BAD_IDENTITY); +#endif + g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), +tls_validation_flags); + if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) + goto error; + + io_stream = tlsconn; +} +#endif + in = g_io_stream_get_input_stream (io_stream); out = g_io_stream_get_output_stream (io_stream); @@ -291,6 +317,41 @@ do_write (GAsyncReadyCallback callback, ConnectAsyncData *data) } static void +stream_connected (ConnectAsyncData *data, + GIOStream *io_stream) +{ + GInputStream *in; + + data-io_stream = g_object_ref (io_stream); + in = g_io_stream_get_input_stream (io_stream); + data-data_in = g_data_input_stream_new (in); + g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (data-data_in), + FALSE); + + do_write (request_write_cb, data); +} + +#if GLIB_CHECK_VERSION(2, 28, 0) +static void +handshake_completed (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GTlsConnection *conn = G_TLS_CONNECTION (source_object); + ConnectAsyncData *data = user_data; + GError *error = NULL; + + if (!g_tls_connection_handshake_finish (conn, res, error)) +{ + complete_async_from_error (data, error); + return; +} + + stream_connected (data, G_IO_STREAM (conn)); +} +#endif + +static void wocky_http_proxy_connect_async (GProxy *proxy, GIOStream *io_stream, GProxyAddress *proxy_address, @@ -300,34 +361,55 @@ wocky_http_proxy_connect_async (GProxy *proxy, { GSimpleAsyncResult *simple; ConnectAsyncData *data; - GInputStream *in; simple = g_simple_async_result_new (G_OBJECT (proxy), - callback, user_data, - wocky_http_proxy_connect_async); + callback, user_data, + wocky_http_proxy_connect_async); data = g_slice_new0 (ConnectAsyncData); - - data-simple = simple; - data-io_stream = g_object_ref (io_stream); - if (cancellable != NULL) data-cancellable = g_object_ref (cancellable); - - in = g_io_stream_get_input_stream (io_stream); - - data-data_in = g_data_input_stream_new (in); - g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (data-data_in), - FALSE); - - g_simple_async_result_set_op_res_gpointer (simple, data, - (GDestroyNotify) free_connect_data); + data-simple = simple; data-buffer = create_request (proxy_address, data-has_cred); data-length = strlen (data-buffer); data-offset = 0; - do_write (request_write_cb, data); + g_simple_async_result_set_op_res_gpointer (simple, data, + (GDestroyNotify)
[Spice-devel] [PATCH spice-gtk 08/14] Fill g_proxy_address_new() with protocol, user and password
From: Marc-André Lureau marcandre.lur...@redhat.com This way, the call might eventually support more proxy and authentication. --- gtk/spice-session.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 475306a..975fd7b 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -1724,8 +1724,11 @@ static void proxy_lookup_ready(GObject *source_object, GAsyncResult *result, for (it = addresses; it != NULL; it = it-next) { address = g_proxy_address_new(G_INET_ADDRESS(it-data), - spice_proxy_get_port(open_host-proxy), http, - s-host, open_host-port, NULL, NULL); + spice_proxy_get_port(open_host-proxy), + spice_proxy_get_protocol(open_host-proxy), + s-host, open_host-port, + spice_proxy_get_user(open_host-proxy), + spice_proxy_get_password(open_host-proxy)); if (address != NULL) break; } -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 10/14] channel: simplify has error code
From: Marc-André Lureau marcandre.lur...@redhat.com Get rid of a superflous g_socket_condition_check(). --- gtk/spice-channel.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index d47f19f..7bcb0b8 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -2099,29 +2099,23 @@ static gboolean wait_migration(gpointer data) static gboolean spice_channel_iterate(SpiceChannel *channel) { SpiceChannelPrivate *c = channel-priv; -GIOCondition ret; if (c-state == SPICE_CHANNEL_STATE_MIGRATING !g_coroutine_condition_wait(c-coroutine, wait_migration, channel)) CHANNEL_DEBUG(channel, migration wait cancelled); -if (c-has_error) { -CHANNEL_DEBUG(channel, channel has error, breaking loop); -return FALSE; -} - /* flush any pending write and read */ -SPICE_CHANNEL_GET_CLASS(channel)-iterate_write(channel); -SPICE_CHANNEL_GET_CLASS(channel)-iterate_read(channel); - -ret = g_socket_condition_check(c-sock, G_IO_IN | G_IO_ERR | G_IO_HUP); -if (c-state SPICE_CHANNEL_STATE_CONNECTING -ret (G_IO_ERR|G_IO_HUP)) { -SPICE_DEBUG(got socket error: %d, ret); -emit_main_context(channel, SPICE_CHANNEL_EVENT, - c-state == SPICE_CHANNEL_STATE_READY ? - SPICE_CHANNEL_ERROR_IO : SPICE_CHANNEL_ERROR_LINK); -c-has_error = TRUE; +if (!c-has_error) +SPICE_CHANNEL_GET_CLASS(channel)-iterate_write(channel); +if (!c-has_error) +SPICE_CHANNEL_GET_CLASS(channel)-iterate_read(channel); + +if (c-has_error) { +CHANNEL_DEBUG(channel, channel got error); +if (c-state SPICE_CHANNEL_STATE_CONNECTING) +emit_main_context(channel, SPICE_CHANNEL_EVENT, + c-state == SPICE_CHANNEL_STATE_READY ? + SPICE_CHANNEL_ERROR_IO : SPICE_CHANNEL_ERROR_LINK); return FALSE; } -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 11/14] channel: talk to giostream instead of gsocket
From: Marc-André Lureau marcandre.lur...@redhat.com --- gtk/spice-channel-priv.h | 4 ++- gtk/spice-channel.c | 81 +++- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h index 35704ea..00893c3 100644 --- a/gtk/spice-channel-priv.h +++ b/gtk/spice-channel-priv.h @@ -80,8 +80,10 @@ struct _SpiceChannelPrivate { SSL_CTX *ctx; SSL *ssl; SpiceOpenSSLVerify *sslverify; -GSocket *sock; +GSocket *socket; GSocketConnection *conn; +GInputStream*in; +GOutputStream *out; #if HAVE_SASL sasl_conn_t *sasl_conn; diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 7bcb0b8..b1e049d 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -763,7 +763,8 @@ static void spice_channel_flush_wire(SpiceChannel *channel, GIOCondition cond; while (offset datalen) { -int ret; +gssize ret; +GError *error = NULL; if (c-has_error) return; @@ -779,9 +780,12 @@ static void spice_channel_flush_wire(SpiceChannel *channel, ret = -1; } } else { -GError *error = NULL; -ret = g_socket_send(c-sock, ptr+offset, datalen-offset, -NULL, error); +#if GLIB_CHECK_VERSION(2, 28, 0) +ret = g_pollable_output_stream_write_nonblocking(G_POLLABLE_OUTPUT_STREAM(c-out), + ptr+offset, datalen-offset, NULL, error); +#else +ret = g_socket_send(c-socket, ptr+offset, datalen-offset, NULL, error); +#endif if (ret 0) { if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { cond = G_IO_OUT; @@ -794,7 +798,8 @@ static void spice_channel_flush_wire(SpiceChannel *channel, } if (ret == -1) { if (cond != 0) { -g_coroutine_socket_wait(c-coroutine, c-sock, cond); +// TODO: should use g_pollable_input/output_stream_create_source() in 2.28 ? +g_coroutine_socket_wait(c-coroutine, c-socket, cond); continue; } else { CHANNEL_DEBUG(channel, Closing the channel: spice_channel_flush %d, errno); @@ -888,7 +893,7 @@ static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out) static int spice_channel_read_wire(SpiceChannel *channel, void *data, size_t len) { SpiceChannelPrivate *c = channel-priv; -int ret; +gssize ret; GIOCondition cond; reread: @@ -908,7 +913,13 @@ reread: } } else { GError *error = NULL; -ret = g_socket_receive(c-sock, data, len, NULL, error); +#if GLIB_CHECK_VERSION(2, 28, 0) +ret = g_pollable_input_stream_read_nonblocking(G_POLLABLE_INPUT_STREAM(c-in), + data, len, NULL, error); +#else +ret = g_socket_receive(c-socket, + data, len, NULL, error); +#endif if (ret 0) { if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { cond = G_IO_IN; @@ -922,7 +933,8 @@ reread: if (ret == -1) { if (cond != 0) { -g_coroutine_socket_wait(c-coroutine, c-sock, cond); +// TODO: should use g_pollable_input/output_stream_create_source() ? +g_coroutine_socket_wait(c-coroutine, c-socket, cond); goto reread; } else { c-has_error = TRUE; @@ -1351,7 +1363,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel) } /* Get local address in form IPADDR:PORT */ -addr = g_socket_get_local_address(c-sock, NULL); +addr = g_socket_get_local_address(c-socket, NULL); if (!addr) { g_critical(failed to get local address); goto error; @@ -1363,7 +1375,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel) g_clear_object(addr); /* Get remote address in form IPADDR:PORT */ -addr = g_socket_get_remote_address(c-sock, NULL); +addr = g_socket_get_remote_address(c-socket, NULL); if (!addr) { g_critical(failed to get peer address); goto error; @@ -2062,14 +2074,17 @@ static void spice_channel_iterate_read(SpiceChannel *channel) { SpiceChannelPrivate *c = channel-priv; -g_coroutine_socket_wait(c-coroutine, c-sock, G_IO_IN); +g_coroutine_socket_wait(c-coroutine, c-socket, G_IO_IN); /* treat all incoming data (block on message completion) */ while (!c-has_error c-state != SPICE_CHANNEL_STATE_MIGRATING - g_socket_condition_check(c-sock, G_IO_IN) G_IO_IN) { - -do +#if
[Spice-devel] [PATCH spice-gtk 13/14] channel: add spice_channel_get_error()
From: Marc-André Lureau marcandre.lur...@redhat.com Add a function to retrieve the last GError from a channel, this may be useful to provide additional error details to the client. --- doc/reference/spice-gtk-sections.txt | 1 + gtk/map-file | 1 + gtk/spice-channel-priv.h | 1 + gtk/spice-channel.c | 26 -- gtk/spice-channel.h | 2 ++ gtk/spice-glib-sym-file | 1 + gtk/spice-session-priv.h | 2 +- gtk/spice-session.c | 6 +++--- gtk/spicy.c | 6 ++ 9 files changed, 40 insertions(+), 6 deletions(-) diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index 411ca0e..9f0cf67 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -102,6 +102,7 @@ spice_channel_string_to_type spice_channel_set_capability spice_channel_flush_async spice_channel_flush_finish +spice_channel_get_error SUBSECTION Standard SPICE_TYPE_CHANNEL_EVENT spice_channel_event_get_type diff --git a/gtk/map-file b/gtk/map-file index 82a10eb..0067960 100644 --- a/gtk/map-file +++ b/gtk/map-file @@ -7,6 +7,7 @@ spice_channel_connect; spice_channel_destroy; spice_channel_disconnect; spice_channel_event_get_type; +spice_channel_get_error; spice_channel_get_type; spice_channel_new; spice_channel_open_fd; diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h index 00893c3..fc15c0e 100644 --- a/gtk/spice-channel-priv.h +++ b/gtk/spice-channel-priv.h @@ -136,6 +136,7 @@ struct _SpiceChannelPrivate { GSList *flushing; gbooleandisable_channel_msg; +GError *error; }; SpiceMsgIn *spice_msg_in_new(SpiceChannel *channel); diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index b1e049d..13992c1 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -154,6 +154,8 @@ static void spice_channel_dispose(GObject *gobject) c-session = NULL; } +g_clear_error(c-error); + /* Chain up to the parent class */ if (G_OBJECT_CLASS(spice_channel_parent_class)-dispose) G_OBJECT_CLASS(spice_channel_parent_class)-dispose(gobject); @@ -2220,6 +,25 @@ static int spice_channel_load_ca(SpiceChannel *channel) return count; } +/** + * spice_channel_get_error: + * @channel: + * + * Retrieves the #GError currently set on channel, if the #SpiceChannel + * is in error state. + * + * Returns: the pointer to the error, or NULL + * Since: 0.24 + **/ +const GError* spice_channel_get_error(SpiceChannel *self) +{ +SpiceChannelPrivate *c; + +g_return_val_if_fail(SPICE_IS_CHANNEL(self), NULL); +c = self-priv; + +return c-error; +} /* coroutine context */ static void *spice_channel_coroutine(void *data) @@ -2257,15 +2278,16 @@ static void *spice_channel_coroutine(void *data) reconnect: -c-conn = spice_session_channel_open_host(c-session, channel, c-tls); +c-conn = spice_session_channel_open_host(c-session, channel, c-tls, c-error); if (c-conn == NULL) { -if (!c-tls) { +if (!c-error !c-tls) { CHANNEL_DEBUG(channel, trying with TLS port); c-tls = true; /* FIXME: does that really work with provided fd */ goto reconnect; } else { CHANNEL_DEBUG(channel, Connect error); emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_CONNECT); +g_clear_error(c-error); goto cleanup; } } diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h index 705dddf..1c303b4 100644 --- a/gtk/spice-channel.h +++ b/gtk/spice-channel.h @@ -123,6 +123,8 @@ void spice_channel_set_capability(SpiceChannel *channel, guint32 cap); const gchar* spice_channel_type_to_string(gint type); gint spice_channel_string_to_type(const gchar *str); +const GError* spice_channel_get_error(SpiceChannel *channel); + G_END_DECLS #endif /* __SPICE_CLIENT_CHANNEL_H__ */ diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file index 3dc709a..9d5001a 100644 --- a/gtk/spice-glib-sym-file +++ b/gtk/spice-glib-sym-file @@ -7,6 +7,7 @@ spice_channel_disconnect spice_channel_event_get_type spice_channel_flush_async spice_channel_flush_finish +spice_channel_get_error spice_channel_get_type spice_channel_new spice_channel_open_fd diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h index 85a1dad..cf9f9d1 100644 --- a/gtk/spice-session-priv.h +++ b/gtk/spice-session-priv.h @@ -119,7 +119,7 @@ int spice_session_get_connection_id(SpiceSession *session); gboolean spice_session_get_client_provided_socket(SpiceSession *session); GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceChannel *channel, - gboolean *use_tls); +
[Spice-devel] [PATCH spice-gtk 12/14] Make SpiceURI a public API
From: Marc-André Lureau marcandre.lur...@redhat.com Generalize a little bit SpiceProxy to allow easy URI manipulation by clients. --- doc/reference/Makefile.am| 1 + doc/reference/spice-gtk-docs.xml | 1 + doc/reference/spice-gtk-sections.txt | 26 +++ gtk/Makefile.am | 5 +- gtk/map-file | 12 ++ gtk/spice-client.h | 1 + gtk/spice-glib-sym-file | 12 ++ gtk/spice-proxy.c| 362 --- gtk/spice-proxy.h| 64 --- gtk/spice-session-priv.h | 3 +- gtk/spice-session.c | 28 +-- gtk/spice-session.h | 1 + gtk/spice-uri-priv.h | 30 +++ gtk/spice-uri.c | 360 ++ gtk/spice-uri.h | 52 + 15 files changed, 514 insertions(+), 444 deletions(-) delete mode 100644 gtk/spice-proxy.c delete mode 100644 gtk/spice-proxy.h create mode 100644 gtk/spice-uri-priv.h create mode 100644 gtk/spice-uri.c create mode 100644 gtk/spice-uri.h diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index a0a856c..76c7d34 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -44,6 +44,7 @@ IGNORE_HFILES=\ spice-marshal.h \ spice-pulse.h \ spice-session-priv.h\ + spice-uri-priv.h\ spice-util-priv.h \ spice-widget-priv.h \ usb-acl-helper.h\ diff --git a/doc/reference/spice-gtk-docs.xml b/doc/reference/spice-gtk-docs.xml index 4a9a3cf..d2c1a2b 100644 --- a/doc/reference/spice-gtk-docs.xml +++ b/doc/reference/spice-gtk-docs.xml @@ -52,6 +52,7 @@ xi:include href=xml/smartcard-manager.xml/ xi:include href=xml/usb-device-manager.xml/ xi:include href=xml/spice-util.xml/ + xi:include href=xml/spice-uri.xml/ /chapter /part diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index 8d61aa9..411ca0e 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -429,3 +429,29 @@ SPICE_PORT_CHANNEL_GET_CLASS SpicePortChannelPrivate /SECTION +SECTION +FILEspice-uri/FILE +spice_uri_get_scheme +spice_uri_set_scheme +spice_uri_get_hostname +spice_uri_set_hostname +spice_uri_get_port +spice_uri_set_port +spice_uri_get_user +spice_uri_set_user +spice_uri_get_password +spice_uri_set_password +spice_uri_to_string +SpiceURIClass +SpiceURI +SUBSECTION Standard +SPICE_IS_URI +SPICE_IS_URI_CLASS +SPICE_TYPE_URI +SPICE_URI +SPICE_URI_CLASS +SPICE_URI_GET_CLASS +spice_uri_get_type +SUBSECTION Private +SpiceURIPrivate +/SECTION diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 0740e96..dc09d8c 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -251,8 +251,8 @@ libspice_client_glib_2_0_la_SOURCES = \ channel-usbredir-priv.h \ smartcard-manager.c \ smartcard-manager-priv.h\ - spice-proxy.c \ - spice-proxy.h \ + spice-uri.c \ + spice-uri-priv.h\ usb-device-manager.c\ usb-device-manager-priv.h \ usbutil.c \ @@ -287,6 +287,7 @@ libspice_client_glibincludedir = $(includedir)/spice-client-glib-2.0 libspice_client_glibinclude_HEADERS = \ spice-audio.h \ spice-client.h \ + spice-uri.h \ spice-types.h \ spice-session.h \ spice-channel.h \ diff --git a/gtk/map-file b/gtk/map-file index b6c184d..82a10eb 100644 --- a/gtk/map-file +++ b/gtk/map-file @@ -119,6 +119,18 @@ spice_util_get_version_string; spice_util_set_debug; spice_uuid_to_string; spice_webdav_channel_get_type; +spice_uri_get_hostname; +spice_uri_get_password; +spice_uri_get_port; +spice_uri_get_scheme; +spice_uri_get_type; +spice_uri_get_user; +spice_uri_set_hostname; +spice_uri_set_password; +spice_uri_set_port; +spice_uri_set_scheme; +spice_uri_set_user; +spice_uri_to_string; local: *; }; diff --git a/gtk/spice-client.h b/gtk/spice-client.h index f5c8aa7..1f80419 100644 --- a/gtk/spice-client.h +++ b/gtk/spice-client.h @@ -31,6 +31,7 @@ #include spice-session.h #include spice-channel.h #include spice-option.h +#include spice-uri.h #include channel-main.h #include channel-display.h diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file
[Spice-devel] [PATCH spice-gtk 14/14] session: add spice_session_get_proxy_uri()
From: Marc-André Lureau marcandre.lur...@redhat.com Learn to return the currently configured proxy, to allow client to tweak parameters, such as username and password. --- doc/reference/spice-gtk-sections.txt | 1 + gtk/map-file | 1 + gtk/spice-glib-sym-file | 1 + gtk/spice-session.c | 14 ++ gtk/spice-session.h | 1 + 5 files changed, 18 insertions(+) diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index 9f0cf67..08b1b4e 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -28,6 +28,7 @@ spice_session_disconnect spice_session_get_channels spice_session_get_read_only spice_session_has_channel_type +spice_session_get_proxy_uri SUBSECTION SpiceSessionMigration SpiceSessionVerify diff --git a/gtk/map-file b/gtk/map-file index 0067960..2a46159 100644 --- a/gtk/map-file +++ b/gtk/map-file @@ -90,6 +90,7 @@ spice_session_migration_get_type; spice_session_new; spice_session_open_fd; spice_session_verify_get_type; +spice_session_get_proxy_uri; spice_set_session_option; spice_smartcard_channel_get_type; spice_smartcard_manager_get; diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file index 9d5001a..20f3885 100644 --- a/gtk/spice-glib-sym-file +++ b/gtk/spice-glib-sym-file @@ -106,3 +106,4 @@ spice_uri_set_port spice_uri_set_scheme spice_uri_set_user spice_uri_to_string +spice_session_get_proxy_uri diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 5e76b5f..ea32cf7 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -2190,3 +2190,17 @@ guint32 spice_session_get_playback_latency(SpiceSession *session) return 0; } } + +/** + * spice_session_get_proxy_uri: + * @session: a #SpiceSession + * + * Returns: (transfer none): the session proxy #SpiceURI or %NULL. + * Since: 0.24 + **/ +SpiceURI *spice_session_get_proxy_uri(SpiceSession *session) +{ +SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); + +return s-proxy; +} diff --git a/gtk/spice-session.h b/gtk/spice-session.h index 4ea645e..665c609 100644 --- a/gtk/spice-session.h +++ b/gtk/spice-session.h @@ -93,6 +93,7 @@ void spice_session_disconnect(SpiceSession *session); GList *spice_session_get_channels(SpiceSession *session); gboolean spice_session_has_channel_type(SpiceSession *session, gint type); gboolean spice_session_get_read_only(SpiceSession *session); +SpiceURI *spice_session_get_proxy_uri(SpiceSession *session); G_END_DECLS -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 03/14] proxy: add user and pass properties
From: Marc-André Lureau marcandre.lur...@redhat.com --- gtk/spice-proxy.c | 72 +++ gtk/spice-proxy.h | 4 2 files changed, 76 insertions(+) diff --git a/gtk/spice-proxy.c b/gtk/spice-proxy.c index f338213..7711e83 100644 --- a/gtk/spice-proxy.c +++ b/gtk/spice-proxy.c @@ -26,6 +26,8 @@ struct _SpiceProxyPrivate { gchar *protocol; gchar *hostname; guint port; +gchar *user; +gchar *password; }; #define SPICE_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), SPICE_TYPE_PROXY, SpiceProxyPrivate)) @@ -35,6 +37,8 @@ G_DEFINE_TYPE(SpiceProxy, spice_proxy, G_TYPE_OBJECT); enum { SPICE_PROXY_DUMMY_PROPERTY, SPICE_PROXY_PROTOCOL, +SPICE_PROXY_USER, +SPICE_PROXY_PASSWORD, SPICE_PROXY_HOSTNAME, SPICE_PROXY_PORT }; @@ -173,6 +177,12 @@ static void spice_proxy_get_property(GObject *object, guint property_id, case SPICE_PROXY_PORT: g_value_set_uint(value, spice_proxy_get_port(self)); break; +case SPICE_PROXY_USER: +g_value_set_string(value, spice_proxy_get_user(self)); +break; +case SPICE_PROXY_PASSWORD: +g_value_set_string(value, spice_proxy_get_password(self)); +break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); break; @@ -193,6 +203,12 @@ static void spice_proxy_set_property(GObject *object, guint property_id, case SPICE_PROXY_HOSTNAME: spice_proxy_set_hostname(self, g_value_get_string(value)); break; +case SPICE_PROXY_USER: +spice_proxy_set_user(self, g_value_get_string(value)); +break; +case SPICE_PROXY_PASSWORD: +spice_proxy_set_password(self, g_value_get_string(value)); +break; case SPICE_PROXY_PORT: spice_proxy_set_port(self, g_value_get_uint(value)); break; @@ -209,6 +225,8 @@ static void spice_proxy_finalize(GObject* obj) self = G_TYPE_CHECK_INSTANCE_CAST(obj, SPICE_TYPE_PROXY, SpiceProxy); g_free(self-priv-protocol); g_free(self-priv-hostname); +g_free(self-priv-user); +g_free(self-priv-password); G_OBJECT_CLASS (spice_proxy_parent_class)-finalize (obj); } @@ -254,6 +272,24 @@ static void spice_proxy_class_init(SpiceProxyClass *klass) 0, G_MAXUINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); + +g_object_class_install_property(G_OBJECT_CLASS (klass), +SPICE_PROXY_USER, +g_param_spec_string (user, + user, + user, + NULL, + G_PARAM_STATIC_STRINGS | + G_PARAM_READWRITE)); + +g_object_class_install_property(G_OBJECT_CLASS (klass), +SPICE_PROXY_PASSWORD, +g_param_spec_string (password, + password, + password, + NULL, + G_PARAM_STATIC_STRINGS | + G_PARAM_READWRITE)); } G_GNUC_INTERNAL @@ -269,3 +305,39 @@ gchar* spice_proxy_to_string(SpiceProxy* self) return g_strdup_printf(%s://%s:%u, p-protocol, p-hostname, p-port); } + +G_GNUC_INTERNAL +const gchar* spice_proxy_get_user(SpiceProxy *self) +{ +g_return_val_if_fail(SPICE_IS_PROXY(self), NULL); +return self-priv-user; +} + + +G_GNUC_INTERNAL +void spice_proxy_set_user(SpiceProxy *self, const gchar *value) +{ +g_return_if_fail(SPICE_IS_PROXY(self)); + +g_free(self-priv-user); +self-priv-user = g_strdup(value); +g_object_notify((GObject *)self, user); +} + +G_GNUC_INTERNAL +const gchar* spice_proxy_get_password(SpiceProxy *self) +{ +g_return_val_if_fail(SPICE_IS_PROXY(self), NULL); +return self-priv-password; +} + + +G_GNUC_INTERNAL +void spice_proxy_set_password(SpiceProxy *self, const gchar *value) +{ +g_return_if_fail(SPICE_IS_PROXY(self)); + +g_free(self-priv-password); +self-priv-password = g_strdup(value); +g_object_notify((GObject *)self, password); +} diff --git a/gtk/spice-proxy.h b/gtk/spice-proxy.h index 1e7b6d7..e74053b 100644 --- a/gtk/spice-proxy.h +++ b/gtk/spice-proxy.h @@ -54,6 +54,10 @@ void spice_proxy_set_hostname(SpiceProxy* self, const gchar* value); guint spice_proxy_get_port(SpiceProxy* self); void spice_proxy_set_port(SpiceProxy* self, guint port); gchar
Re: [Spice-devel] guest agent windows binaries
On Wed, 12 Feb 2014 09:16:04 AM Christophe Fergeau wrote: http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw3 2-spice-vdagent-0.7.2-1.fc19.noarch.rpm and http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw6 4-spice-vdagent-0.7.2-1.fc19.noarch.rpm contain the binaries: $ rpm -qpl ./mingw64-spice-vdagent-0.7.2-1.fc19.noarch.rpm /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdagent.exe /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdservice.exe Why pack windows binaries in a rpm that can't be unpacked on windows? Thanks, but I'll try replicating the binaries and service entries from a win 7 installation. Also - could someone *please* clarify the current and future status of windows 8/2012 drivers and guest tools? its extremely confusing trying to track down this information. No QXL driver, the virtio-win drivers (located at https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/ ) seem to have win8 versions Couldn't get them to install myself. , and the agent should be working as well on win8. I've never tried these though. I believe I have been labouring under the misapprehension that the qxl driver was necessary for the vdagent and all its goodies (display resizing, hot keys etc) to work, but that is not the case? It will need the virtio driver though won't it? I'll rebundle vdagent for win8/2012 and see how it goes. Thanks, -- Lindsay signature.asc Description: This is a digitally signed message part. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 06/13] http-proxy: add https proxy
On Tue, Feb 11, 2014 at 12:37:53PM -0500, Marc-André Lureau wrote: static void wocky_http_proxy_init (WockyHttpProxy *proxy) @@ -180,10 +182,34 @@ wocky_http_proxy_connect (GProxy *proxy, { GInputStream *in; GOutputStream *out; - GDataInputStream *data_in; - gchar *buffer; + GDataInputStream *data_in = NULL; + gchar *buffer = NULL; gboolean has_cred; +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) Having runtime type checks in a interface virtual method is not very nice, having a wocky_https_proxy_iface_init would allow to call directly the right implementation without having to resort to runtime type checking. I decided to use this consciously, as doing it differently added much more boilerplate for no clear benefit. Gave it a quick try (only compile-tested), and the resulting code is not particularly bad. Having both inheritance and runtime type checks is imo quite ugly. I can send a follow-up patch after your series land if it's likely to be accepted. diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c index 25f2af5..3eb6931 100644 --- a/gtk/wocky-http-proxy.c +++ b/gtk/wocky-http-proxy.c @@ -186,30 +186,6 @@ wocky_http_proxy_connect (GProxy *proxy, gchar *buffer = NULL; gboolean has_cred; -#if GLIB_CHECK_VERSION(2, 28, 0) - if (WOCKY_IS_HTTPS_PROXY (proxy)) -{ - GIOStream *tlsconn; - - tlsconn = g_tls_client_connection_new (io_stream, - G_SOCKET_CONNECTABLE(proxy_address), - error); - if (!tlsconn) - goto error; - - GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; -#ifdef DEBUG - tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; -#endif - g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), -tls_validation_flags); - if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) - goto error; - - io_stream = tlsconn; -} -#endif - in = g_io_stream_get_input_stream (io_stream); out = g_io_stream_get_output_stream (io_stream); @@ -251,6 +227,41 @@ error: return NULL; } +#if GLIB_CHECK_VERSION(2, 28, 0) +static GIOStream * +wocky_https_proxy_connect (GProxy *proxy, + GIOStream *io_stream, + GProxyAddress *proxy_address, + GCancellable *cancellable, + GError **error) +{ +{ +GIOStream *tlsconn; + +tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); +if (!tlsconn) +goto error; + +GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG +tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif +g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), + tls_validation_flags); +if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) +goto error; + +io_stream = tlsconn; +} +return wocky_http_proxy_connect(proxy, io_stream, proxy_address, cancellable, error); + +error: +return NULL; +} +#endif + typedef struct { @@ -351,8 +362,9 @@ handshake_completed (GObject *source_object, } #endif -static void -wocky_http_proxy_connect_async (GProxy *proxy, +static ConnectAsyncData * +wocky_http_proxy_connect_async_data_new ( +GProxy *proxy, GIOStream *io_stream, GProxyAddress *proxy_address, GCancellable *cancellable, @@ -364,7 +376,7 @@ wocky_http_proxy_connect_async (GProxy *proxy, simple = g_simple_async_result_new (G_OBJECT (proxy), callback, user_data, - wocky_http_proxy_connect_async); + wocky_http_proxy_connect_async_data_new); data = g_slice_new0 (ConnectAsyncData); if (cancellable != NULL) @@ -378,12 +390,30 @@ wocky_http_proxy_connect_async (GProxy *proxy, g_simple_async_result_set_op_res_gpointer (simple, data, (GDestroyNotify) free_connect_data); + return data; +} + + #if GLIB_CHECK_VERSION(2, 28, 0) - if (WOCKY_IS_HTTPS_PROXY (proxy)) +static void +wocky_https_proxy_connect_async (GProxy *proxy, + GIOStream *io_stream, + GProxyAddress *proxy_address, +
Re: [Spice-devel] guest agent windows binaries
- Original Message - On Wed, 12 Feb 2014 09:16:04 AM Christophe Fergeau wrote: http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw3 2-spice-vdagent-0.7.2-1.fc19.noarch.rpm and http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw6 4-spice-vdagent-0.7.2-1.fc19.noarch.rpm contain the binaries: $ rpm -qpl ./mingw64-spice-vdagent-0.7.2-1.fc19.noarch.rpm /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdagent.exe /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdservice.exe Why pack windows binaries in a rpm that can't be unpacked on windows? Thanks, but I'll try replicating the binaries and service entries from a win 7 installation. I'll work on making an MSI installer for it, that shouldn't be difficult. thanks for the reminder Also - could someone *please* clarify the current and future status of windows 8/2012 drivers and guest tools? its extremely confusing trying to track down this information. No QXL driver, the virtio-win drivers (located at https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/ ) seem to have win8 versions Couldn't get them to install myself. , and the agent should be working as well on win8. I've never tried these though. I believe I have been labouring under the misapprehension that the qxl driver was necessary for the vdagent and all its goodies (display resizing, hot keys etc) to work, but that is not the case? It will need the virtio driver though won't it? I'll rebundle vdagent for win8/2012 and see how it goes. Thanks, -- Lindsay ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 06/13] http-proxy: add https proxy
On Wed, Feb 12, 2014 at 11:48 AM, Christophe Fergeau cferg...@redhat.com wrote: On Tue, Feb 11, 2014 at 12:37:53PM -0500, Marc-André Lureau wrote: static void wocky_http_proxy_init (WockyHttpProxy *proxy) @@ -180,10 +182,34 @@ wocky_http_proxy_connect (GProxy *proxy, { GInputStream *in; GOutputStream *out; - GDataInputStream *data_in; - gchar *buffer; + GDataInputStream *data_in = NULL; + gchar *buffer = NULL; gboolean has_cred; +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) Having runtime type checks in a interface virtual method is not very nice, having a wocky_https_proxy_iface_init would allow to call directly the right implementation without having to resort to runtime type checking. I decided to use this consciously, as doing it differently added much more boilerplate for no clear benefit. Gave it a quick try (only compile-tested), and the resulting code is not particularly bad. Having both inheritance and runtime type checks is imo quite ugly. I can send a follow-up patch after your series land if it's likely to be accepted. Sure, I'll review then (the patch below looks incomplete from a brief view). I still prefer a runtime type check for this final case. diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c index 25f2af5..3eb6931 100644 --- a/gtk/wocky-http-proxy.c +++ b/gtk/wocky-http-proxy.c @@ -186,30 +186,6 @@ wocky_http_proxy_connect (GProxy *proxy, gchar *buffer = NULL; gboolean has_cred; -#if GLIB_CHECK_VERSION(2, 28, 0) - if (WOCKY_IS_HTTPS_PROXY (proxy)) -{ - GIOStream *tlsconn; - - tlsconn = g_tls_client_connection_new (io_stream, - G_SOCKET_CONNECTABLE(proxy_address), - error); - if (!tlsconn) - goto error; - - GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; -#ifdef DEBUG - tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; -#endif - g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), -tls_validation_flags); - if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) - goto error; - - io_stream = tlsconn; -} -#endif - in = g_io_stream_get_input_stream (io_stream); out = g_io_stream_get_output_stream (io_stream); @@ -251,6 +227,41 @@ error: return NULL; } +#if GLIB_CHECK_VERSION(2, 28, 0) +static GIOStream * +wocky_https_proxy_connect (GProxy *proxy, + GIOStream *io_stream, + GProxyAddress *proxy_address, + GCancellable *cancellable, + GError **error) +{ +{ +GIOStream *tlsconn; + +tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); +if (!tlsconn) +goto error; + +GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG +tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif +g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), + tls_validation_flags); +if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) +goto error; + +io_stream = tlsconn; +} +return wocky_http_proxy_connect(proxy, io_stream, proxy_address, cancellable, error); + +error: +return NULL; +} +#endif + typedef struct { @@ -351,8 +362,9 @@ handshake_completed (GObject *source_object, } #endif -static void -wocky_http_proxy_connect_async (GProxy *proxy, +static ConnectAsyncData * +wocky_http_proxy_connect_async_data_new ( +GProxy *proxy, GIOStream *io_stream, GProxyAddress *proxy_address, GCancellable *cancellable, @@ -364,7 +376,7 @@ wocky_http_proxy_connect_async (GProxy *proxy, simple = g_simple_async_result_new (G_OBJECT (proxy), callback, user_data, - wocky_http_proxy_connect_async); + wocky_http_proxy_connect_async_data_new); data = g_slice_new0 (ConnectAsyncData); if (cancellable != NULL) @@ -378,12 +390,30 @@ wocky_http_proxy_connect_async (GProxy *proxy, g_simple_async_result_set_op_res_gpointer (simple, data, (GDestroyNotify) free_connect_data); +
Re: [Spice-devel] [spice-gtk 06/13] http-proxy: add https proxy
On Mon, Feb 03, 2014 at 07:02:37PM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com This will require glib 2.28 for GTls support, atm --- gtk/spice-session.c| 3 + gtk/wocky-http-proxy.c | 166 + gtk/wocky-http-proxy.h | 14 + 3 files changed, 157 insertions(+), 26 deletions(-) diff --git a/gtk/spice-session.c b/gtk/spice-session.c index ae14a1f..6ac397c 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -636,6 +636,9 @@ static void spice_session_class_init(SpiceSessionClass *klass) #if GLIB_CHECK_VERSION(2, 26, 0) _wocky_http_proxy_get_type(); #endif +#if GLIB_CHECK_VERSION(2, 28, 0) +_wocky_https_proxy_get_type(); +#endif gobject_class-dispose = spice_session_dispose; gobject_class-finalize = spice_session_finalize; diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c index 7210859..25f2af5 100644 --- a/gtk/wocky-http-proxy.c +++ b/gtk/wocky-http-proxy.c @@ -1,7 +1,9 @@ /* wocky-http-proxy.c: Source for WockyHttpProxy * * Copyright (C) 2010 Collabora, Ltd. + * Copyright (C) 2014 Red Hat, Inc. * @author Nicolas Dufresne nicolas.dufre...@collabora.co.uk + * @author Marc-André Lureau marcandre.lur...@redhat.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -40,13 +42,13 @@ static void wocky_http_proxy_iface_init (GProxyInterface *proxy_iface); #define wocky_http_proxy_get_type _wocky_http_proxy_get_type G_DEFINE_TYPE_WITH_CODE (WockyHttpProxy, wocky_http_proxy, G_TYPE_OBJECT, -G_IMPLEMENT_INTERFACE (G_TYPE_PROXY, - wocky_http_proxy_iface_init) -g_io_extension_point_set_required_type ( - g_io_extension_point_register (G_PROXY_EXTENSION_POINT_NAME), - G_TYPE_PROXY); -g_io_extension_point_implement (G_PROXY_EXTENSION_POINT_NAME, - g_define_type_id, http, 0)) + G_IMPLEMENT_INTERFACE (G_TYPE_PROXY, +wocky_http_proxy_iface_init) + g_io_extension_point_set_required_type ( +g_io_extension_point_register (G_PROXY_EXTENSION_POINT_NAME), +G_TYPE_PROXY); + g_io_extension_point_implement (G_PROXY_EXTENSION_POINT_NAME, +g_define_type_id, http, 0)) static void wocky_http_proxy_init (WockyHttpProxy *proxy) @@ -180,10 +182,34 @@ wocky_http_proxy_connect (GProxy *proxy, { GInputStream *in; GOutputStream *out; - GDataInputStream *data_in; - gchar *buffer; + GDataInputStream *data_in = NULL; + gchar *buffer = NULL; gboolean has_cred; +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) +{ + GIOStream *tlsconn; + + tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); + if (!tlsconn) + goto error; + + GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG + tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif + g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), +tls_validation_flags); + if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) + goto error; + + io_stream = tlsconn; Missed that initially, but tlsconn is leaked in error cases, and I think we will leak a reference to it in success case too. My understanding is that we don't own the io_stream passed as an argument, so we need to ref it in the http case, but in the https case, we already own a ref on the io_stream (which is tlsconn), so we ref it one too many. + +static void wocky_http_proxy_connect_async (GProxy *proxy, GIOStream *io_stream, GProxyAddress *proxy_address, @@ -300,34 +361,55 @@ wocky_http_proxy_connect_async (GProxy *proxy, + +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) +{ + GError *error = NULL; + GIOStream *tlsconn; + + tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); + if (error) +{ + complete_async_from_error (data, error); tlsconn is leaked here (dunno if it's guaranteed to be NULL when error is set). + return; +} + + g_return_if_fail (tlsconn != NULL); + + GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG + tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif + g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), +
Re: [Spice-devel] guest agent windows binaries
On Wed, Feb 12, 2014 at 08:48:44PM +1000, Lindsay Mathieson wrote: On Wed, 12 Feb 2014 09:16:04 AM Christophe Fergeau wrote: http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw3 2-spice-vdagent-0.7.2-1.fc19.noarch.rpm and http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw6 4-spice-vdagent-0.7.2-1.fc19.noarch.rpm contain the binaries: $ rpm -qpl ./mingw64-spice-vdagent-0.7.2-1.fc19.noarch.rpm /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdagent.exe /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdservice.exe Why pack windows binaries in a rpm that can't be unpacked on windows? Because that's how I get them from from the fedora build system, because I haven't automated much of the generation of the spice guest tools installer, because that's already a lot of manual steps, ... Christophe pgpX_EDxpt2Vh.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 06/13] http-proxy: add https proxy
On Wed, Feb 12, 2014 at 11:59 AM, Christophe Fergeau cferg...@redhat.com wrote: On Mon, Feb 03, 2014 at 07:02:37PM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com This will require glib 2.28 for GTls support, atm --- gtk/spice-session.c| 3 + gtk/wocky-http-proxy.c | 166 + gtk/wocky-http-proxy.h | 14 + 3 files changed, 157 insertions(+), 26 deletions(-) diff --git a/gtk/spice-session.c b/gtk/spice-session.c index ae14a1f..6ac397c 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -636,6 +636,9 @@ static void spice_session_class_init(SpiceSessionClass *klass) #if GLIB_CHECK_VERSION(2, 26, 0) _wocky_http_proxy_get_type(); #endif +#if GLIB_CHECK_VERSION(2, 28, 0) +_wocky_https_proxy_get_type(); +#endif gobject_class-dispose = spice_session_dispose; gobject_class-finalize = spice_session_finalize; diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c index 7210859..25f2af5 100644 --- a/gtk/wocky-http-proxy.c +++ b/gtk/wocky-http-proxy.c @@ -1,7 +1,9 @@ /* wocky-http-proxy.c: Source for WockyHttpProxy * * Copyright (C) 2010 Collabora, Ltd. + * Copyright (C) 2014 Red Hat, Inc. * @author Nicolas Dufresne nicolas.dufre...@collabora.co.uk + * @author Marc-André Lureau marcandre.lur...@redhat.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -40,13 +42,13 @@ static void wocky_http_proxy_iface_init (GProxyInterface *proxy_iface); #define wocky_http_proxy_get_type _wocky_http_proxy_get_type G_DEFINE_TYPE_WITH_CODE (WockyHttpProxy, wocky_http_proxy, G_TYPE_OBJECT, -G_IMPLEMENT_INTERFACE (G_TYPE_PROXY, - wocky_http_proxy_iface_init) -g_io_extension_point_set_required_type ( - g_io_extension_point_register (G_PROXY_EXTENSION_POINT_NAME), - G_TYPE_PROXY); -g_io_extension_point_implement (G_PROXY_EXTENSION_POINT_NAME, - g_define_type_id, http, 0)) + G_IMPLEMENT_INTERFACE (G_TYPE_PROXY, +wocky_http_proxy_iface_init) + g_io_extension_point_set_required_type ( +g_io_extension_point_register (G_PROXY_EXTENSION_POINT_NAME), +G_TYPE_PROXY); + g_io_extension_point_implement (G_PROXY_EXTENSION_POINT_NAME, +g_define_type_id, http, 0)) static void wocky_http_proxy_init (WockyHttpProxy *proxy) @@ -180,10 +182,34 @@ wocky_http_proxy_connect (GProxy *proxy, { GInputStream *in; GOutputStream *out; - GDataInputStream *data_in; - gchar *buffer; + GDataInputStream *data_in = NULL; + gchar *buffer = NULL; gboolean has_cred; +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) +{ + GIOStream *tlsconn; + + tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); + if (!tlsconn) + goto error; + + GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG + tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif + g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), +tls_validation_flags); + if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) + goto error; + + io_stream = tlsconn; Missed that initially, but tlsconn is leaked in error cases, and I think we will leak a reference to it in success case too. My understanding is that if error, function returns NULL we don't own the io_stream passed as an argument, so we need to ref it in the http case, but in the https case, we already own a ref on the io_stream (which is tlsconn), so we ref it one too many. Where do you see we ref something? I remember I did check with valgrind and debugging than all references where correct. But I could be wrong. Please give further details. + +static void wocky_http_proxy_connect_async (GProxy *proxy, GIOStream *io_stream, GProxyAddress *proxy_address, @@ -300,34 +361,55 @@ wocky_http_proxy_connect_async (GProxy *proxy, + +#if GLIB_CHECK_VERSION(2, 28, 0) + if (WOCKY_IS_HTTPS_PROXY (proxy)) +{ + GError *error = NULL; + GIOStream *tlsconn; + + tlsconn = g_tls_client_connection_new (io_stream, + G_SOCKET_CONNECTABLE(proxy_address), + error); + if (error) +{ + complete_async_from_error (data, error); tlsconn is leaked here (dunno if it's guaranteed to be NULL when error is set). Yes it is guaratee, I can add a warning and g_clear_object if you want. + return; +} + +
Re: [Spice-devel] guest agent windows binaries
On Wed, 12 Feb 2014 12:00:45 PM Christophe Fergeau wrote: Because that's how I get them from from the fedora build system, because I haven't automated much of the generation of the spice guest tools installer, because that's already a lot of manual steps, ... Fair enough :) thanks. -- Lindsay signature.asc Description: This is a digitally signed message part. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] guest agent windows binaries
- Original Message - From: Lindsay Mathieson lindsay.mathie...@gmail.com To: spice-devel@lists.freedesktop.org Sent: Wednesday, February 12, 2014 11:48:44 AM Subject: Re: [Spice-devel] guest agent windows binaries On Wed, 12 Feb 2014 09:16:04 AM Christophe Fergeau wrote: http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw3 2-spice-vdagent-0.7.2-1.fc19.noarch.rpm and http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2/mingw6 4-spice-vdagent-0.7.2-1.fc19.noarch.rpm contain the binaries: $ rpm -qpl ./mingw64-spice-vdagent-0.7.2-1.fc19.noarch.rpm /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdagent.exe /usr/x86_64-w64-mingw32/sys-root/mingw/bin/vdservice.exe Why pack windows binaries in a rpm that can't be unpacked on windows? RPM is still a file archive :) All you would need is just good file archiver (for example open sourced 7-zip for Windows). Thanks, but I'll try replicating the binaries and service entries from a win 7 installation. Also - could someone *please* clarify the current and future status of windows 8/2012 drivers and guest tools? its extremely confusing trying to track down this information. No QXL driver, the virtio-win drivers (located at https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/ ) seem to have win8 versions Couldn't get them to install myself. , and the agent should be working as well on win8. I've never tried these though. I believe I have been labouring under the misapprehension that the qxl driver was necessary for the vdagent and all its goodies (display resizing, hot keys etc) to work, but that is not the case? It will need the virtio driver though won't it? I'll rebundle vdagent for win8/2012 and see how it goes. Thanks, -- Lindsay ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 08/13] openssl: learn to handle a new kind of BIO based on GIOStream
On Mon, Feb 03, 2014 at 07:02:39PM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com Although reusing BIO_new_socket() once again is a hack, it seems to be the easiest way... The proper solution is certainly to start using GTls instead, but that will require a glib 2.28 dep bump. Ah, much easier to review with git show -M (rename detection). + +G_GNUC_INTERNAL +#if GLIB_CHECK_VERSION(2, 28, 0) +BIO* bio_new_giostream(GIOStream *stream) +{ +// TODO: make an actual new BIO type, or just switch to GTls already... +BIO *bio = BIO_new_socket(-1, BIO_NOCLOSE); +#else +BIO* bio_new_gsocket(GSocket *gsocket) +{ +BIO *bio = BIO_new_socket(g_socket_get_fd(gsocket), BIO_NOCLOSE); +#endif This #if block is not quite readable, I probably would have split that in a helper function with the common code + 2 #ifdef'ed bio_new_giostream/bio_new_gsocket calling that helper. BIO_new_socket() will not mind having its fd set to -1 ? ACK. Christophe pgptDOVvN1nce.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 08/13] openssl: learn to handle a new kind of BIO based on GIOStream
On Wed, Feb 12, 2014 at 12:21 PM, Christophe Fergeau cferg...@redhat.com wrote: +G_GNUC_INTERNAL +#if GLIB_CHECK_VERSION(2, 28, 0) +BIO* bio_new_giostream(GIOStream *stream) +{ +// TODO: make an actual new BIO type, or just switch to GTls already... +BIO *bio = BIO_new_socket(-1, BIO_NOCLOSE); +#else +BIO* bio_new_gsocket(GSocket *gsocket) +{ +BIO *bio = BIO_new_socket(g_socket_get_fd(gsocket), BIO_NOCLOSE); +#endif This #if block is not quite readable, I probably would have split that in a helper function with the common code + 2 #ifdef'ed bio_new_giostream/bio_new_gsocket calling that helper. My idea is more to get the code in the (2,28) block ready, so that else #else can be removed without more code churn. BIO_new_socket() will not mind having its fd set to -1 ? nope, but this is all just quite hacky tbh (the whole BIO thingy).. Hopefully we can move to 2.28 soon. ACK. Christophe -- Marc-André Lureau ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 10/13] channel: simplify has error code
ACK Christophe On Mon, Feb 03, 2014 at 07:02:41PM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com Get rid of a superflous g_socket_condition_check(). --- gtk/spice-channel.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 7459a49..87bc471 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -2105,29 +2105,23 @@ static gboolean wait_migration(gpointer data) static gboolean spice_channel_iterate(SpiceChannel *channel) { SpiceChannelPrivate *c = channel-priv; -GIOCondition ret; if (c-state == SPICE_CHANNEL_STATE_MIGRATING !g_coroutine_condition_wait(c-coroutine, wait_migration, channel)) CHANNEL_DEBUG(channel, migration wait cancelled); -if (c-has_error) { -CHANNEL_DEBUG(channel, channel has error, breaking loop); -return FALSE; -} - /* flush any pending write and read */ -SPICE_CHANNEL_GET_CLASS(channel)-iterate_write(channel); -SPICE_CHANNEL_GET_CLASS(channel)-iterate_read(channel); - -ret = g_socket_condition_check(c-sock, G_IO_IN | G_IO_ERR | G_IO_HUP); -if (c-state SPICE_CHANNEL_STATE_CONNECTING -ret (G_IO_ERR|G_IO_HUP)) { -SPICE_DEBUG(got socket error: %d, ret); -emit_main_context(channel, SPICE_CHANNEL_EVENT, - c-state == SPICE_CHANNEL_STATE_READY ? - SPICE_CHANNEL_ERROR_IO : SPICE_CHANNEL_ERROR_LINK); -c-has_error = TRUE; +if (!c-has_error) +SPICE_CHANNEL_GET_CLASS(channel)-iterate_write(channel); +if (!c-has_error) +SPICE_CHANNEL_GET_CLASS(channel)-iterate_read(channel); + +if (c-has_error) { +CHANNEL_DEBUG(channel, channel got error); +if (c-state SPICE_CHANNEL_STATE_CONNECTING) +emit_main_context(channel, SPICE_CHANNEL_EVENT, + c-state == SPICE_CHANNEL_STATE_READY ? + SPICE_CHANNEL_ERROR_IO : SPICE_CHANNEL_ERROR_LINK); return FALSE; } -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel pgp1QuhDkZwF9.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 06/13] http-proxy: add https proxy
On Wed, Feb 12, 2014 at 12:04:25PM +0100, Marc-André Lureau wrote: On Wed, Feb 12, 2014 at 11:59 AM, Christophe Fergeau cferg...@redhat.com wrote: Missed that initially, but tlsconn is leaked in error cases, and I think we will leak a reference to it in success case too. My understanding is that if error, function returns NULL tlsconn = g_tls_client_connection_new (io_stream, G_SOCKET_CONNECTABLE(proxy_address), error); if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) goto error; error: if (data_in != NULL) g_object_unref (data_in); g_free (buffer); return NULL; } tlsconn will be leaked. we don't own the io_stream passed as an argument, so we need to ref it in the http case, but in the https case, we already own a ref on the io_stream (which is tlsconn), so we ref it one too many. Where do you see we ref something? I remember I did check with valgrind and debugging than all references where correct. But I could be wrong. Please give further details. tlsconn = g_tls_client_connection_new (io_stream, G_SOCKET_CONNECTABLE(proxy_address), error); io_stream = tlsconn; return g_object_ref (io_stream); I think we are taking an extra ref on tlsconn here (ref which is probably needed in the !tls case). tlsconn is leaked here (dunno if it's guaranteed to be NULL when error is set). Yes it is guaratee, I can add a warning and g_clear_object if you want. a g_warn_if_fail() cannot hurt as it's not explicit in the API doc (or fixing the API doc would work too ;) + return; +} + + g_return_if_fail (tlsconn != NULL); + + GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG + tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif + g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), +tls_validation_flags); + g_tls_connection_handshake_async (G_TLS_CONNECTION (tlsconn), +G_PRIORITY_DEFAULT, cancellable, +handshake_completed, data); A g_object_unref(tlsconn) is probably needed here. no, the async is running and we need to keep the ref. Ah, my bad, I thought glib async functions were ref'ing their arg as needed, but I'm wrong from a quick glance at gio/glib-networking. Christophe pgp4ZKPzRACCw.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 11/13] Make SpiceURI a public API
On Mon, Feb 03, 2014 at 07:02:42PM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com Generalize a little bit SpiceProxy to allow easy URI manipulation by clients. --- doc/reference/Makefile.am| 1 + doc/reference/spice-gtk-docs.xml | 1 + doc/reference/spice-gtk-sections.txt | 26 ++ gtk/Makefile.am | 5 +- gtk/map-file | 12 + gtk/spice-client.h | 1 + gtk/spice-glib-sym-file | 12 + gtk/spice-proxy.c| 357 -- gtk/spice-proxy.h| 64 - gtk/spice-session-priv.h | 3 +- gtk/spice-session.c | 28 +-- gtk/spice-session.h | 1 + gtk/spice-uri-priv.h | 30 +++ gtk/spice-uri.c | 473 +++ gtk/spice-uri.h | 52 15 files changed, 627 insertions(+), 439 deletions(-) delete mode 100644 gtk/spice-proxy.c delete mode 100644 gtk/spice-proxy.h create mode 100644 gtk/spice-uri-priv.h create mode 100644 gtk/spice-uri.c create mode 100644 gtk/spice-uri.h diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index a0a856c..76c7d34 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -44,6 +44,7 @@ IGNORE_HFILES= \ spice-marshal.h \ spice-pulse.h \ spice-session-priv.h\ + spice-uri-priv.h\ spice-util-priv.h \ spice-widget-priv.h \ usb-acl-helper.h\ diff --git a/doc/reference/spice-gtk-docs.xml b/doc/reference/spice-gtk-docs.xml index 4a9a3cf..d2c1a2b 100644 --- a/doc/reference/spice-gtk-docs.xml +++ b/doc/reference/spice-gtk-docs.xml @@ -52,6 +52,7 @@ xi:include href=xml/smartcard-manager.xml/ xi:include href=xml/usb-device-manager.xml/ xi:include href=xml/spice-util.xml/ + xi:include href=xml/spice-uri.xml/ /chapter /part diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index 8d61aa9..411ca0e 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -429,3 +429,29 @@ SPICE_PORT_CHANNEL_GET_CLASS SpicePortChannelPrivate /SECTION +SECTION +FILEspice-uri/FILE +spice_uri_get_scheme +spice_uri_set_scheme +spice_uri_get_hostname +spice_uri_set_hostname +spice_uri_get_port +spice_uri_set_port +spice_uri_get_user +spice_uri_set_user +spice_uri_get_password +spice_uri_set_password +spice_uri_to_string +SpiceURIClass +SpiceURI +SUBSECTION Standard +SPICE_IS_URI +SPICE_IS_URI_CLASS +SPICE_TYPE_URI +SPICE_URI +SPICE_URI_CLASS +SPICE_URI_GET_CLASS +spice_uri_get_type +SUBSECTION Private +SpiceURIPrivate +/SECTION diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 840d129..45d6796 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -248,8 +248,8 @@ libspice_client_glib_2_0_la_SOURCES = \ channel-usbredir-priv.h \ smartcard-manager.c \ smartcard-manager-priv.h\ - spice-proxy.c \ - spice-proxy.h \ + spice-uri.c \ + spice-uri-priv.h\ usb-device-manager.c\ usb-device-manager-priv.h \ usbutil.c \ @@ -282,6 +282,7 @@ libspice_client_glibincludedir = $(includedir)/spice-client-glib-2.0 libspice_client_glibinclude_HEADERS =\ spice-audio.h \ spice-client.h \ + spice-uri.h \ spice-types.h \ spice-session.h \ spice-channel.h \ diff --git a/gtk/map-file b/gtk/map-file index 368b44f..cf65db0 100644 --- a/gtk/map-file +++ b/gtk/map-file @@ -118,6 +118,18 @@ spice_util_get_debug; spice_util_get_version_string; spice_util_set_debug; spice_uuid_to_string; +spice_uri_get_hostname; +spice_uri_get_password; +spice_uri_get_port; +spice_uri_get_scheme; +spice_uri_get_type; +spice_uri_get_user; +spice_uri_set_hostname; +spice_uri_set_password; +spice_uri_set_port; +spice_uri_set_scheme; +spice_uri_set_user; +spice_uri_to_string; local: *; }; diff --git a/gtk/spice-client.h b/gtk/spice-client.h index 730d11a..975259a 100644 --- a/gtk/spice-client.h +++ b/gtk/spice-client.h @@ -31,6 +31,7 @@ #include spice-session.h #include spice-channel.h #include
Re: [Spice-devel] guest agent windows binaries
On 12 February 2014 21:08, Marian Krcmarik mkrcm...@redhat.com wrote: Why pack windows binaries in a rpm that can't be unpacked on windows? RPM is still a file archive :) All you would need is just good file archiver (for example open sourced 7-zip for Windows). Cool, thanks. And I tried the 0.74 drivers again - all working this time (Windows 8.1), dunno what I was doing wrong before, but duh! Will play with the service tomorrow, thanks for all the help everyone. -- Lindsay ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 12/13] channel: add spice_channel_get_error()
On Tue, Feb 11, 2014 at 01:08:55PM -0500, Marc-André Lureau wrote: - Original Message - On Tue, Feb 11, 2014 at 06:50:18PM +0100, Marc-André Lureau wrote: @@ -2248,15 +2269,16 @@ static void *spice_channel_coroutine(void *data) reconnect: -c-conn = spice_session_channel_open_host(c-session, channel, c-tls); +c-conn = spice_session_channel_open_host(c-session, channel, c-tls, c-error); if (c-conn == NULL) { -if (!c-tls) { +if (!c-error !c-tls) { CHANNEL_DEBUG(channel, trying with TLS port); c-tls = true; /* FIXME: does that really work with provided fd */ goto reconnect; } else { CHANNEL_DEBUG(channel, Connect error); emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_CONNECT); +g_clear_error(c-error); My understanding of this bit is that spice_channel_get_error() can only be used in a callback attached to SPICE_CHANNEL_EVENT as after that it will be cleared? Maybe this needs to be more explicit in the API doc for spice_channel_get_error(). It is meant to be usable at any point. Currently, if you don't use it in this callback, all you will get is a NULL error even if a connection error occurred before. Won't the g_clear_error() I quoted cause spice_channel_get_error() to return the correct error in the SPICE_CHANNEL_EVENT callback when there is a connection error, and then return NULL after the g_clear_error() has been called? Ie the error state of the channel will not be permanent after an error has happened, but will be silently reset by the library. Not saying this is bad per-se, at first I was worried that we could get in a permanent error state it's not possible to get out of. The API doesn't specify when the channel is in error state. When it is, you may get more information via this API, I don't see the need to make it more specific. IThis does not strike me as a very good public API to export. From the library user point of view, there will be this function that can give more information about channel errors, but when an error occurred, the function may return NULL when you call it as the library resets the error at totally unspecified moments. So it can be good enough as something internal, but imo we need to do better at least in the API doc if it's something that we export. Christophe pgpUg64zriOyY.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] Win 8 Display Resolution
Without a QXL driver isn't it limited to 1024x768 resolution? -- Lindsay ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] Win 8 Display Resolution
On Wed, Feb 12, 2014 at 10:13:18PM +1000, Lindsay Mathieson wrote: Without a QXL driver isn't it limited to 1024x768 resolution? You should be able to go higher than that. IIUC even the cirrus driver supports more than that, but if not then the 'vga' driver for QEMU should. It is mostly determined by how much video RAM is exposed to the guest. QXL gives you other nice features like multi-monitor, dynamic mode switching via the guest agent, better performance with spice, etc. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 04/14] proxy: parse user and pass from uri
On Wed, Feb 12, 2014 at 11:19:02AM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com --- gtk/spice-proxy.c | 13 + 1 file changed, 13 insertions(+) diff --git a/gtk/spice-proxy.c b/gtk/spice-proxy.c index 7711e83..35eec67 100644 --- a/gtk/spice-proxy.c +++ b/gtk/spice-proxy.c @@ -19,6 +19,7 @@ #include stdlib.h #include string.h +#include glib-compat.h #include spice-client.h #include spice-proxy.h @@ -78,6 +79,18 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err spice_proxy_set_protocol(self, http); spice_proxy_set_port(self, 3128); +/* yes, that parser is bad, we need GUri... */ +if (strstr(uri, @)) { +gchar *saveptr, *saveptr2; +gchar *next = strstr(uri, @) + 1; The strstr() call could probably be done only once, but it's fine enough like this. ACK. Christophe +gchar *auth = strtok_r(uri, @, saveptr); +const gchar *user = strtok_r(auth, :, saveptr2); +const gchar *pass = strtok_r(NULL, :, saveptr2); +spice_proxy_set_user(self, user); +spice_proxy_set_password(self, pass); +uri = next; +} + /* max 2 parts, host:port */ gchar **proxyv = g_strsplit(uri, :, 2); const gchar *proxy_port = NULL; -- 1.8.4.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel pgp09MTOZuDIQ.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 11/14] channel: talk to giostream instead of gsocket
On Wed, Feb 12, 2014 at 11:19:09AM +0100, Marc-André Lureau wrote: From: Marc-André Lureau marcandre.lur...@redhat.com --- gtk/spice-channel-priv.h | 4 ++- gtk/spice-channel.c | 81 +++- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h index 35704ea..00893c3 100644 --- a/gtk/spice-channel-priv.h +++ b/gtk/spice-channel-priv.h @@ -80,8 +80,10 @@ struct _SpiceChannelPrivate { SSL_CTX *ctx; SSL *ssl; SpiceOpenSSLVerify *sslverify; -GSocket *sock; +GSocket *socket; NACK (this was not in v1 :-/ ) Christophe pgpMcq1wjaGlR.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk] Add SpiceVMC GIOStream
On Tue, Feb 11, 2014 at 06:52:49PM +0100, Marc-André Lureau wrote: This allows to use conveniently GIOStream APIs without caring about coroutine and Spice messages details. --- gtk/Makefile.am | 2 + gtk/vmcstream.c | 532 gtk/vmcstream.h | 81 + 3 files changed, 615 insertions(+) create mode 100644 gtk/vmcstream.c create mode 100644 gtk/vmcstream.h diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 62afd36..7ceb22f 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -255,6 +255,8 @@ libspice_client_glib_2_0_la_SOURCES = \ usbutil.c \ usbutil.h \ $(USB_ACL_HELPER_SRCS) \ + vmcstream.c \ + vmcstream.h \ \ decode.h\ decode-glz.c\ diff --git a/gtk/vmcstream.c b/gtk/vmcstream.c new file mode 100644 index 000..f92f8b7 --- /dev/null +++ b/gtk/vmcstream.c @@ -0,0 +1,532 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2013 Red Hat, Inc. + + 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/. +*/ +#include string.h + +#include vmcstream.h +#include spice-channel-priv.h +#include gio-coroutine.h + +struct _SpiceVmcInputStream +{ +GInputStream parent_instance; +GSimpleAsyncResult *result; +struct coroutine *coroutine; + +SpiceChannel *channel; +gboolean all; +guint8 *buffer; +gsize count; +gsize pos; + +GCancellable *cancellable; +gulong cancel_id; +}; + +struct _SpiceVmcInputStreamClass +{ +GInputStreamClass parent_class; +}; + +static gssize spice_vmc_input_stream_read(GInputStream *stream, +void *buffer, +gsize count, +GCancellable *cancellable, +GError **error); +static void spice_vmc_input_stream_read_async (GInputStream *stream, +void *buffer, +gsize count, +int io_priority, +GCancellable *cancellable, +GAsyncReadyCallback callback, +gpointer user_data); +static gssize spice_vmc_input_stream_read_finish (GInputStream *stream, +GAsyncResult *result, +GError **error); +static gssize spice_vmc_input_stream_skip(GInputStream *stream, +gsize count, +GCancellable *cancellable, +GError **error); +static gboolean spice_vmc_input_stream_close (GInputStream *stream, +GCancellable *cancellable, +GError **error); + +G_DEFINE_TYPE(SpiceVmcInputStream, spice_vmc_input_stream, G_TYPE_INPUT_STREAM) + + +static void +spice_vmc_input_stream_class_init(SpiceVmcInputStreamClass *klass) +{ +GInputStreamClass *istream_class; + +istream_class = G_INPUT_STREAM_CLASS(klass); +istream_class-read_fn = spice_vmc_input_stream_read; +istream_class-read_async = spice_vmc_input_stream_read_async; +istream_class-read_finish = spice_vmc_input_stream_read_finish; +istream_class-skip = spice_vmc_input_stream_skip; +
Re: [Spice-devel] [PATCH spice-gtk 12/14] Make SpiceURI a public API
On Wed, Feb 12, 2014 at 11:19:10AM +0100, Marc-André Lureau wrote: +G_GNUC_INTERNAL +void spice_uri_set_user(SpiceURI *self, const gchar *value) +{ +g_return_if_fail(SPICE_IS_URI(self)); + +g_free(self-user); +self-user = g_strdup(value); +g_object_notify((GObject *)self, user); +} + +G_GNUC_INTERNAL +const gchar* spice_uri_get_password(SpiceURI *self) +{ +g_return_val_if_fail(SPICE_IS_URI(self), NULL); +return self-password; +} This whole file looks like an older version (G_GNUC_INTERNAL was not there in v1, and there was API documentation before each func). Christophe pgp7AmTtsNJQ3.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 06/13] http-proxy: add https proxy
On Wed, Feb 12, 2014 at 12:46 PM, Christophe Fergeau cferg...@redhat.com wrote: On Wed, Feb 12, 2014 at 12:04:25PM +0100, Marc-André Lureau wrote: On Wed, Feb 12, 2014 at 11:59 AM, Christophe Fergeau cferg...@redhat.com wrote: Missed that initially, but tlsconn is leaked in error cases, and I think we will leak a reference to it in success case too. My understanding is that if error, function returns NULL tlsconn = g_tls_client_connection_new (io_stream, G_SOCKET_CONNECTABLE(proxy_address), error); if (!g_tls_connection_handshake (G_TLS_CONNECTION (tlsconn), cancellable, error)) goto error; error: if (data_in != NULL) g_object_unref (data_in); g_free (buffer); return NULL; } tlsconn will be leaked. ack we don't own the io_stream passed as an argument, so we need to ref it in the http case, but in the https case, we already own a ref on the io_stream (which is tlsconn), so we ref it one too many. Where do you see we ref something? I remember I did check with valgrind and debugging than all references where correct. But I could be wrong. Please give further details. tlsconn = g_tls_client_connection_new (io_stream, G_SOCKET_CONNECTABLE(proxy_address), error); io_stream = tlsconn; return g_object_ref (io_stream); I think we are taking an extra ref on tlsconn here (ref which is probably needed in the !tls case). tlsconn is leaked here (dunno if it's guaranteed to be NULL when error is set). Yes it is guaratee, I can add a warning and g_clear_object if you want. a g_warn_if_fail() cannot hurt as it's not explicit in the API doc (or fixing the API doc would work too ;) I'll check for return value instead. + return; +} + + g_return_if_fail (tlsconn != NULL); + + GTlsCertificateFlags tls_validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL; +#ifdef DEBUG + tls_validation_flags -= G_TLS_CERTIFICATE_UNKNOWN_CA + G_TLS_CERTIFICATE_BAD_IDENTITY; +#endif + g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (tlsconn), + tls_validation_flags); + g_tls_connection_handshake_async (G_TLS_CONNECTION (tlsconn), +G_PRIORITY_DEFAULT, cancellable, +handshake_completed, data); A g_object_unref(tlsconn) is probably needed here. no, the async is running and we need to keep the ref. Ah, my bad, I thought glib async functions were ref'ing their arg as needed, but I'm wrong from a quick glance at gio/glib-networking. Christophe -- Marc-André Lureau ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] using scan code from hardware keyboards
Hey guys, When my hardware keyboard is connected/paired with my Android device, key events do contain a scan code. I would love to just send that scan code through to the VM, however, the Android documentation is really discouraging on this matter. Can you guys take a look at the docs for the method which retrieves the scan code, and tell me whether you would rely on the value returned by getScanCode() given what's written? http://developer.android.com/reference/android/view/KeyEvent.html#getScanCode%28%29 In addition, my hardware keyboard has an English layout, and I have no way of testing what a hardware keyboard with a non-English layout generates when one presses a key which is not in the ASCII table. The reason it's interesting is that Android key events may contain a key code, and scan code. The documented key codes for Android are all within the ASCII table. When a soft-keyboard KeyEvent carries unicode data outside the ASCII table, its key code == 0, and its action is not DOWN or UP, but MULTIPLE. So, will (for example) a German hardware keyboard on which u-umlaut is pressed generate an event with action == ACTION_MULTIPLE and a key code == 0, or will it generate an event with action == DOWN/UP and key code set to something inaccurate? Does anybody own an Android and a hardware keyboard with a non-English layout to help me test this? As things stand, if I don't trust the scan code the keyboard generates, I cannot use my English layout hardware keyboard to type any language other than English because the scan codes are simulated based on the unicode character the event contains. On my English keyboard, the event inevitably contains unicode characters that fall within the ASCII table, as you can imagine :). Your thoughts and suggestions are welcome. Thanks! iordan -- The conscious mind has only one thread of execution. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel