NetworkManager r3658 - in trunk: . system-settings/src



Author: dcbw
Date: Mon May 12 02:49:54 2008
New Revision: 3658
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3658&view=rev

Log:
2008-05-11  Dan Williams  <dcbw redhat com>

	* configure.in
		- record PolicyKit version

	* system-settings/src/nm-polkit-helpers.c
		- (check_polkit_privileges): use polkit_context_can_caller_do_action()
			with PolicyKit <= 0.6



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/system-settings/src/nm-polkit-helpers.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon May 12 02:49:54 2008
@@ -227,6 +227,38 @@
 
 PKG_CHECK_MODULES(POLKIT, polkit-dbus)
 
+##### Find out the version of PolicyKit we're using
+polkit_version=`pkg-config --modversion polkit`
+POLKIT_VERSION_MAJOR=`echo $polkit_version | awk -F. '{print $1}'`
+POLKIT_VERSION_MINOR=`echo $polkit_version | awk -F. '{print $2}'`
+POLKIT_VERSION_MICRO=`echo $polkit_version | awk -F. '{print $3}'`
+if test "z$POLKIT_VERSION_MAJOR" = "z"; then
+	POLKIT_VERSION_MAJOR="0"
+fi
+if test "z$POLKIT_VERSION_MINOR" = "z"; then
+	POLKIT_VERSION_MINOR="0"
+fi
+if test "z$POLKIT_VERSION_MICRO" = "z"; then
+	POLKIT_VERSION_MICRO="0"
+fi
+
+if test "z$POLKIT_VERSION_MAJOR" = "z0" -a "z$POLKIT_VERSION_MINOR" = "z0" -a "z$POLKIT_VERSION_MICRO" = "z0"; then
+	echo "Error: Couldn't determine the version of your PolicyKit package."
+	echo "  This is probably an error in this script, please report it"
+	echo "  along with the following information:"
+	echo "      Base PolicyKit version ='$polkit_version'"
+	echo "      POLKIT_VERSION_MAJOR='$POLKIT_VERSION_MAJOR'"
+	echo "      POLKIT_VERSION_MINOR='$POLKIT_VERSION_MINOR'"
+	echo "      POLKIT_VERSION_MICRO='$POLKIT_VERSION_MICRO'"
+	exit 1
+else
+	echo "Your PolicyKit version is $POLKIT_VERSION_MAJOR,$POLKIT_VERSION_MINOR,$POLKIT_VERSION_MICRO."
+	POLKIT_CFLAGS="$POLKIT_CFLAGS -DPOLKIT_VERSION_MAJOR=$POLKIT_VERSION_MAJOR"
+	POLKIT_CFLAGS="$POLKIT_CFLAGS -DPOLKIT_VERSION_MINOR=$POLKIT_VERSION_MINOR"
+	POLKIT_CFLAGS="$POLKIT_CFLAGS -DPOLKIT_VERSION_MICRO=$POLKIT_VERSION_MICRO"
+fi
+AC_SUBST(POLKIT_CFLAGS)
+
 AC_PATH_PROG([POLKIT_POLICY_FILE_VALIDATE], [polkit-policy-file-validate], [false])
 
 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`

Modified: trunk/system-settings/src/nm-polkit-helpers.c
==============================================================================
--- trunk/system-settings/src/nm-polkit-helpers.c	(original)
+++ trunk/system-settings/src/nm-polkit-helpers.c	Mon May 12 02:49:54 2008
@@ -123,7 +123,11 @@
 	pk_action = polkit_action_new ();
 	polkit_action_set_action_id (pk_action, NM_SYSCONFIG_POLICY_ACTION);
 
+#if (POLKIT_VERSION_MAJOR == 0) && (POLKIT_VERSION_MINOR < 7)
+	pk_result = polkit_context_can_caller_do_action (pol_ctx, pk_action, pk_caller);
+#else
 	pk_result = polkit_context_is_caller_authorized (pol_ctx, pk_action, pk_caller, TRUE, NULL);
+#endif
 	polkit_caller_unref (pk_caller);
 	polkit_action_unref (pk_action);
 



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