kov changed libgksu/trunk/ChangeLog, libgksu/trunk/libgksu/gksu-context.c, libgksu/trunk/libgksu/gksu-run-helper.c

Gustavo Noronha kov at costa.debian.org
Sat Apr 15 14:30:19 UTC 2006


Mensagem de log: 
	- check for xauth at /usr/bin (Xorg 7.0) and /usr/X11R6/bin
	  (Xorg 6.9 and XFree86)


-----


Modified: libgksu/trunk/ChangeLog
===================================================================
--- libgksu/trunk/ChangeLog	2006-04-15 14:28:37 UTC (rev 537)
+++ libgksu/trunk/ChangeLog	2006-04-15 14:30:17 UTC (rev 538)
@@ -1,3 +1,9 @@
+2006-04-15  Gustavo Noronha Silva  <kov at debian.org>
+
+	* libgksu/gksu-context.c, libgksu/gksu-run-helper.c:
+	- check for xauth at /usr/bin (Xorg 7.0) and /usr/X11R6/bin
+	  (Xorg 6.9 and XFree86)
+
 2006-01-07  Gustavo Noronha Silva  <kov at debian.org>
 
 	* configure.ac:

Modified: libgksu/trunk/libgksu/gksu-context.c
===================================================================
--- libgksu/trunk/libgksu/gksu-context.c	2006-04-15 14:28:37 UTC (rev 537)
+++ libgksu/trunk/libgksu/gksu-context.c	2006-04-15 14:30:17 UTC (rev 538)
@@ -447,6 +447,8 @@
 static int
 prepare_xauth (GksuContext *context)
 {
+  gchar *xauth_bin = NULL;
+
   FILE *xauth_output;
   gchar xauth[256] = {0};
 
@@ -463,9 +465,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)
     {

Modified: libgksu/trunk/libgksu/gksu-run-helper.c
===================================================================
--- libgksu/trunk/libgksu/gksu-run-helper.c	2006-04-15 14:28:37 UTC (rev 537)
+++ libgksu/trunk/libgksu/gksu-run-helper.c	2006-04-15 14:30:17 UTC (rev 538)
@@ -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);
 




More information about the gksu-commits mailing list