[Pkg-libvirt-commits] [SCM] libgtk-vnc Debian packaging branch, master, updated. debian/0.5.0-2-3-g2665e44
Guido Günther
agx at sigxcpu.org
Sat Jan 28 19:44:11 UTC 2012
The following commit has been merged in the master branch:
commit b12be0b6901c13b6d0c38a2010efe48a03798c7e
Author: Guido Günther <agx at sigxcpu.org>
Date: Sat Jan 28 20:14:59 2012 +0100
Allow Unix domain sockets in gvncviewer
Thanks: Daniel Kahn Gillmor for the patch
Closes: #655460
diff --git a/debian/patches/Allow-Unix-domain-sockets-in-gvncviewer.patch b/debian/patches/Allow-Unix-domain-sockets-in-gvncviewer.patch
new file mode 100644
index 0000000..a505799
--- /dev/null
+++ b/debian/patches/Allow-Unix-domain-sockets-in-gvncviewer.patch
@@ -0,0 +1,82 @@
+From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Date: Sat, 28 Jan 2012 20:14:32 +0100
+Subject: Allow Unix domain sockets in gvncviewer
+
+gvncviewer is useful when connecting to unix domain sockets.
+---
+ examples/gvncviewer.c | 48 +++++++++++++++++++++++++++++++++++++-----------
+ 1 files changed, 37 insertions(+), 11 deletions(-)
+
+diff --git a/examples/gvncviewer.c b/examples/gvncviewer.c
+index 6d47d71..6730b33 100644
+--- a/examples/gvncviewer.c
++++ b/examples/gvncviewer.c
+@@ -30,6 +30,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <glib.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++#include <sys/socket.h>
++#include <sys/un.h>
+
+ #if WITH_LIBVIEW
+ #include <libview/autoDrawer.h>
+@@ -586,6 +591,8 @@ int main(int argc, char **argv)
+ GtkWidget *scaling;
+ GtkWidget *showgrabkeydlg;
+ const char *help_msg = "Run 'gvncviewer --help' to see a full list of available command line options";
++ struct stat sockstat;
++ int sock;
+
+ name = g_strdup_printf("- Simple VNC Client on Gtk-VNC %s",
+ vnc_util_get_version_string());
+@@ -688,17 +695,36 @@ int main(int argc, char **argv)
+ gtk_widget_realize(vnc);
+
+ snprintf(hostname, sizeof(hostname), "%s", args[0]);
+- display = strchr(hostname, ':');
+-
+- if (display) {
+- *display = 0;
+- snprintf(port, sizeof(port), "%d", 5900 + atoi(display + 1));
+- } else
+- snprintf(port, sizeof(port), "%d", 5900);
+-
+- if (!*hostname)
+- snprintf(hostname, sizeof(hostname), "%s", "127.0.0.1");
+- vnc_display_open_host(VNC_DISPLAY(vnc), hostname, port);
++ if ((0 == stat(hostname, &sockstat)) &&
++ S_ISSOCK(sockstat.st_mode)) {
++ size_t sockaddrsize = offsetof(struct sockaddr_un, sun_path) + strlen(hostname) + 1;
++ struct sockaddr_un* addr = malloc(sockaddrsize);
++
++ /* the argument refers to a unix domain socket */
++ sock = socket(AF_UNIX, SOCK_STREAM, 0);
++ addr->sun_family = AF_UNIX;
++ strcpy(addr->sun_path, hostname);
++ if (0 == connect(sock, (const struct sockaddr *)addr, sockaddrsize)) {
++ vnc_display_open_fd(VNC_DISPLAY(vnc), sock);
++ } else {
++ fprintf(stderr, "Failed to open unix domain socket %s\n", hostname);
++ return 1;
++ }
++ free(addr);
++ } else {
++ /* treat it as a regular hostname */
++ display = strchr(hostname, ':');
++
++ if (display) {
++ *display = 0;
++ snprintf(port, sizeof(port), "%d", 5900 + atoi(display + 1));
++ } else
++ snprintf(port, sizeof(port), "%d", 5900);
++
++ if (!*hostname)
++ snprintf(hostname, sizeof(hostname), "%s", "127.0.0.1");
++ vnc_display_open_host(VNC_DISPLAY(vnc), hostname, port);
++ }
+ vnc_display_set_keyboard_grab(VNC_DISPLAY(vnc), TRUE);
+ vnc_display_set_pointer_grab(VNC_DISPLAY(vnc), TRUE);
+
diff --git a/debian/patches/series b/debian/patches/series
index 252c851..b44a562 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ Look-for-generated-enums-in-srcdir.patch
Use-C99-int-types-instead-of-NSPR-ones.patch
Fix-build-with-xulrunner-8.0.patch
Remove-GNUmakefile-links.patch
+Allow-Unix-domain-sockets-in-gvncviewer.patch
--
libgtk-vnc Debian packaging
More information about the Pkg-libvirt-commits
mailing list