core: fix builds with polkit >= 0.97

polkit_authority_get() is deprecated, should use
polkit_authority_get_sync() instead.
This commit is contained in:
Dan Williams
2010-08-13 13:18:58 -05:00
parent d5468c8527
commit f0e8055cf9
5 changed files with 21 additions and 5 deletions

View File

@@ -255,9 +255,12 @@ AC_SUBST(UUID_CFLAGS)
AC_SUBST(UUID_LIBS)
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)
AC_SUBST(POLKIT_CFLAGS)
# Check for polkit_authority_get_sync()
AC_CHECK_LIB([polkit-1], [polkit_authority_get_sync], ac_have_pk_auth_get_sync="1", ac_have_pk_auth_get_sync="0")
AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORITY_GET_SYNC, $ac_have_pk_auth_get_sync, [Define if you have a polkit with polkit_authority_get_sync()])
AC_ARG_WITH(crypto, AS_HELP_STRING([--with-crypto=nss | gnutls], [Cryptography library to use for certificate and key operations]),ac_crypto=$withval, ac_crypto=nss)
with_nss=no

View File

@@ -19,6 +19,8 @@
* Copyright (C) 2007 - 2010 Red Hat, Inc.
*/
#include <config.h>
#include <netinet/ether.h>
#include <string.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -56,6 +58,11 @@
#include "nm-settings-system-interface.h"
#include "nm-manager-auth.h"
/* Fix for polkit 0.97 and later */
#if !HAVE_POLKIT_AUTHORITY_GET_SYNC
#define polkit_authority_get_sync polkit_authority_get
#endif
#define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd"
#define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd"
@@ -4278,7 +4285,7 @@ nm_manager_init (NMManager *manager)
} else
nm_log_warn (LOGD_AUTOIP4, "could not initialize avahi-autoipd D-Bus proxy");
priv->authority = polkit_authority_get ();
priv->authority = polkit_authority_get_sync ();
if (priv->authority) {
priv->auth_changed_id = g_signal_connect (priv->authority,
"changed",

View File

@@ -16,14 +16,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2008 Novell, Inc.
* (C) Copyright 2008 Red Hat, Inc.
* (C) Copyright 2008 - 2010 Red Hat, Inc.
*/
#ifndef NM_POLKIT_HELPERS_H
#define NM_POLKIT_HELPERS_H
#include <config.h>
#include <polkit/polkit.h>
/* Fix for polkit 0.97 and later */
#if !HAVE_POLKIT_AUTHORITY_GET_SYNC
#define polkit_authority_get_sync polkit_authority_get
#endif
#define NM_SYSCONFIG_POLICY_ACTION_CONNECTION_MODIFY "org.freedesktop.network-manager-settings.system.modify"
#define NM_SYSCONFIG_POLICY_ACTION_WIFI_SHARE_PROTECTED "org.freedesktop.network-manager-settings.system.wifi.share.protected"
#define NM_SYSCONFIG_POLICY_ACTION_WIFI_SHARE_OPEN "org.freedesktop.network-manager-settings.system.wifi.share.open"

View File

@@ -613,7 +613,7 @@ nm_sysconfig_connection_init (NMSysconfigConnection *self)
{
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self);
priv->authority = polkit_authority_get ();
priv->authority = polkit_authority_get_sync ();
if (!priv->authority) {
nm_log_err (LOGD_SYS_SET, "%s: error creating PolicyKit authority");
}

View File

@@ -1508,7 +1508,7 @@ nm_sysconfig_settings_init (NMSysconfigSettings *self)
priv->connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
priv->authority = polkit_authority_get ();
priv->authority = polkit_authority_get_sync ();
if (priv->authority) {
priv->auth_changed_id = g_signal_connect (priv->authority,
"changed",