2006-10-21 Jim Li <[email protected]>
authorjim
Sat, 21 Oct 2006 12:32:33 +0000
changeset 8394 bcd58bae020d
parent 8393 96b43c2324f8
child 8395 f61acd9ce6d4
2006-10-21 Jim Li <[email protected]> * gnome-system-tools.spec: Run autoconf since we're patching configure.ac to look for gksu. * patches/gnome-system-tools-01-config.diff: Add check for gksu library. * patches/gnome-system-tools-02-forkpty.diff: Integrate gksu library into GST.
ChangeLog
gnome-system-tools.spec
patches/gnome-system-tools-01-config.diff
patches/gnome-system-tools-02-forkpty.diff
--- a/ChangeLog	Sat Oct 21 11:03:03 2006 +0000
+++ b/ChangeLog	Sat Oct 21 12:32:33 2006 +0000
@@ -1,3 +1,12 @@
+2006-10-21  Jim Li  <[email protected]>
+
+	* gnome-system-tools.spec:
+	  Run autoconf since we're patching configure.ac to look for gksu.
+	* patches/gnome-system-tools-01-config.diff:
+	  Add check for gksu library.
+	* patches/gnome-system-tools-02-forkpty.diff:
+	  Integrate gksu library into GST.
+
 2006-10-21  Jim Li  <[email protected]>
 
 	* libgksu.spec: reorg all patches
@@ -6,7 +15,7 @@
 	support.
 	* patches/libgksu1.2-01-Makefile.diff: Add -lsecdb option when building
 	libgksu library.
-	* patches/libgksu1.2-02-config.diff: Add check ofr RBAC library libsecdb.
+	* patches/libgksu1.2-02-config.diff: Add check for RBAC library libsecdb.
 	* patches/libgksu1.2-02-forkpty.diff: unite it's changes into 
 	rbac-support.diff, and remove it.
 	* patches/libgksu1.2-04-rbac-support.diff: Add  elevated_privelege and 
--- a/gnome-system-tools.spec	Sat Oct 21 11:03:03 2006 +0000
+++ b/gnome-system-tools.spec	Sat Oct 21 12:32:33 2006 +0000
@@ -91,11 +91,18 @@
   CPUS=1
 fi
 
+glib-gettextize -f
+aclocal $ACLOCAL_FLAGS
+libtoolize --force
+autoheader
+autoconf
+
 %ifos solaris
 CFLAGS="-D NOPTY -D USE_AUTHEN_PAM $RPM_OPT_FLAGS" \
 %else
 CFLAGS="$RPM_OPT_FLAGS" \
 %endif
+
   ./configure \
 	--prefix=%{_prefix} 		  \
 	--sysconfdir=%{_sysconfdir}       \
@@ -135,6 +142,9 @@
 %{_sysconfdir}/gconf/schemas/*
 
 %changelog
+* Sat Oct 21 2006 - [email protected]
+- Run autoconf since we're patching configure.ac to look for gksu.
+
 * Mon Apr 10 2006 - [email protected]
 - Add define USE_AUTHEN_PAM for Solaris
 
--- a/patches/gnome-system-tools-01-config.diff	Sat Oct 21 11:03:03 2006 +0000
+++ b/patches/gnome-system-tools-01-config.diff	Sat Oct 21 12:32:33 2006 +0000
@@ -1,17 +1,56 @@
---- gnome-system-tools-2.13.2/configure.orig	Fri Mar  3 16:02:31 2006
-+++ gnome-system-tools-2.13.2/configure	Fri Mar  3 16:03:51 2006
-@@ -22609,7 +22609,7 @@
- else
-   { { echo "$as_me:$LINENO: error: Libutil library ir required." >&5
- echo "$as_me: error: Libutil library ir required." >&2;}
--   { (exit 1); exit 1; }; }
-+   }
- fi
+--- gnome-system-tools-2.14.0.orig/configure.in	2006-03-13 21:19:33.000000000 +0800
++++ gnome-system-tools-2.14.0/configure.in	2006-10-18 13:22:20.546412000 +0800
+@@ -68,8 +68,15 @@
+ dnl LibUtil checking
+ dnl =====================================================
+ 
++# Don't do on Solaris
++case $host_os in
++solaris*)
++    ;;
++*)
+ AC_CHECK_LIB(util, forkpty, , [AC_MSG_ERROR(Libutil library ir required.)])
+ AC_CHECK_HEADER(pty.h, )
++    ;;
++esac
+ 
+ dnl =====================================================
+ dnl END: LibUtil checking
+@@ -131,6 +138,26 @@
+ dnl =====================================================
  
- if test "${ac_cv_header_pty_h+set}" = set; then
-@@ -25067,7 +25067,7 @@
- GST_LIBS="$GST_DEPENDS_LIBS"
- GST_CFLAGS="$GST_DEPENDS_CFLAGS $GST_CRACK_LIB_CFLAGS $GST_DEPRECATED_FLAGS"
+ dnl =====================================================
++dnl Check for GKSU, on Solaris Only
++dnl =====================================================
++
++case $host_os in
++solaris*)
++PKG_CHECK_MODULES(GKSU,[
++			   libgksu1.2 >= 1.3.1,
++			   libgksuui1.0 >= 1.0
++			   ],[
++			AC_DEFINE(HAVE_GKSU, 1, [define if you have Gksu library])])
++    ;;
++*)
++    ;;
++esac
++
++dnl =====================================================
++dnl END: Check for GKSU
++dnl =====================================================
++
++dnl =====================================================
+ dnl Check for GST Modules to build
+ dnl =====================================================
+ 
+@@ -245,10 +272,10 @@
+ dnl GST_DEPRECATED_FLAGS="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED"
+ GST_DEPRECATED_FLAGS=""
+ 
+-GST_LIBS="$GST_DEPENDS_LIBS"
+-GST_CFLAGS="$GST_DEPENDS_CFLAGS $GST_CRACK_LIB_CFLAGS $GST_DEPRECATED_FLAGS"
++GST_LIBS="$GST_DEPENDS_LIBS $GKSU_LIBS"
++GST_CFLAGS="$GST_DEPENDS_CFLAGS $GKSU_CFLAGS $GST_CRACK_LIB_CFLAGS $GST_DEPRECATED_FLAGS"
  
 -GST_TOOL_LIBS="$GST_LIBS -lutil \$(top_builddir)/src/common/libsetuptool.a"
 +GST_TOOL_LIBS="$GST_LIBS \$(top_builddir)/src/common/libsetuptool.a"
--- 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;
-