kov changed libgksu/branches/libgksu2/ChangeLog, libgksu/branches/libgksu2/libgksu/gksu-run-helper.c, libgksu/branches/libgksu2/libgksu/libgksu.c

Gustavo Noronha kov at costa.debian.org
Sun Apr 16 16:07:41 UTC 2006


Mensagem de log: 
check for xauth at the new and old locations (Xorg 7)

-----


Modified: libgksu/branches/libgksu2/ChangeLog
===================================================================
--- libgksu/branches/libgksu2/ChangeLog	2006-04-16 16:06:53 UTC (rev 545)
+++ libgksu/branches/libgksu2/ChangeLog	2006-04-16 16:07:40 UTC (rev 546)
@@ -1,3 +1,9 @@
+2006-04-15  Gustavo Noronha Silva  <kov at debian.org>
+
+	* libgksu/libgksu.c, libgksu/gksu-run-helper.c:
+	- check for xauth at /usr/bin (Xorg 7.0) and /usr/X11R6/bin
+	  (Xorg 6.9 and XFree86) [merged from trunk]
+
 2006-03-02  Gustavo Noronha Silva  <kov at debian.org>
 
 	* configure.ac:

Modified: libgksu/branches/libgksu2/libgksu/gksu-run-helper.c
===================================================================
--- libgksu/branches/libgksu2/libgksu/gksu-run-helper.c	2006-04-16 16:06:53 UTC (rev 545)
+++ libgksu/branches/libgksu2/libgksu/gksu-run-helper.c	2006-04-16 16:07:40 UTC (rev 546)
@@ -66,16 +66,18 @@
 int
 main (int argc, char **argv)
 {
-  gchar *command;
+  gchar *command = NULL;
 
   gchar *xauth_dirtemplate = g_strdup ("/tmp/" PACKAGE_NAME "-XXXXXX");
 
-  gchar *xauth_dir;
-  gchar *xauth_file;
+  gchar *xauth_bin = NULL;
 
-  gchar *xauth_display;
-  gchar *xauth_token;
+  gchar *xauth_dir = NULL;
+  gchar *xauth_file = NULL;
 
+  gchar *xauth_display = NULL;
+  gchar *xauth_token = NULL;
+
   gchar buffer[255];
 
   gint return_code;
@@ -128,9 +130,23 @@
     
     setenv ("XAUTHORITY", xauth_file, TRUE);
 
+    /* find out where the xauth binary is located */
+    if (g_file_test ("/usr/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
+      xauth_bin = "/usr/bin/xauth";
+    else if (g_file_test ("/usr/X11R6/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
+      xauth_bin = "/usr/X11R6/bin/xauth";
+    else
+      {
+	fprintf (stderr,
+		 _("Failed to obtain xauth key: xauth binary not found "
+		   "at usual locations"));
+
+	return 1;
+      }
     command =
-      g_strdup_printf ("/usr/X11R6/bin/xauth add %s . \"`cat %s.tmp`\""
-		       " > /dev/null 2>&1", xauth_display, xauth_file);
+      g_strdup_printf ("%s add %s . \"`cat %s.tmp`\""
+		       " > /dev/null 2>&1", xauth_bin,
+		       xauth_display, xauth_file);
 
     system (command);
 

Modified: libgksu/branches/libgksu2/libgksu/libgksu.c
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu.c	2006-04-16 16:06:53 UTC (rev 545)
+++ libgksu/branches/libgksu2/libgksu/libgksu.c	2006-04-16 16:07:40 UTC (rev 546)
@@ -676,6 +676,8 @@
 static int
 prepare_xauth (GksuContext *context)
 {
+  gchar *xauth_bin = NULL;
+
   FILE *xauth_output;
   gchar xauth[256] = {0};
 
@@ -692,9 +694,24 @@
 
   g_strfreev (tmpv);
 
+  /* find out where the xauth binary is located */
+  if (g_file_test ("/usr/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
+    xauth_bin = "/usr/bin/xauth";
+  else if (g_file_test ("/usr/X11R6/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
+    xauth_bin = "/usr/X11R6/bin/xauth";
+  else
+    {
+      fprintf (stderr,
+	       _("Failed to obtain xauth key: xauth binary not found "
+		 "at usual locations"));
+
+      return 1;
+    }
+
   /* get the authorization token */
-  tmp = g_strdup_printf ("/usr/X11R6/bin/xauth list %s | "
+  tmp = g_strdup_printf ("%s list %s | "
 			 "head -1 | awk '{ print $3 }'",
+			 xauth_bin,
 			 context->display);
   if ((xauth_output = popen (tmp, "r")) == NULL)
     {




More information about the gksu-commits mailing list