I've identified two problems with ICA and tsclient. One is this Error 3, the other is that it knows that wfica is installed but fails to run it unless you create a symlink in a directory on the path.

Both bugs are located in src/support.c. The first one is because when wfica is spawned the argv array is not built to it's liking. There is code like this in several places:

sprintf (buffer, "-description %s", (char *)g_strescape(rdp->description));
c_argv[c_argc++] = g_strdup(buffer);

This puts both the switch and the parameter into the same argv element. Apparently wfica does not handle this correctly. If they are split up into two argv[[] elements then the Error 3 is eliminated.

The other problem is because the code checks for the existence of /usr/lib/ICAClient/wfica but then just uses "wfica" as the name of the executable, assuming that it is on the path. Which is very unlikely for /usr/lib/ICAClient!

The attached patch fixes both problems. You should be able to apt-get source tsclient and drop it into the debian/patches directory. After rebuilding with dpkg-buildpackge "it works for me" with our corporate Citrix server and at least in my brief testing doesn't seem to break anything else.

A hint: The "computer" line can be filled in with a Citrix service name, for example to use MS Word on our Citrix sever, I can use "Microsoft Word - Citrix" as the computer name.


--
-| Bob Hauck (Brother Nail Gun of The Short Path)
-| http://www.haucks.org/

--- tsclient-0.150/src/support.c	2007-04-19 16:49:22.000000000 -0400
+++ tsclient-0.150.new/src/support.c	2009-07-16 14:20:34.000000000 -0400
@@ -716,7 +716,7 @@
       if (g_find_program_in_path ("wfica")) {
         cmd = "wfica";
       } else if (g_file_test ("/usr/lib/ICAClient/wfica", G_FILE_TEST_EXISTS)) {
-        cmd = "wfica";
+        cmd = "/usr/lib/ICAClient/wfica";
       } else {
 	if(error) {
 	  *error = g_strdup(_("wfica was not found in your path.\nPlease verify your ICAClient installation."));
@@ -727,20 +727,24 @@
       c_argv[c_argc++] = g_strdup (buffer);
 
       if ( rdp->username && strlen (rdp->username) ) {
-        sprintf(buffer, "-username %s", (char*)g_strescape(rdp->username, NULL));
+        c_argv[c_argc++] = g_strdup ("-username");
+        sprintf(buffer, "%s", (char*)g_strescape(rdp->username, NULL));
         c_argv[c_argc++] = g_strdup (buffer);
       }
       if ( rdp->password && strlen (rdp->password) ) {
-        sprintf(buffer, "-password %s", (char*)g_strescape(rdp->password, NULL));
+        c_argv[c_argc++] = g_strdup ("-password");
+        sprintf(buffer, "%s", (char*)g_strescape(rdp->password, NULL));
         c_argv[c_argc++] = g_strdup (buffer);
       }
       if ( rdp->domain && strlen (rdp->domain) ) {
-        sprintf(buffer, "-domain %s", (char*)g_strescape(rdp->domain, NULL));
+        c_argv[c_argc++] = g_strdup ("-domain");
+        sprintf(buffer, "%s", (char*)g_strescape(rdp->domain, NULL));
         c_argv[c_argc++] = g_strdup (buffer);
       }
 
       if ( rdp->client_hostname && strlen (rdp->client_hostname) ) {
-        sprintf(buffer, "-clientname %s", (char*)g_strescape(rdp->client_hostname, NULL));
+        c_argv[c_argc++] = g_strdup ("-clientname");
+        sprintf(buffer, "%s", (char*)g_strescape(rdp->client_hostname, NULL));
         c_argv[c_argc++] = g_strdup (buffer);
       }
 
@@ -828,7 +832,8 @@
       }
 
       if ( rdp->full_address && strlen (rdp->full_address) ) {
-        sprintf(buffer, "-description %s", (char*)g_strescape(rdp->full_address, NULL));
+        c_argv[c_argc++] = g_strdup ("-description");
+        sprintf(buffer, "%s", (char*)g_strescape(rdp->full_address, NULL));
         c_argv[c_argc++] = g_strdup (buffer);
       }
 		

Reply via email to