mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 05:30:17 +01:00
ifupdown: inherit from NMSysconfigConnection to get PolicyKit authorization
This commit is contained in:
parent
8baebe2a47
commit
a0e635f455
1 changed files with 30 additions and 34 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include <NetworkManager.h>
|
||||
#include <nm-utils.h>
|
||||
#include <nm-setting-wireless-security.h>
|
||||
#include <nm-sysconfig-connection.h>
|
||||
#include <nm-system-config-interface.h>
|
||||
#include <nm-system-config-error.h>
|
||||
#include <nm-settings.h>
|
||||
|
|
@ -33,8 +34,8 @@
|
|||
#include "parser.h"
|
||||
|
||||
G_DEFINE_TYPE (NMIfupdownConnection,
|
||||
nm_ifupdown_connection,
|
||||
NM_TYPE_EXPORTED_CONNECTION)
|
||||
nm_ifupdown_connection,
|
||||
NM_TYPE_SYSCONFIG_CONNECTION)
|
||||
|
||||
#define NM_IFUPDOWN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFUPDOWN_CONNECTION, NMIfupdownConnectionPrivate))
|
||||
|
||||
|
|
@ -49,14 +50,6 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void
|
||||
service_get_secrets (NMExportedConnection *exported,
|
||||
const gchar *setting_name,
|
||||
const gchar **hints,
|
||||
gboolean request_new,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
|
||||
NMIfupdownConnection*
|
||||
nm_ifupdown_connection_new (if_block *block)
|
||||
{
|
||||
|
|
@ -87,6 +80,33 @@ do_delete (NMExportedConnection *exported, GError **err)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
service_get_secrets (NMExportedConnection *exported,
|
||||
const gchar *setting_name,
|
||||
const gchar **hints,
|
||||
gboolean request_new,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
PLUGIN_PRINT ("SCPlugin-Ifupdown", "get_secrets for setting_name:'%s')", setting_name);
|
||||
|
||||
/* FIXME: Only wifi secrets are supported for now */
|
||||
if (strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)) {
|
||||
g_set_error (&error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL,
|
||||
"%s.%d - security setting name not supported '%s'.",
|
||||
__FILE__, __LINE__, setting_name);
|
||||
PLUGIN_PRINT ("SCPlugin-Ifupdown", "%s", error->message);
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
NM_EXPORTED_CONNECTION_CLASS (nm_ifupdown_connection_parent_class)->service_get_secrets (exported, setting_name, hints, request_new, context);
|
||||
}
|
||||
|
||||
/* GObject */
|
||||
static void
|
||||
nm_ifupdown_connection_init (NMIfupdownConnection *connection)
|
||||
|
|
@ -192,27 +212,3 @@ nm_ifupdown_connection_class_init (NMIfupdownConnectionClass *ifupdown_connectio
|
|||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
service_get_secrets (NMExportedConnection *exported,
|
||||
const gchar *setting_name,
|
||||
const gchar **hints,
|
||||
gboolean request_new,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
PLUGIN_PRINT ("SCPlugin-Ifupdown", "get_secrets for setting_name:'%s')", setting_name);
|
||||
|
||||
/* FIXME: Only wifi secrets are supported for now */
|
||||
if (!strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME))
|
||||
NM_EXPORTED_CONNECTION_CLASS (nm_ifupdown_connection_parent_class)->service_get_secrets (exported, setting_name, hints, request_new, context);
|
||||
else {
|
||||
g_set_error (&error, NM_SETTING_WIRELESS_SECURITY_ERROR, 1,
|
||||
"%s.%d - security setting name not supported '%s'.",
|
||||
__FILE__, __LINE__, setting_name);
|
||||
PLUGIN_PRINT ("SCPlugin-Ifupdown", "%s", error->message);
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue