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



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3658 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-05-12 02:49:54 +00:00
parent 00b8dad035
commit 775a80ad5a
3 changed files with 45 additions and 0 deletions

View file

@ -1,3 +1,12 @@
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
2008-05-11 Dan Williams <dcbw@redhat.com>
Update Fedora system-settings plugin to support latest API and use

View file

@ -227,6 +227,38 @@ AC_SUBST(LIBNL_LIBS)
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`

View file

@ -123,7 +123,11 @@ check_polkit_privileges (DBusGConnection *dbus_connection,
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);