Bug#295310: gnome-cups-manager: Still not working
baptiste13@altern.org, 295310@bugs.debian.org
baptiste13@altern.org, 295310@bugs.debian.org
Fri, 4 Mar 2005 21:09:05 +0100 (CET)
------=_20050304210905_10374
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Hi,
first of all, thanks for your additional information from
~/.xsession-errors, this saved me a lot of time in understanding this bug.
The bug is related to the interaction between gnome-cups-manager and gksu.
With old versions of gksu (like my old 1.0.3-2), it went that way:
gnome-cups-manager calls:
gksu -- -- gnome-cups-manager -p D1_HPCOLOR
which calls:
/bin/su root -c /usr/lib/gksu/gksu-run-helper "gnome-cups-manager"
which calls after authentification:
/usr/bin/env -u XAUTHORITY=/tmp/gksu-vdBntp/.Xauthority gnome-cups-manager
However, the command line interface of gksu changed, and this is what you
get with newer versions of gksu (1.2.3-2 from testing):
gnome-cups-manager calls:
gksu -- -- gnome-cups-manager -p D1_HPCOLOR
which authenticates for "-- '--' 'gnome-cups-manager' '-p' 'D1_HPCOLOR'"
and calls:
/usr/bin/env -u XAUTHORITY=/tmp/libgksu1.2-EbbYeP/.Xauthority -- --
gnome-cups-manager -p D1_HPCOLOR
which breaks for obvious reasons.
I played with command line calls to gksu, with the following results:
gksu gnome-cups-manager
-> /usr/bin/env -u XAUTHORITY=/tmp/libgksu1.2-eprXNB/.Xauthority
gnome-cups-manager
-> works
gksu gnome-cups-manager -p D1_HPCOLOR
-> prints password to terminal, because gksu interprets the -p option
(imho this is a bug, but we do not need to trigger it).
gksu -- gnome-cups-manager -p D1_HPColor
-> authenticates "-- 'gnome-cups-manager' '-p' 'D1_HPCOLOR'", then
-> /usr/bin/env -u XAUTHORITY=/tmp/libgksu1.2-7msLuk/.Xauthority --
gnome-cups-manager -p D1_HPColor
-> works, but that's ugly
gksu "gnome-cups-manager -p D1_HPColor"
-> authenticates "gnome-cups-manager -p D1_HPColor", then
-> /usr/bin/env -u XAUTHORITY=/tmp/libgksu1.2-zWXKDc/.Xauthority
gnome-cups-manager -p D1_HPColor
-> this is the right one !
We thus have to call gksu with the whole command line in one argument.
The attached patch is a new version of change-su-command.diff in the
debian/patches directory, which implements this strategy.
Cheers,
BC
------=_20050304210905_10374
Content-Type: text/x-patch; name="change-su-command_fixed.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="change-su-command_fixed.diff"
--- gnome-cups-manager-0.25.orig/libgnomecups/gnome-cups-permission.c 2004-08-24 08:39:23.000000000 +0200
+++ gnome-cups-manager-0.25/libgnomecups/gnome-cups-permission.c 2005-03-04 20:21:54.000000000 +0100
@@ -76,9 +76,9 @@
gboolean force_admin, GtkWidget *toplevel)
{
static char const *su_app[] = {
- "gnomesu"
+ "gksu"
};
- char const **args = g_new0 (char const *, argc + G_N_ELEMENTS (su_app) +
+ char const **args = g_new0 (char const *, G_N_ELEMENTS (su_app) +
1 /* app */ + 1 /* null */);
unsigned offset, i = 0;
GError *err = NULL;
@@ -87,9 +87,10 @@
for (i = 0 ; i < G_N_ELEMENTS (su_app) ; i++)
args [i] = (char *)su_app [i];
offset = i;
- app = args [offset++] = gnome_cups_execname (app);
+ app = gnome_cups_execname (app);
for (i = 0 ; i < argc ; i++)
- args [i + offset] = argv [i];
+ app = (char *)g_strjoin((gchar *)" ", (gchar *)app, (gchar *)argv [i], NULL);
+ args [offset++] = app;
g_spawn_async (NULL, (char **)args, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, &err);
------=_20050304210905_10374--