--- a/patches/gnome-system-tools-02-forkpty.diff Sat Oct 21 11:03:03 2006 +0000
+++ b/patches/gnome-system-tools-02-forkpty.diff Sat Oct 21 12:32:33 2006 +0000
@@ -1,7 +1,6 @@
-diff -u ./src/common/gst-auth.c-clean ./src/common/gst-auth.c
---- ./src/common/gst-auth.c-clean Tue May 9 13:09:57 2006
-+++ ./src/common/gst-auth.c Thu May 11 16:18:00 2006
-@@ -43,6 +43,13 @@
+--- gnome-system-tools-2.14.0.orig/src/common/gst-auth.c Tue Jan 31 06:40:32 2006
++++ gnome-system-tools-2.14.0/src/common/gst-auth.c Thu Oct 19 16:46:03 2006
+@@ -43,10 +43,20 @@
#ifdef __FreeBSD__
# include <errno.h>
# include <libutil.h>
@@ -15,7 +14,14 @@
#else
#include <pty.h>
#endif
-@@ -53,6 +60,10 @@
+
++#include <gksu.h>
++#include <gksuui-dialog.h>
++
+ #include "gst-auth.h"
+ #include "gst-tool.h"
+ #include "gst-platform.h"
+@@ -53,6 +63,10 @@
#define GST_AUTH_RESPONSE_NP 1
@@ -26,7 +32,7 @@
static int root; /* if we are root, no password is
required */
-@@ -118,6 +129,122 @@
+@@ -118,6 +132,122 @@
return TRUE;
}
@@ -149,7 +155,7 @@
/* runs a term with su in it */
static void
gst_auth_run_term (GstTool *tool, gchar *args[])
-@@ -177,8 +304,15 @@
+@@ -177,8 +307,15 @@
gchar *s, *str;
gint ret;
@@ -165,7 +171,7 @@
str = g_ascii_strup (s, -1);
/* FIXME: hope that someday we can get rid of this ssh output string parsing */
-@@ -189,6 +323,11 @@
+@@ -189,6 +326,11 @@
/* it's asking for the password */
cont = TRUE;
ret = GST_AUTH_PASSWORD;
@@ -177,7 +183,69 @@
} else if (g_strrstr (str, "\n") != NULL) {
/* this is the last case to test, it's the CR
used to synchronize communication */
-@@ -296,6 +435,12 @@
+@@ -286,7 +428,61 @@
+ gchar *password;
+ gint result;
+ struct termios t;
++ GksuContext *context;
++ GError *error = NULL;
++ GtkWidget *gksuui_dialog;
++ gint response;
+
++#ifdef HAVE_GKSU
++ context = gksu_context_new ();
++#ifdef GST_DEBUG
++ gksu_context_set_debug (context, TRUE);
++#endif
++ gksu_context_set_command (context, args[3]);
++ gksu_context_set_wait_for_child_to_exit (context, FALSE);
++ if (gksu_context_try_need_password (context) )
++ {
++ password = NULL;
++ gchar *pw_prompt = NULL;
++ gksuui_dialog = gksuui_dialog_new ();
++ gksuui_dialog_set_message (GKSUUI_DIALOG(gksuui_dialog),
++ g_strdup_printf("<b>You need %s privileges to use this tool. "
++ "Enter a password to modify your system configuration.</b>",
++ context->user));
++ gtk_widget_show (gksuui_dialog);
++
++ response = gtk_dialog_run (GTK_DIALOG(gksuui_dialog));
++
++ switch (response) {
++ case GTK_RESPONSE_OK:
++ break;
++ default:
++ /* Cancel */
++ exit (0);
++ break;
++ }
++#ifdef GST_DEBUG
++ fprintf (stderr, "response ID: %d\n", response);
++#endif
++ password = gksuui_dialog_get_password (GKSUUI_DIALOG(gksuui_dialog));
++ gtk_widget_destroy ( gksuui_dialog );
++ gksu_context_set_password (context, password);
++ }
++
++ error = NULL;
++ gksu_context_run (context, &error);
++ tool->read_fd = gksu_context_get_child_stdin_fd (context);
++ tool->write_fd = gksu_context_get_child_stdout_fd (context);
++ tool->backend_pid = gksu_context_get_child_pid (context);
++ tool->timeout_id = g_timeout_add (1000, (GSourceFunc) gst_auth_wait_child, tool);
++#ifdef GST_DEBUG
++ fprintf (stderr, "read_fd = %d, write_fd = %d\n", tool->read_fd, tool->write_fd);
++#endif
++ tool->read_stream = gksu_context_get_child_stdin_file (context);
++ tool->write_stream = gksu_context_get_child_stdout_file (context);
++ setvbuf ( tool->read_stream, NULL, _IONBF, 0);
++ fcntl (tool->read_fd, F_SETFL, 0);
++#else
+ gst_auth_run_term (tool, args);
+ result = gst_auth_get_auth_required (tool);
+
+@@ -296,7 +492,14 @@
if (strlen (password) > 0)
memset (password, 0, strlen (password));
@@ -188,9 +256,20 @@
+ }
+#endif /* __sun */
}
++#endif
tool->root_access = ROOT_ACCESS_REAL;
-@@ -378,7 +523,11 @@
+
+@@ -368,7 +571,7 @@
+ GString *command;
+
+ command = g_string_new (NULL);
+- gst_auth_save_locale (command);
++// gst_auth_save_locale (command);
+ command = g_string_append (command, tool->script_path);
+ command = g_string_append (command, " --report");
+
+@@ -378,7 +581,11 @@
}
/* these are the su args */
@@ -202,4 +281,3 @@
su_args[1] = "root";
su_args[2] = "-c";
su_args[3] = command->str;
-