Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d60bd1f35e0c82afb5f88d78afd23ee9 > files > 37

NetworkManager-0.7.0-9.el5.src.rpm

Index: system-settings/src/nm-polkit-helpers.c
===================================================================
--- system-settings/src/nm-polkit-helpers.c	(revision 4306)
+++ system-settings/src/nm-polkit-helpers.c	(working copy)
@@ -23,6 +23,7 @@
 #include "nm-polkit-helpers.h"
 #include "nm-system-config-error.h"
 
+#ifdef USE_POLKIT
 static gboolean
 pk_io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_data)
 {
@@ -143,3 +144,47 @@ check_polkit_privileges (DBusGConnection
 
 	return TRUE;
 }
+#else
+PolKitContext *
+create_polkit_context (void)
+{
+	return NULL;
+}
+
+gboolean
+check_polkit_privileges (DBusGConnection *g_connection,
+                         PolKitContext *ignored,
+                         DBusGMethodInvocation *context,
+                         GError **error)
+{
+	DBusConnection *connection;
+	char *sender;
+	unsigned long uid = -1;
+
+	connection = dbus_g_connection_get_connection (g_connection);
+	if (connection) {
+		sender = dbus_g_method_get_sender (context);
+		if (sender)
+			uid = dbus_bus_get_unix_user (connection, sender, NULL);
+		g_free (sender);
+	}
+
+	/* Only root can do anything */
+	if (uid != 0) {
+		g_set_error (error,
+		             NM_SYSCONFIG_SETTINGS_ERROR,
+		             NM_SYSCONFIG_SETTINGS_ERROR_NOT_PRIVILEGED,
+		             "%s",
+		             "No privileges to perform this operation.");
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+void
+polkit_context_unref (PolKitContext *pol_ctx)
+{
+}
+#endif
+
Index: system-settings/src/nm-polkit-helpers.h
===================================================================
--- system-settings/src/nm-polkit-helpers.h	(revision 4306)
+++ system-settings/src/nm-polkit-helpers.h	(working copy)
@@ -22,12 +22,21 @@
 #ifndef NM_POLKIT_HELPERS_H
 #define NM_POLKIT_HELPERS_H
 
+#ifdef USE_POLKIT
 #include <polkit-dbus/polkit-dbus.h>
+#endif
+
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
 #define NM_SYSCONFIG_POLICY_ACTION "org.freedesktop.network-manager-settings.system.modify"
 
+#ifndef USE_POLKIT
+typedef void PolKitContext;
+
+void polkit_context_unref (PolKitContext *pol_ctx);
+#endif
+
 PolKitContext *create_polkit_context   (void);
 gboolean       check_polkit_privileges (DBusGConnection *dbus_connection,
 								PolKitContext *pol_ctx,
Index: system-settings/src/Makefile.am
===================================================================
--- system-settings/src/Makefile.am	(revision 4306)
+++ system-settings/src/Makefile.am	(working copy)
@@ -32,7 +32,6 @@ nm_system_settings_CPPFLAGS = \
 	$(DBUS_CFLAGS) \
 	$(GTHREAD_CFLAGS) \
 	$(GMODULE_CFLAGS) \
-	$(POLKIT_CFLAGS) \
 	-DDBUS_API_SUBJECT_TO_CHANGE \
 	-DG_DISABLE_DEPRECATED	\
 	-DBINDIR=\"$(bindir)\" \
@@ -48,7 +47,6 @@ nm_system_settings_LDADD = \
 	$(DBUS_LIBS) \
 	$(GTHREAD_LIBS) \
 	$(GMODULE_LIBS) \
-	$(POLKIT_LIBS) \
 	$(top_builddir)/libnm-util/libnm-util.la \
 	$(top_builddir)/libnm-glib/libnm_glib.la \
 	$(top_builddir)/marshallers/libmarshallers.la
Index: configure.in
===================================================================
--- configure.in	(revision 4306)
+++ configure.in	(working copy)
@@ -247,42 +247,6 @@ PKG_CHECK_MODULES(UUID, uuid)
 AC_SUBST(UUID_CFLAGS)
 AC_SUBST(UUID_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])
-
 AC_ARG_WITH(crypto, AC_HELP_STRING([--with-crypto=nss | gnutls], [Cryptography library to use for certificate and key operations]),ac_crypto=$withval, ac_crypto=nss)
 
 with_nss=no