22
0

Accepting request 435422 from GNOME:Next

Rename of NM-gnome (and versionbump)

OBS-URL: https://build.opensuse.org/request/show/435422
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/NetworkManager-applet?expand=0&rev=1
This commit is contained in:
Bjørn Lie
2016-10-29 09:32:40 +00:00
committed by Git OBS Bridge
commit 421a715b4a
8 changed files with 3260 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+276
View File
@@ -0,0 +1,276 @@
#
# spec file for package NetworkManager-applet
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define with_cacert_patch 0
%define sover 0
%define _name network-manager-applet
Name: NetworkManager-applet
Version: 1.4.2
Release: 0
Summary: GTK+ tray applet for use with NetworkManager
License: GPL-2.0+
Group: System/GUI/GNOME
Url: https://gnome.org/projects/NetworkManager
Source: http://download.gnome.org/sources/network-manager-applet/1.4/network-manager-applet-%{version}.tar.xz
# PATCH-NEEDS-REBASE nm-applet-private-connection.patch boo#751211 bgo#646187 dimstar@opensuse.org -- Create private connections if the user is not authorised. Allows to create wifi connections without root access. Patch under discussion upstream. (WAS: PATCH-FIX-UPSTREAM)
Patch0: nm-applet-private-connection.patch
# PATCH-NEEDS-REBASE nm-applet-probe-radius-server-cert.patch bsc#574266 glin@suse.com -- Probe the RADIUS server certificate. (WAS: PATCH-FIX-UPSTREAM)
Patch1: nm-applet-probe-radius-server-cert.patch
# PATCH-FEATURE-UPSTREAM network-manager-applet-no-firewalld.patch boo#897636 bgo#737687 dimstar@opensuse.org -- Allow disabling FirewallD integration.
Patch2: network-manager-applet-no-firewalld.patch
# Needed for patch0 - disabled since patch0 is disabled.
#BuildRequires: gnome-common
BuildRequires: intltool
# Needed by Patch0. Patch0 is currently disabled.
#BuildRequires: libtool
BuildRequires: pkgconfig
# Needed by Patch0.
BuildRequires: polkit-devel
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(NetworkManager) >= 1.3
BuildRequires: pkgconfig(appindicator3-0.1)
BuildRequires: pkgconfig(dbusmenu-gtk3-0.4) >= 16.04.0
BuildRequires: pkgconfig(gtk+-3.0) >= 3.4
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gudev-1.0) >= 147
BuildRequires: pkgconfig(iso-codes)
BuildRequires: pkgconfig(jansson) >= 2.3
BuildRequires: pkgconfig(libnm) >= 1.3
BuildRequires: pkgconfig(libnm-glib) >= 1.3
BuildRequires: pkgconfig(libnm-glib-vpn) >= 1.3
BuildRequires: pkgconfig(libnm-util) >= 1.3
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(libsecret-unstable)
BuildRequires: pkgconfig(mm-glib)
Requires: NetworkManager >= 0.9.3
Requires: dbus(org.freedesktop.secrets)
# Needed for translated country names.
Requires: iso-codes
# mobile-broadband-provider-info is required for DUN capabilities. The BT plugin crashes without it.
Requires: mobile-broadband-provider-info
Requires: timezone
Recommends: %{name}-lang
Recommends: NetworkManager-connection-editor
Provides: NetworkManager-client
# NetworkManager-gnome was last used in openSUSE Leap 42.2.
Provides: NetworkManager-gnome = %{version}
Obsoletes: NetworkManager-gnome < %{version}
Obsoletes: NetworkManager-gnome-lang
%glib2_gsettings_schema_requires
%if !0%{?is_opensuse}
BuildRequires: translation-update-upstream
%endif
%if %{with_cacert_patch}
Requires: NetworkManager(cacert-patch)
%endif
%description
This package contains utilities and applications for use with
NetworkManager, including a panel applet for wireless networks.
%package -n NetworkManager-connection-editor
Summary: GUI to configure connections for NetworkManager
Group: System/GUI/GNOME
%description -n NetworkManager-connection-editor
NetworkManager Configuration tool - take control over your
connection settings.
%package -n libnma%{sover}
Summary: NetworkManager UI dialog library
Group: System/Libraries
# The .ui files are split in case libnma ever bumps ABI.
Requires: libnma-data >= %{version}
%description -n libnma%{sover}
This library provides UI dialogs for NetworkManager integration.
%package -n libnma-data
Summary: NetworkManager UI dialogs
Group: System/Libraries
%description -n libnma-data
This package provides GTK+ dialogs for NetworkManager integration.
%package -n typelib-1_0-NMA-1_0
Summary: NetworkManager UI dialogs -- Introspection bindings
Group: System/Libraries
%description -n typelib-1_0-NMA-1_0
This library provides GTK+ dialogs for NetworkManager integration
provided as introspection bindings.
%package -n libnma-devel
Summary: NetworkManager UI dialogs -- Development Files
Group: Development/Libraries/GNOME
Requires: libnma0 = %{version}
Requires: typelib-1_0-NMA-1_0 = %{version}
%description -n libnma-devel
This library provides GTK+ dialogs for NetworkManager integration.
%package -n libnm-gtk%{sover}
Summary: NetworkManager Gtk+ dialog library
Group: System/Libraries
# The .ui files are split in case libnm-gtk ever bumps ABI.
Requires: libnm-gtk-data >= %{version}
%description -n libnm-gtk%{sover}
This library provides GTK+ dialogs for NetworkManager integration.
%package -n libnm-gtk-data
Summary: NetworkManager Gtk+ dialogs
Group: System/Libraries
# Until the appearance of the NetworkManager 1.1 branch, the .ui
# files were shipped in libnm-gtk0 directly, violating the SLPP.
Conflicts: libnm-gtk0 < 1.1
%description -n libnm-gtk-data
This package provides GTK+ dialogs for NetworkManager integration.
%package -n typelib-1_0-NMGtk-1_0
Summary: NetworkManager Gtk+ dialogs -- Introspection bindings
Group: System/Libraries
%description -n typelib-1_0-NMGtk-1_0
This library provides GTK+ dialogs for NetworkManager integration
provided as introspection bindings.
%package -n libnm-gtk-devel
Summary: NetworkManager Gtk+ dialogs -- Development Files
Group: Development/Libraries/GNOME
Requires: libnm-gtk%{sover} = %{version}
Requires: typelib-1_0-NMGtk-1_0 = %{version}
%description -n libnm-gtk-devel
This library provides GTK+ dialogs for NetworkManager integration.
%lang_package
%prep
%setup -q -n %{_name}-%{version}
# Needs rebase.
# %%patch0 -p1
%if %{with_cacert_patch}
%patch1 -p1
%endif
%patch2 -p1
%if !0%{?is_opensuse}
translation-update-upstream
%endif
%build
# Patch0 is disabled.
#NOCONFIGURE=1 gnome-autogen.sh
%configure \
--disable-static \
--disable-maintainer-mode \
--with-appindicator
make %{?_smp_mflags}
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%suse_update_desktop_file -r nm-connection-editor GTK GNOME System X-SuSE-ServiceConfiguration
%find_lang nm-applet %{?no_lang_C}
%post
%desktop_database_post
%icon_theme_cache_post
%glib2_gsettings_schema_post
%postun
%desktop_database_postun
%icon_theme_cache_postun
%glib2_gsettings_schema_postun
%post -n libnm-gtk%{sover} -p /sbin/ldconfig
%postun -n libnm-gtk%{sover} -p /sbin/ldconfig
%post -n libnma%{sover} -p /sbin/ldconfig
%postun -n libnma%{sover} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc COPYING CONTRIBUTING NEWS
%{_sysconfdir}/xdg/autostart/nm-applet.desktop
%{_bindir}/nm-applet
%{_datadir}/nm-applet/
# This file moves to NetworkManager-connection-editor
%exclude %{_datadir}/nm-applet/nm-connection-editor.ui
%{_datadir}/GConf/gsettings/nm-applet.convert
%{_datadir}/glib-2.0/schemas/org.gnome.nm-applet.gschema.xml
%{_datadir}/applications/nm-applet.desktop
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/icons/hicolor/*/apps/*.svg
%{_mandir}/man1/nm-applet.1%{?ext_man}
%files lang -f nm-applet.lang
%defattr(-,root,root)
%files -n NetworkManager-connection-editor
%defattr(-,root,root)
%{_bindir}/nm-connection-editor
%dir %{_datadir}/nm-applet/
%{_datadir}/nm-applet/nm-connection-editor.ui
%{_datadir}/applications/nm-connection-editor.desktop
%dir %{_datadir}/appdata/
%{_datadir}/appdata/nm-connection-editor.appdata.xml
%{_mandir}/man1/nm-connection-editor.1%{?ext_man}
%files -n libnm-gtk%{sover}
%defattr(-,root,root)
%{_libdir}/libnm-gtk.so.%{sover}*
%files -n libnm-gtk-data
%defattr(-,root,root)
%{_datadir}/libnm-gtk/
%files -n typelib-1_0-NMGtk-1_0
%defattr(-,root,root)
%{_libdir}/girepository-1.0/NMGtk-1.0.typelib
%files -n libnm-gtk-devel
%defattr(-,root,root)
%{_datadir}/gir-1.0/NMGtk-1.0.gir
%{_includedir}/libnm-gtk/
%{_libdir}/libnm-gtk.so
%{_libdir}/pkgconfig/libnm-gtk.pc
%files -n libnma%{sover}
%defattr(-,root,root)
%{_libdir}/libnma.so.%{sover}*
%files -n typelib-1_0-NMA-1_0
%defattr(-,root,root)
%{_libdir}/girepository-1.0/NMA-1.0.typelib
%files -n libnma-data
%defattr(-,root,root)
%{_datadir}/libnma/
%files -n libnma-devel
%defattr(-,root,root)
%{_includedir}/libnma/
%{_libdir}/libnma.so
%{_libdir}/pkgconfig/libnma.pc
%{_datadir}/gir-1.0/NMA-1.0.gir
%changelog
+23
View File
@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
+1
View File
@@ -0,0 +1 @@
.osc
Binary file not shown.
+126
View File
@@ -0,0 +1,126 @@
From 13e9bee8d32dde4f59e23c054ed9a96ca10cd4b0 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Wed, 1 Oct 2014 00:30:38 +0200
Subject: [PATCH] build: Allow to build without firewalld support
Not all distributions ship firewalld (e.g. openSUSE). The firewall zone
configuration in nm-connection-editor gives warnings about dbus service
not reachable.
Add a --without-firewalld option to configure to build without those
features. Default, if not specified, is to enable firewalld support,
as-is.
https://bugzilla.gnome.org/show_bug.cgi?id=737687
---
configure.ac | 5 +++++
src/connection-editor/page-general.c | 16 ++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
Index: network-manager-applet-1.4.0/configure.ac
===================================================================
--- network-manager-applet-1.4.0.orig/configure.ac
+++ network-manager-applet-1.4.0/configure.ac
@@ -110,6 +110,11 @@ fi
AM_CONDITIONAL(HAVE_GBT, test x"$have_gbt" = "xyes")
+AC_ARG_WITH([firewalld],
+ AS_HELP_STRING([--with-firewalld|--without-firewalld], [Enable firewalld integration support]),
+ with_firewalld="$withval",with_firewalld=yes)
+AM_CONDITIONAL(HAVE_FIREWALLD, test x"with_firewalld" = "xyes")
+
dnl ModemManager1 with libmm-glib for WWAN support
AC_ARG_WITH(wwan, AS_HELP_STRING([--with-wwan], [Enable WWAN support (default: yes)]))
if (test "${with_wwan}" == "no"); then
Index: network-manager-applet-1.4.0/src/connection-editor/page-general.c
===================================================================
--- network-manager-applet-1.4.0.orig/src/connection-editor/page-general.c
+++ network-manager-applet-1.4.0/src/connection-editor/page-general.c
@@ -58,6 +58,7 @@ enum {
N_COLUMNS
};
+#if 0
static void populate_firewall_zones_ui (CEPageGeneral *self);
static void
@@ -125,16 +126,19 @@ on_fw_proxy_acquired (GObject *object, G
(GAsyncReadyCallback) get_zones_cb,
self);
}
+#endif
static void
general_private_init (CEPageGeneral *self)
{
CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (self);
GtkBuilder *builder;
+ builder = CE_PAGE (self)->builder;
+
+#if 0
GtkWidget *vbox;
GtkLabel *label;
- builder = CE_PAGE (self)->builder;
/*-- Firewall zone --*/
priv->firewall_zone = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new ());
@@ -158,6 +162,7 @@ general_private_init (CEPageGeneral *sel
/* Set mnemonic widget for device Firewall zone label */
label = GTK_LABEL (gtk_builder_get_object (builder, "firewall_zone_label"));
gtk_label_set_mnemonic_widget (label, GTK_WIDGET (priv->firewall_zone));
+#endif
/*-- Dependent VPN connection --*/
priv->dependent_vpn_checkbox = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "dependent_vpn_checkbox"));
@@ -178,9 +183,9 @@ dispose (GObject *object)
g_clear_object (&priv->cancellable);
}
g_clear_object (&priv->fw_proxy);
-
+#if 0
g_clear_pointer (&priv->zones, g_strfreev);
-
+#endif
G_OBJECT_CLASS (ce_page_general_parent_class)->dispose (object);
}
@@ -199,6 +204,7 @@ vpn_checkbox_toggled (GtkToggleButton *b
ce_page_changed (CE_PAGE (user_data));
}
+#if 0
static void
populate_firewall_zones_ui (CEPageGeneral *self)
{
@@ -237,6 +243,7 @@ populate_firewall_zones_ui (CEPageGenera
stuff_changed (NULL, self);
}
+#endif
static void
populate_ui (CEPageGeneral *self)
@@ -250,9 +257,11 @@ populate_ui (CEPageGeneral *self)
GtkTreeIter iter;
gboolean global_connection = TRUE;
+#if 0
/* Zones are filled when got them from firewalld */
if (priv->got_zones)
populate_firewall_zones_ui (self);
+#endif
/* Secondary UUID (VPN) */
vpn_uuid = nm_setting_connection_get_secondary (setting, 0);
@@ -314,7 +323,9 @@ finish_setup (CEPageGeneral *self, gpoin
populate_ui (self);
+#if 0
g_signal_connect (priv->firewall_zone, "changed", G_CALLBACK (stuff_changed), self);
+#endif
any_dependent_vpn = !!nm_setting_connection_get_num_secondaries (priv->setting);
gtk_toggle_button_set_active (priv->dependent_vpn_checkbox, any_dependent_vpn);
+421
View File
@@ -0,0 +1,421 @@
From 1a06498ed24c3580acb286a539aba0c99a544b0f Mon Sep 17 00:00:00 2001
From: Gary Ching-Pang Lin <chingpang@gmail.com>
Date: Thu, 2 Feb 2012 18:08:56 +0800
Subject: [PATCH] Create private connections if the user is not authorized
Some distributions do not allow the normal user to create a system
connection without the polkit authentication. This commit checks
the polkit policy and creates private connections if the user is
not authorized.
https://bugzilla.gnome.org/show_bug.cgi?id=646187
---
configure.ac | 4 +++
src/applet-device-ethernet.c | 7 +++++
src/applet-device-wifi.c | 12 ++++++++
src/applet-device-wimax.c | 7 +++++
src/connection-editor/Makefile.am | 2 ++
src/connection-editor/ce-page.c | 47 ++++++++++++++++++++++++++++++
src/gnome-bluetooth/Makefile.am | 2 ++
src/gnome-bluetooth/nma-bt-device.c | 58 +++++++++++++++++++++++++++++++++++++
src/mobile-helpers.c | 6 ++++
src/utils/Makefile.am | 3 +-
src/utils/utils.c | 40 +++++++++++++++++++++++++
src/utils/utils.h | 2 ++
12 files changed, 189 insertions(+), 1 deletion(-)
Index: network-manager-applet-1.0.10/configure.ac
===================================================================
--- network-manager-applet-1.0.10.orig/configure.ac
+++ network-manager-applet-1.0.10/configure.ac
@@ -86,6 +86,10 @@ PKG_CHECK_MODULES(NMA,
NMA_CFLAGS="$NMA_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
+PKG_CHECK_MODULES(POLKIT, [polkit-gobject-1])
+AC_SUBST(POLKIT_CFLAGS)
+AC_SUBST(POLKIT_LIBS)
+
AC_MSG_CHECKING([whether to build nm-applet-migration-tool])
AC_ARG_ENABLE([migration],
[AS_HELP_STRING([--disable-migration], [Don't build migration tool for NM <= 0.8 settings])],
Index: network-manager-applet-1.0.10/src/applet-device-ethernet.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/applet-device-ethernet.c
+++ network-manager-applet-1.0.10/src/applet-device-ethernet.c
@@ -40,6 +40,7 @@
#include "applet-device-ethernet.h"
#include "ethernet-dialog.h"
#include "nm-ui-utils.h"
+#include "utils.h"
#define DEFAULT_ETHERNET_NAME _("Auto Ethernet")
@@ -68,6 +69,12 @@ ethernet_new_auto_connection (NMDevice *
NM_SETTING_CONNECTION_UUID, uuid,
NULL);
g_free (uuid);
+ if (!utils_system_connection_authorized ()) {
+ nm_setting_connection_add_permission (s_con,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
nm_connection_add_setting (connection, NM_SETTING (s_con));
Index: network-manager-applet-1.0.10/src/applet-device-wifi.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/applet-device-wifi.c
+++ network-manager-applet-1.0.10/src/applet-device-wifi.c
@@ -445,6 +445,18 @@ _do_new_auto_connection (NMApplet *apple
nm_connection_add_setting (connection, NM_SETTING (s_8021x));
}
+ if (!utils_system_connection_authorized ()) {
+ s_con = nm_connection_get_setting_connection (connection);
+ if (!s_con) {
+ s_con = (NMSettingConnection *) nm_setting_connection_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_con));
+ }
+ nm_setting_connection_add_permission (s_con,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
+
/* If it's an 802.1x connection, we need more information, so pop up the
* Dialog Of Doom.
*/
Index: network-manager-applet-1.0.10/src/applet-device-wimax.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/applet-device-wimax.c
+++ network-manager-applet-1.0.10/src/applet-device-wimax.c
@@ -39,6 +39,7 @@
#include "nma-marshal.h"
#include "mb-menu-item.h"
#include "nm-ui-utils.h"
+#include "utils.h"
#define ACTIVE_NSP_TAG "active-nsp"
@@ -94,6 +95,12 @@ wimax_new_auto_connection (NMDevice *dev
NM_SETTING_CONNECTION_UUID, uuid,
NULL);
g_free (uuid);
+ if (!utils_system_connection_authorized ()) {
+ nm_setting_connection_add_permission (s_con,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
nm_connection_add_setting (connection, NM_SETTING (s_con));
Index: network-manager-applet-1.0.10/src/connection-editor/Makefile.am
===================================================================
--- network-manager-applet-1.0.10.orig/src/connection-editor/Makefile.am
+++ network-manager-applet-1.0.10/src/connection-editor/Makefile.am
@@ -13,6 +13,7 @@ nm_connection_editor_CPPFLAGS = \
-DDATADIR=\""$(datadir)"\" \
-DNMALOCALEDIR=\"$(datadir)/locale\" \
$(DBUS_CFLAGS) \
+ $(POLKIT_CFLAGS) \
$(DISABLE_DEPRECATED) \
-I${top_srcdir}/src/utils \
-I${top_srcdir}/src/wireless-security \
@@ -94,6 +95,7 @@ nm_connection_editor_LDADD = \
${top_builddir}/src/libnm-gtk/libnm-gtk.la \
$(GTK_LIBS) \
$(NMA_LIBS) \
+ $(POLKIT_LIBS) \
-lm
uidir = $(datadir)/nm-applet
Index: network-manager-applet-1.0.10/src/connection-editor/ce-page.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/connection-editor/ce-page.c
+++ network-manager-applet-1.0.10/src/connection-editor/ce-page.c
@@ -29,6 +29,8 @@
#include <glib/gi18n.h>
+#include <polkit/polkit.h>
+
#include <nm-setting-connection.h>
#include <nm-utils.h>
#include <nm-device-bt.h>
@@ -868,6 +870,44 @@ ce_page_class_init (CEPageClass *page_cl
G_TYPE_NONE, 1, G_TYPE_POINTER);
}
+static gboolean
+polkit_system_connection_authorized (void)
+{
+ PolkitSubject *subject;
+ PolkitAuthority *authority;
+ PolkitAuthorizationResult *result;
+ GError *error = NULL;
+ static gboolean is_checked = FALSE;
+ static gboolean is_authorized = FALSE;
+
+ if (is_checked)
+ return is_authorized;
+
+ /* Check the polkit authorization */
+ authority = polkit_authority_get_sync (NULL, NULL);
+ subject = polkit_unix_process_new_for_owner (getpid (), 0, -1);
+ result = polkit_authority_check_authorization_sync (authority,
+ subject,
+ "org.freedesktop.NetworkManager.settings.modify.system",
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ NULL,
+ &error);
+ if (error || !result) {
+ g_warning ("%s: failed to check polkit authorization! %s", __func__,
+ error ? error->message : "(unknown)");
+ g_clear_error (&error);
+ } else if (polkit_authorization_result_get_is_authorized (result)) {
+ is_authorized = TRUE;
+ }
+ g_object_unref (result);
+ g_object_unref (authority);
+ g_object_unref (subject);
+
+ is_checked = TRUE;
+
+ return is_authorized;
+}
NMConnection *
ce_page_new_connection (const char *format,
@@ -902,6 +942,13 @@ ce_page_new_connection (const char *form
g_free (uuid);
g_free (id);
+ if (!polkit_system_connection_authorized ()) {
+ nm_setting_connection_add_permission (s_con,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
+
return connection;
}
Index: network-manager-applet-1.0.10/src/gnome-bluetooth/Makefile.am
===================================================================
--- network-manager-applet-1.0.10.orig/src/gnome-bluetooth/Makefile.am
+++ network-manager-applet-1.0.10/src/gnome-bluetooth/Makefile.am
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
-I${top_srcdir}/src/utils \
-I${top_srcdir}/src/libnm-gtk \
$(GNOME_BLUETOOTH_CFLAGS) \
+ $(POLKIT_CFLAGS) \
$(DISABLE_DEPRECATED) \
$(WARN_CFLAGS)
@@ -34,6 +35,7 @@ libnma_la_LIBADD = \
$(top_builddir)/src/marshallers/libmarshallers.la \
$(top_builddir)/src/utils/libutils.la \
$(top_builddir)/src/libnm-gtk/libnm-gtk.la \
+ $(POLKIT_LIBS) \
$(GNOME_BLUETOOTH_LIBS)
if WITH_MODEM_MANAGER_1
Index: network-manager-applet-1.0.10/src/gnome-bluetooth/nma-bt-device.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/gnome-bluetooth/nma-bt-device.c
+++ network-manager-applet-1.0.10/src/gnome-bluetooth/nma-bt-device.c
@@ -34,6 +34,8 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
+#include <polkit/polkit.h>
+
#include <nm-remote-settings.h>
#include <nm-remote-connection.h>
@@ -227,6 +229,44 @@ recheck_services_enabled (NmaBtDevice *s
}
/*********************************************************************/
+static gboolean
+polkit_system_connection_authorized (void)
+{
+ PolkitSubject *subject;
+ PolkitAuthority *authority;
+ PolkitAuthorizationResult *result;
+ GError *error = NULL;
+ static gboolean is_checked = FALSE;
+ static gboolean is_authorized = FALSE;
+
+ if (is_checked)
+ return is_authorized;
+
+ /* Check the polkit authorization */
+ authority = polkit_authority_get_sync (NULL, NULL);
+ subject = polkit_unix_process_new_for_owner (getpid (), 0, -1);
+ result = polkit_authority_check_authorization_sync (authority,
+ subject,
+ "org.freedesktop.NetworkManager.settings.modify.system",
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ NULL,
+ &error);
+ if (error || !result) {
+ g_warning ("%s: failed to check polkit authorization! %s", __func__,
+ error ? error->message : "(unknown)");
+ g_clear_error (&error);
+ } else if (polkit_authorization_result_get_is_authorized (result)) {
+ is_authorized = TRUE;
+ }
+ g_object_unref (result);
+ g_object_unref (authority);
+ g_object_unref (subject);
+
+ is_checked = TRUE;
+
+ return is_authorized;
+}
const char *
nma_bt_device_get_bdaddr (NmaBtDevice *device)
@@ -368,6 +408,12 @@ dun_new_cdma (NMAMobileWizardAccessMetho
NULL);
g_free (uuid);
g_free (id);
+ if (!polkit_system_connection_authorized ()) {
+ nm_setting_connection_add_permission ((NMSettingConnection *)setting,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
nm_connection_add_setting (connection, setting);
return connection;
@@ -414,6 +460,12 @@ dun_new_gsm (NMAMobileWizardAccessMethod
NULL);
g_free (uuid);
g_free (id);
+ if (!polkit_system_connection_authorized ()) {
+ nm_setting_connection_add_permission ((NMSettingConnection *)setting,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
nm_connection_add_setting (connection, setting);
return connection;
@@ -978,6 +1030,12 @@ add_pan_connection (NmaBtDevice *self)
NULL);
g_free (id);
g_free (uuid);
+ if (!polkit_system_connection_authorized ()) {
+ nm_setting_connection_add_permission ((NMSettingConnection *)setting,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
nm_connection_add_setting (connection, setting);
/* The Bluetooth settings */
Index: network-manager-applet-1.0.10/src/mobile-helpers.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/mobile-helpers.c
+++ network-manager-applet-1.0.10/src/mobile-helpers.c
@@ -219,6 +219,12 @@ mobile_wizard_done (NMAMobileWizard *wiz
"user", g_get_user_name (), NULL);
g_free (uuid);
g_free (id);
+ if (!utils_system_connection_authorized ()) {
+ nm_setting_connection_add_permission ((NMSettingConnection *)setting,
+ "user",
+ g_get_user_name(),
+ NULL);
+ }
nm_connection_add_setting (connection, setting);
}
Index: network-manager-applet-1.0.10/src/utils/Makefile.am
===================================================================
--- network-manager-applet-1.0.10.orig/src/utils/Makefile.am
+++ network-manager-applet-1.0.10/src/utils/Makefile.am
@@ -10,7 +10,8 @@ libutils_la_SOURCES = \
libutils_la_CPPFLAGS = \
$(GTK_CFLAGS) \
$(NMA_CFLAGS) \
+ $(POLKIT_CFLAGS) \
$(DISABLE_DEPRECATED) \
-I${top_srcdir}/src
-libutils_la_LIBADD = $(GTK_LIBS) $(NMA_LIBS)
+libutils_la_LIBADD = $(GTK_LIBS) $(NMA_LIBS) $(POLKIT_LIBS)
Index: network-manager-applet-1.0.10/src/utils/utils.c
===================================================================
--- network-manager-applet-1.0.10.orig/src/utils/utils.c
+++ network-manager-applet-1.0.10/src/utils/utils.c
@@ -27,6 +27,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <polkit/polkit.h>
+
#include <nm-setting-connection.h>
#include <nm-utils.h>
@@ -286,3 +288,41 @@ utils_filter_editable_on_insert_text (Gt
return count > 0;
}
+gboolean
+utils_system_connection_authorized (void)
+{
+ PolkitSubject *subject;
+ PolkitAuthority *authority;
+ PolkitAuthorizationResult *result;
+ GError *error = NULL;
+ static gboolean is_checked = FALSE;
+ static gboolean is_authorized = FALSE;
+
+ if (is_checked)
+ return is_authorized;
+
+ /* Check the polkit authorization */
+ authority = polkit_authority_get_sync (NULL, NULL);
+ subject = polkit_unix_process_new_for_owner (getpid (), 0, -1);
+ result = polkit_authority_check_authorization_sync (authority,
+ subject,
+ "org.freedesktop.NetworkManager.settings.modify.system",
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ NULL,
+ &error);
+ if (error || !result) {
+ g_warning ("%s: failed to check polkit authorization! %s", __func__,
+ error ? error->message : "(unknown)");
+ g_clear_error (&error);
+ } else if (polkit_authorization_result_get_is_authorized (result)) {
+ is_authorized = TRUE;
+ }
+ g_object_unref (result);
+ g_object_unref (authority);
+ g_object_unref (subject);
+
+ is_checked = TRUE;
+
+ return is_authorized;
+}
Index: network-manager-applet-1.0.10/src/utils/utils.h
===================================================================
--- network-manager-applet-1.0.10.orig/src/utils/utils.h
+++ network-manager-applet-1.0.10/src/utils/utils.h
@@ -107,5 +107,7 @@ gboolean utils_filter_editable_on_insert
UtilsFilterGtkEditableFunc validate_character,
gpointer block_func);
+gboolean utils_system_connection_authorized (void);
+
#endif /* UTILS_H */
File diff suppressed because it is too large Load Diff