Package: vncsnapshot
Version: 1.2a-1+b1
Severity: normal

Took some playing around with ltrace to catch this, but

  vncsnapshot -tunnel ${host}:3 /tmp/${host}.03.jpg

gives a Usage message which includes

> Usage: vncsnapshot [<OPTIONS>] [<HOST>]:<DISPLAY#> filename
>        vncsnapshot [<OPTIONS>] -listen [<DISPLAY#>] filename
>        vncsnapshot [<OPTIONS>] -tunnel <HOST>:<DISPLAY#> filename
>        vncsnapshot [<OPTIONS>] -via <GATEWAY> [<HOST>]:<DISPLAY#> filename

Turns out -tunnel (tunnel.c, processTunnelArgs) looks at the *last*
argument for host:port:

  pdisplay = strchr(argv[*pargc - 1], ':');

rather than tunnelArgIndex.  This would suggest

  vncsnapshot -tunnel /tmp/${host}.03.jpg ${host}:3 

which in fact gets around the argument parsing, and prompts for a
password, and then fails with:

  Couldn't convert '/tmp/${host}.03.jpg' to host address
  Unable to connect to VNC server

Anyway, here's a patch (with debugging noise left in) that makes
vncsnapshot -tunnel work.  -via is probably broken too, I haven't
tried it yet.  The key bits are
  * actually *use* tunnelArgIndex
  * use localhost::port so it doesn't add 5900 to it again

(It looks like upstream hasn't been touched since 2004, so getting
 this fixed in debian directly would probably be worthwhile.)

--- vncsnapshot-1.2a.orig/tunnel.c
+++ vncsnapshot-1.2a/tunnel.c
@@ -106,6 +106,8 @@
   if (!runCommand(cmd))
     return False;
 
+  fprintf(stderr, "Successfully runCommand(%s)\n", cmd);
+
   return True;
 }
 
@@ -115,11 +117,16 @@
 {
   char *pdisplay;
 
+  fprintf(stderr, "processTunnelArgs:");
+  showArgs(*pargc, argv);
+
   if (tunnelArgIndex >= *pargc - 1)
     usage();
 
-  pdisplay = strchr(argv[*pargc - 1], ':');
-  if (pdisplay == NULL || pdisplay == argv[*pargc - 1])
+  fprintf(stderr, "tAI=%d: %s\n", tunnelArgIndex, argv[tunnelArgIndex]);
+  fprintf(stderr, "tAI+1: %s\n", argv[tunnelArgIndex+1]);
+  pdisplay = strchr(argv[tunnelArgIndex + 1], ':');
+  if (pdisplay == NULL || pdisplay == argv[tunnelArgIndex + 1])
     usage();
 
   *pdisplay++ = '\0';
@@ -130,12 +137,15 @@
   if (*remotePort < 100)
     *remotePort += SERVER_PORT_OFFSET;
 
-  sprintf(lastArgv, "localhost:%d", localPort);
+  sprintf(lastArgv, "localhost::%d", localPort); /* see argsresources.c, 
GetArgsAndResources, Two colons comment */
 
-  *remoteHost = argv[*pargc - 1];
-  argv[*pargc - 1] = lastArgv;
+  *remoteHost = argv[tunnelArgIndex + 1];
+
+  argv[tunnelArgIndex + 1] = lastArgv;
 
   removeArgs(pargc, argv, tunnelArgIndex, 1);
+  showArgs(*pargc, argv);
+
 }
 
 static void
--- vncsnapshot-1.2a.orig/argsresources.c
+++ vncsnapshot-1.2a/argsresources.c
@@ -337,3 +337,10 @@
     *((Bool *)arg) = value;
     return 1;
 }
+
+void showArgs(int argc, char** argv) {
+  int i;
+  for (i=0; i<argc; i++) {
+    fprintf(stderr, "\tARGV[%d]=%s\n", i, argv[i]);
+  }
+}


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.24.2-mc0
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages vncsnapshot depends on:
ii  libc6                  2.3.6.ds1-13etch8 GNU C Library: Shared libraries
ii  libgcc1                1:4.1.1-21        GCC support library
ii  libjpeg62              6b-13             The Independent JPEG Group's JPEG 
ii  libstdc++6             4.1.1-21          The GNU Standard C++ Library v3
ii  vnc-common             3.3.7-14          Virtual network computing server s
ii  zlib1g                 1:1.2.3-13        compression library - runtime

vncsnapshot recommends no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to