Re: [Setup-tool-hackers] Problem with GST andpassword authentification



El lun, 24 de 02 de 2003 a las 20:50, Manuel Clos escribió:
> Carlos Garnacho wrote:
> > oh, that's pretty strange... if the error dialog appears, then su has
> > been run and terminated, do you have the GST bin path both in root's and
> > your user's $PATH? or it's only in your user's path? (anyways, this is a
> > bug that must be solved, right now I'm working on this)
> 
> llanero@llanero:~$ type users-admin
> users-admin is /gnome/gnome-2.2.0/bin/users-admin
> 
> run users-admin -> correct password fails -> no error in the console.
> 
> ---
> 
> run su to became root
> 
> export PATH=/gnome/gnome-2.2.0/bin:$PATH
> export LD_LIBRARY_PATH=/gnome/gnome-2.2.0/lib:$LD_LIBRARY_PATH
> 
> run users-admin -> ok.
> 
> Is there anything concrete to debug?

no thanks :-), If it's the error I suppose... when user does:

carlos@mortadelo:~$ users-admin


GST runs su this way:

carlos@mortadelo:~$ su root -c users-admin


and users-admin may be in the user's path, but not in the root's path,
it this happens, then users-admin is not executed and su fails

this is a pretty stupid bug (which I did) and it's now fixed in CVS,
please try the attached patch to fix this :-), it's for
src/common/xst-su.c

regards

Index: xst-su.c
===================================================================
RCS file: /cvs/gnome/gnome-system-tools/src/common/xst-su.c,v
retrieving revision 1.22
diff -u -5 -r1.22 xst-su.c
--- xst-su.c	19 Feb 2003 18:31:19 -0000	1.22
+++ xst-su.c	24 Feb 2003 23:02:12 -0000
@@ -68,11 +68,11 @@
 static int root;			/* if we are root, no password is
 					   required */
 
 /* This is the signal callback that answers to the forked su command */
 static void
-on_terminal_child_exited (GtkWidget *term, gint pid, gint status, gpointer data)
+on_terminal_child_exited (GtkWidget *reaper, gint pid, gint status, gpointer data)
 {
 	GtkWidget *error_dialog;
 	
 	if (WIFEXITED (status) && WEXITSTATUS (status) && (WEXITSTATUS(status) < 255)) {
 		error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
@@ -85,10 +85,33 @@
 	}
 
 	_exit (0);
 }
 
+/* finds out the path in which the tool is */
+static gchar*
+get_tool_path (gchar *argv0)
+{
+	gchar *program_name = g_path_get_basename (argv0);
+
+	if (strcmp (argv0, program_name) == 0) {
+		/* we are calling the tool without any path, because root user may not have
+		 * the tool's path in his $PATH, we find out the absolute path
+		 */
+		g_free (program_name);
+
+		return g_find_program_in_path (argv0);
+	} else {
+		/* if argv[0] is not equal to the tool basename, then it's already
+		 * an absolute of relative path, and it doesn't need the full path to run
+		 */
+		g_free (program_name);
+
+		return argv0;
+	}
+}
+
 /* runs a term with su in it */
 void
 xst_su_run_term (gint argc, gchar *argv[], gchar *user)
 {
 	GString *str;
@@ -101,11 +124,11 @@
 	g_signal_connect (G_OBJECT (reaper), "child-exited",
 			  G_CALLBACK (on_terminal_child_exited), NULL);
 
 	g_assert (argv && argv[0]);
 
-	str = g_string_new (argv[0]);
+	str = g_string_new (get_tool_path (argv[0]));
 	for (i = 1; i < argc; i++) {
 		g_string_append_c (str, ' ');
 		g_string_append (str, argv[i]);
 	}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]