libnm: rename NMSecretAgent to NMSecretAgentOld
As with NMVpnPluginOld, rename NMSecretAgent to NMSecretAgentOld, to leave the name "NMSecretAgent" open for a new-and-improved version in NM 1.2.
This commit is contained in:
@@ -980,7 +980,7 @@ nmc_secrets_requested (NMSecretAgentSimple *agent,
|
|||||||
/* Unregister our secret agent on failure, so that another agent
|
/* Unregister our secret agent on failure, so that another agent
|
||||||
* may be tried */
|
* may be tried */
|
||||||
if (nmc->secret_agent) {
|
if (nmc->secret_agent) {
|
||||||
nm_secret_agent_unregister (nmc->secret_agent, NULL, NULL);
|
nm_secret_agent_old_unregister (nmc->secret_agent, NULL, NULL);
|
||||||
g_clear_object (&nmc->secret_agent);
|
g_clear_object (&nmc->secret_agent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -542,7 +542,7 @@ nmc_cleanup (NmCli *nmc)
|
|||||||
|
|
||||||
if (nmc->secret_agent) {
|
if (nmc->secret_agent) {
|
||||||
/* Destroy secret agent if we have one. */
|
/* Destroy secret agent if we have one. */
|
||||||
nm_secret_agent_unregister (nmc->secret_agent, NULL, NULL);
|
nm_secret_agent_old_unregister (nmc->secret_agent, NULL, NULL);
|
||||||
g_object_unref (nmc->secret_agent);
|
g_object_unref (nmc->secret_agent);
|
||||||
}
|
}
|
||||||
if (nmc->pwds_hash)
|
if (nmc->pwds_hash)
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <NetworkManager.h>
|
#include <NetworkManager.h>
|
||||||
|
#include <nm-secret-agent-old.h>
|
||||||
|
|
||||||
#if WITH_POLKIT_AGENT
|
#if WITH_POLKIT_AGENT
|
||||||
#include "nm-polkit-listener.h"
|
#include "nm-polkit-listener.h"
|
||||||
@@ -121,7 +122,7 @@ typedef struct _NmCli {
|
|||||||
|
|
||||||
const GPtrArray *connections; /* List of connections */
|
const GPtrArray *connections; /* List of connections */
|
||||||
|
|
||||||
NMSecretAgent *secret_agent; /* Secret agent */
|
NMSecretAgentOld *secret_agent; /* Secret agent */
|
||||||
GHashTable *pwds_hash; /* Hash table with passwords in passwd-file */
|
GHashTable *pwds_hash; /* Hash table with passwords in passwd-file */
|
||||||
NMPolkitListener *pk_listener ; /* polkit agent listener */
|
NMPolkitListener *pk_listener ; /* polkit agent listener */
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "nm-secret-agent-simple.h"
|
#include "nm-secret-agent-simple.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMSecretAgentSimple, nm_secret_agent_simple, NM_TYPE_SECRET_AGENT)
|
G_DEFINE_TYPE (NMSecretAgentSimple, nm_secret_agent_simple, NM_TYPE_SECRET_AGENT_OLD)
|
||||||
|
|
||||||
#define NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimplePrivate))
|
#define NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimplePrivate))
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ typedef struct {
|
|||||||
gchar *request_id;
|
gchar *request_id;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
gchar **hints;
|
gchar **hints;
|
||||||
NMSecretAgentGetSecretsFunc callback;
|
NMSecretAgentOldGetSecretsFunc callback;
|
||||||
gpointer callback_data;
|
gpointer callback_data;
|
||||||
} NMSecretAgentSimpleRequest;
|
} NMSecretAgentSimpleRequest;
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ nm_secret_agent_simple_finalize (GObject *object)
|
|||||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||||
NMSecretAgentSimpleRequest *request = value;
|
NMSecretAgentSimpleRequest *request = value;
|
||||||
|
|
||||||
request->callback (NM_SECRET_AGENT (object),
|
request->callback (NM_SECRET_AGENT_OLD (object),
|
||||||
request->connection,
|
request->connection,
|
||||||
NULL, error,
|
NULL, error,
|
||||||
request->callback_data);
|
request->callback_data);
|
||||||
@@ -423,14 +423,14 @@ request_secrets_from_ui (NMSecretAgentSimpleRequest *request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_simple_get_secrets (NMSecretAgent *agent,
|
nm_secret_agent_simple_get_secrets (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
const gchar *setting_name,
|
const gchar *setting_name,
|
||||||
const gchar **hints,
|
const gchar **hints,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
NMSecretAgentOldGetSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentSimple *self = NM_SECRET_AGENT_SIMPLE (agent);
|
NMSecretAgentSimple *self = NM_SECRET_AGENT_SIMPLE (agent);
|
||||||
NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (self);
|
NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (self);
|
||||||
@@ -546,37 +546,37 @@ nm_secret_agent_simple_response (NMSecretAgentSimple *self,
|
|||||||
"User cancelled");
|
"User cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
request->callback (NM_SECRET_AGENT (self), request->connection, dict, error, request->callback_data);
|
request->callback (NM_SECRET_AGENT_OLD (self), request->connection, dict, error, request->callback_data);
|
||||||
|
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
g_hash_table_remove (priv->requests, request_id);
|
g_hash_table_remove (priv->requests, request_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_simple_cancel_get_secrets (NMSecretAgent *agent,
|
nm_secret_agent_simple_cancel_get_secrets (NMSecretAgentOld *agent,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
const gchar *setting_name)
|
const gchar *setting_name)
|
||||||
{
|
{
|
||||||
/* We don't support cancellation. Sorry! */
|
/* We don't support cancellation. Sorry! */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_simple_save_secrets (NMSecretAgent *agent,
|
nm_secret_agent_simple_save_secrets (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
NMSecretAgentOldSaveSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
/* We don't support secret storage */
|
/* We don't support secret storage */
|
||||||
callback (agent, connection, NULL, callback_data);
|
callback (agent, connection, NULL, callback_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_simple_delete_secrets (NMSecretAgent *agent,
|
nm_secret_agent_simple_delete_secrets (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
NMSecretAgentOldDeleteSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
/* We don't support secret storage, so there's nothing to delete. */
|
/* We don't support secret storage, so there's nothing to delete. */
|
||||||
callback (agent, connection, NULL, callback_data);
|
callback (agent, connection, NULL, callback_data);
|
||||||
@@ -620,7 +620,7 @@ nm_secret_agent_simple_enable (NMSecretAgentSimple *self, const char *path)
|
|||||||
error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED,
|
error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED,
|
||||||
"Request for %s secrets doesn't match path %s",
|
"Request for %s secrets doesn't match path %s",
|
||||||
request->request_id, priv->path);
|
request->request_id, priv->path);
|
||||||
request->callback (NM_SECRET_AGENT (self), request->connection, NULL, error, request->callback_data);
|
request->callback (NM_SECRET_AGENT_OLD (self), request->connection, NULL, error, request->callback_data);
|
||||||
g_hash_table_remove (priv->requests, request->request_id);
|
g_hash_table_remove (priv->requests, request->request_id);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
@@ -632,7 +632,7 @@ void
|
|||||||
nm_secret_agent_simple_class_init (NMSecretAgentSimpleClass *klass)
|
nm_secret_agent_simple_class_init (NMSecretAgentSimpleClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
NMSecretAgentClass *agent_class = NM_SECRET_AGENT_CLASS (klass);
|
NMSecretAgentOldClass *agent_class = NM_SECRET_AGENT_OLD_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (NMSecretAgentSimplePrivate));
|
g_type_class_add_private (klass, sizeof (NMSecretAgentSimplePrivate));
|
||||||
|
|
||||||
@@ -686,10 +686,10 @@ nm_secret_agent_simple_class_init (NMSecretAgentSimpleClass *klass)
|
|||||||
* Returns: a new #NMSecretAgentSimple if the agent creation is successful
|
* Returns: a new #NMSecretAgentSimple if the agent creation is successful
|
||||||
* or %NULL in case of a failure.
|
* or %NULL in case of a failure.
|
||||||
*/
|
*/
|
||||||
NMSecretAgent *
|
NMSecretAgentOld *
|
||||||
nm_secret_agent_simple_new (const char *name)
|
nm_secret_agent_simple_new (const char *name)
|
||||||
{
|
{
|
||||||
return g_initable_new (NM_TYPE_SECRET_AGENT_SIMPLE, NULL, NULL,
|
return g_initable_new (NM_TYPE_SECRET_AGENT_SIMPLE, NULL, NULL,
|
||||||
NM_SECRET_AGENT_IDENTIFIER, name,
|
NM_SECRET_AGENT_OLD_IDENTIFIER, name,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#define __NM_SECRET_AGENT_SIMPLE_H__
|
#define __NM_SECRET_AGENT_SIMPLE_H__
|
||||||
|
|
||||||
#include <NetworkManager.h>
|
#include <NetworkManager.h>
|
||||||
|
#include <nm-secret-agent-old.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@@ -31,12 +32,12 @@ G_BEGIN_DECLS
|
|||||||
#define NM_SECRET_AGENT_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass))
|
#define NM_SECRET_AGENT_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMSecretAgent parent;
|
NMSecretAgentOld parent;
|
||||||
|
|
||||||
} NMSecretAgentSimple;
|
} NMSecretAgentSimple;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMSecretAgentClass parent;
|
NMSecretAgentOldClass parent;
|
||||||
|
|
||||||
} NMSecretAgentSimpleClass;
|
} NMSecretAgentSimpleClass;
|
||||||
|
|
||||||
@@ -47,14 +48,14 @@ typedef struct {
|
|||||||
|
|
||||||
GType nm_secret_agent_simple_get_type (void);
|
GType nm_secret_agent_simple_get_type (void);
|
||||||
|
|
||||||
NMSecretAgent *nm_secret_agent_simple_new (const char *name);
|
NMSecretAgentOld *nm_secret_agent_simple_new (const char *name);
|
||||||
|
|
||||||
void nm_secret_agent_simple_response (NMSecretAgentSimple *self,
|
void nm_secret_agent_simple_response (NMSecretAgentSimple *self,
|
||||||
const char *request_id,
|
const char *request_id,
|
||||||
GPtrArray *secrets);
|
GPtrArray *secrets);
|
||||||
|
|
||||||
void nm_secret_agent_simple_enable (NMSecretAgentSimple *self,
|
void nm_secret_agent_simple_enable (NMSecretAgentSimple *self,
|
||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -132,7 +132,7 @@ activate_connection (NMConnection *connection,
|
|||||||
NMObject *specific_object)
|
NMObject *specific_object)
|
||||||
{
|
{
|
||||||
NmtNewtForm *form;
|
NmtNewtForm *form;
|
||||||
NMSecretAgent *agent;
|
NMSecretAgentOld *agent;
|
||||||
NmtNewtWidget *label;
|
NmtNewtWidget *label;
|
||||||
NmtSyncOp op;
|
NmtSyncOp op;
|
||||||
const char *specific_object_path;
|
const char *specific_object_path;
|
||||||
@@ -220,7 +220,7 @@ activate_connection (NMConnection *connection,
|
|||||||
nmt_newt_form_quit (form);
|
nmt_newt_form_quit (form);
|
||||||
g_object_unref (form);
|
g_object_unref (form);
|
||||||
|
|
||||||
nm_secret_agent_unregister (agent, NULL, NULL);
|
nm_secret_agent_old_unregister (agent, NULL, NULL);
|
||||||
g_object_unref (agent);
|
g_object_unref (agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@
|
|||||||
<chapter>
|
<chapter>
|
||||||
<title>Client Object API Reference</title>
|
<title>Client Object API Reference</title>
|
||||||
<xi:include href="xml/nm-client.xml"/>
|
<xi:include href="xml/nm-client.xml"/>
|
||||||
<xi:include href="xml/nm-secret-agent.xml"/>
|
<xi:include href="xml/nm-secret-agent-old.xml"/>
|
||||||
<xi:include href="xml/nm-object.xml"/>
|
<xi:include href="xml/nm-object.xml"/>
|
||||||
<xi:include href="xml/nm-errors.xml"/>
|
<xi:include href="xml/nm-errors.xml"/>
|
||||||
<xi:include href="xml/nm-dbus-interface.xml"/>
|
<xi:include href="xml/nm-dbus-interface.xml"/>
|
||||||
|
@@ -48,13 +48,13 @@ libnminclude_hfiles = \
|
|||||||
nm-ip-config.h \
|
nm-ip-config.h \
|
||||||
nm-object.h \
|
nm-object.h \
|
||||||
nm-remote-connection.h \
|
nm-remote-connection.h \
|
||||||
nm-secret-agent.h \
|
|
||||||
nm-types.h \
|
nm-types.h \
|
||||||
nm-vpn-connection.h \
|
nm-vpn-connection.h \
|
||||||
nm-vpn-editor-plugin.h \
|
nm-vpn-editor-plugin.h \
|
||||||
nm-wimax-nsp.h
|
nm-wimax-nsp.h
|
||||||
|
|
||||||
libnminclude_nointrospect_hfiles = \
|
libnminclude_nointrospect_hfiles = \
|
||||||
|
nm-secret-agent-old.h \
|
||||||
nm-vpn-plugin-old.h
|
nm-vpn-plugin-old.h
|
||||||
|
|
||||||
libnminclude_HEADERS = \
|
libnminclude_HEADERS = \
|
||||||
@@ -105,7 +105,7 @@ libnm_la_csources = \
|
|||||||
nm-object.c \
|
nm-object.c \
|
||||||
nm-remote-connection.c \
|
nm-remote-connection.c \
|
||||||
nm-remote-settings.c \
|
nm-remote-settings.c \
|
||||||
nm-secret-agent.c \
|
nm-secret-agent-old.c \
|
||||||
nm-vpn-connection.c \
|
nm-vpn-connection.c \
|
||||||
nm-vpn-plugin-old.c \
|
nm-vpn-plugin-old.c \
|
||||||
nm-vpn-editor-plugin.c \
|
nm-vpn-editor-plugin.c \
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
#include <nm-ip-config.h>
|
#include <nm-ip-config.h>
|
||||||
#include <nm-object.h>
|
#include <nm-object.h>
|
||||||
#include <nm-remote-connection.h>
|
#include <nm-remote-connection.h>
|
||||||
#include <nm-secret-agent.h>
|
|
||||||
#include <nm-setting-8021x.h>
|
#include <nm-setting-8021x.h>
|
||||||
#include <nm-setting-adsl.h>
|
#include <nm-setting-adsl.h>
|
||||||
#include <nm-setting-bluetooth.h>
|
#include <nm-setting-bluetooth.h>
|
||||||
|
@@ -333,20 +333,20 @@ global:
|
|||||||
nm_remote_connection_save_async;
|
nm_remote_connection_save_async;
|
||||||
nm_remote_connection_save_finish;
|
nm_remote_connection_save_finish;
|
||||||
nm_secret_agent_capabilities_get_type;
|
nm_secret_agent_capabilities_get_type;
|
||||||
nm_secret_agent_delete_secrets;
|
|
||||||
nm_secret_agent_error_get_type;
|
nm_secret_agent_error_get_type;
|
||||||
nm_secret_agent_error_quark;
|
nm_secret_agent_error_quark;
|
||||||
nm_secret_agent_get_registered;
|
|
||||||
nm_secret_agent_get_secrets;
|
|
||||||
nm_secret_agent_get_secrets_flags_get_type;
|
nm_secret_agent_get_secrets_flags_get_type;
|
||||||
nm_secret_agent_get_type;
|
nm_secret_agent_old_delete_secrets;
|
||||||
nm_secret_agent_register;
|
nm_secret_agent_old_get_registered;
|
||||||
nm_secret_agent_register_async;
|
nm_secret_agent_old_get_secrets;
|
||||||
nm_secret_agent_register_finish;
|
nm_secret_agent_old_get_type;
|
||||||
nm_secret_agent_save_secrets;
|
nm_secret_agent_old_register;
|
||||||
nm_secret_agent_unregister;
|
nm_secret_agent_old_register_async;
|
||||||
nm_secret_agent_unregister_async;
|
nm_secret_agent_old_register_finish;
|
||||||
nm_secret_agent_unregister_finish;
|
nm_secret_agent_old_save_secrets;
|
||||||
|
nm_secret_agent_old_unregister;
|
||||||
|
nm_secret_agent_old_unregister_async;
|
||||||
|
nm_secret_agent_old_unregister_finish;
|
||||||
nm_setting_802_1x_add_altsubject_match;
|
nm_setting_802_1x_add_altsubject_match;
|
||||||
nm_setting_802_1x_add_eap_method;
|
nm_setting_802_1x_add_eap_method;
|
||||||
nm_setting_802_1x_add_phase2_altsubject_match;
|
nm_setting_802_1x_add_phase2_altsubject_match;
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "nm-glib-compat.h"
|
#include "nm-glib-compat.h"
|
||||||
#include "nm-dbus-interface.h"
|
#include "nm-dbus-interface.h"
|
||||||
#include "nm-secret-agent.h"
|
#include "nm-secret-agent-old.h"
|
||||||
#include "nm-enum-types.h"
|
#include "nm-enum-types.h"
|
||||||
#include "nm-dbus-helpers.h"
|
#include "nm-dbus-helpers.h"
|
||||||
#include "nm-simple-connection.h"
|
#include "nm-simple-connection.h"
|
||||||
@@ -32,14 +32,14 @@
|
|||||||
#include "nmdbus-secret-agent.h"
|
#include "nmdbus-secret-agent.h"
|
||||||
#include "nmdbus-agent-manager.h"
|
#include "nmdbus-agent-manager.h"
|
||||||
|
|
||||||
static void nm_secret_agent_initable_iface_init (GInitableIface *iface);
|
static void nm_secret_agent_old_initable_iface_init (GInitableIface *iface);
|
||||||
static void nm_secret_agent_async_initable_iface_init (GAsyncInitableIface *iface);
|
static void nm_secret_agent_old_async_initable_iface_init (GAsyncInitableIface *iface);
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT,
|
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (NMSecretAgentOld, nm_secret_agent_old, G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_secret_agent_initable_iface_init);
|
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_secret_agent_old_initable_iface_init);
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_secret_agent_async_initable_iface_init);
|
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_secret_agent_old_async_initable_iface_init);
|
||||||
)
|
)
|
||||||
|
|
||||||
#define NM_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SECRET_AGENT, NMSecretAgentPrivate))
|
#define NM_SECRET_AGENT_OLD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SECRET_AGENT_OLD, NMSecretAgentOldPrivate))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gboolean registered;
|
gboolean registered;
|
||||||
@@ -58,7 +58,7 @@ typedef struct {
|
|||||||
char *identifier;
|
char *identifier;
|
||||||
gboolean auto_register;
|
gboolean auto_register;
|
||||||
gboolean suppress_auto;
|
gboolean suppress_auto;
|
||||||
} NMSecretAgentPrivate;
|
} NMSecretAgentOldPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@@ -73,15 +73,15 @@ enum {
|
|||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_internal_unregister (NMSecretAgent *self)
|
_internal_unregister (NMSecretAgentOld *self)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (priv->registered) {
|
if (priv->registered) {
|
||||||
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (priv->dbus_secret_agent));
|
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (priv->dbus_secret_agent));
|
||||||
priv->registered = FALSE;
|
priv->registered = FALSE;
|
||||||
priv->registering = FALSE;
|
priv->registering = FALSE;
|
||||||
g_object_notify (G_OBJECT (self), NM_SECRET_AGENT_REGISTERED);
|
g_object_notify (G_OBJECT (self), NM_SECRET_AGENT_OLD_REGISTERED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,9 @@ typedef struct {
|
|||||||
} GetSecretsInfo;
|
} GetSecretsInfo;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_secrets_info_finalize (NMSecretAgent *self, GetSecretsInfo *info)
|
get_secrets_info_finalize (NMSecretAgentOld *self, GetSecretsInfo *info)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
g_return_if_fail (info != NULL);
|
g_return_if_fail (info != NULL);
|
||||||
|
|
||||||
@@ -107,9 +107,9 @@ get_secrets_info_finalize (NMSecretAgent *self, GetSecretsInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
should_auto_register (NMSecretAgent *self)
|
should_auto_register (NMSecretAgentOld *self)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
return ( priv->auto_register
|
return ( priv->auto_register
|
||||||
&& !priv->suppress_auto
|
&& !priv->suppress_auto
|
||||||
@@ -122,22 +122,22 @@ name_owner_changed (GObject *proxy,
|
|||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgent *self = NM_SECRET_AGENT (user_data);
|
NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (user_data);
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
GSList *iter;
|
GSList *iter;
|
||||||
char *owner;
|
char *owner;
|
||||||
|
|
||||||
owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (proxy));
|
owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (proxy));
|
||||||
if (owner != NULL) {
|
if (owner != NULL) {
|
||||||
if (should_auto_register (self))
|
if (should_auto_register (self))
|
||||||
nm_secret_agent_register_async (self, NULL, NULL, NULL);
|
nm_secret_agent_old_register_async (self, NULL, NULL, NULL);
|
||||||
g_free (owner);
|
g_free (owner);
|
||||||
} else {
|
} else {
|
||||||
/* Cancel any pending secrets requests */
|
/* Cancel any pending secrets requests */
|
||||||
for (iter = priv->pending_gets; iter; iter = g_slist_next (iter)) {
|
for (iter = priv->pending_gets; iter; iter = g_slist_next (iter)) {
|
||||||
GetSecretsInfo *info = iter->data;
|
GetSecretsInfo *info = iter->data;
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->cancel_get_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->cancel_get_secrets (self,
|
||||||
info->path,
|
info->path,
|
||||||
info->setting_name);
|
info->setting_name);
|
||||||
}
|
}
|
||||||
@@ -149,11 +149,11 @@ name_owner_changed (GObject *proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
verify_sender (NMSecretAgent *self,
|
verify_sender (NMSecretAgentOld *self,
|
||||||
GDBusMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
char *nm_owner;
|
char *nm_owner;
|
||||||
const char *sender;
|
const char *sender;
|
||||||
guint32 sender_uid;
|
guint32 sender_uid;
|
||||||
@@ -246,7 +246,7 @@ verify_sender (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
verify_request (NMSecretAgent *self,
|
verify_request (NMSecretAgentOld *self,
|
||||||
GDBusMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
GVariant *connection_dict,
|
GVariant *connection_dict,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
@@ -290,7 +290,7 @@ verify_request (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_secrets_cb (NMSecretAgent *self,
|
get_secrets_cb (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GVariant *secrets,
|
GVariant *secrets,
|
||||||
GError *error,
|
GError *error,
|
||||||
@@ -310,16 +310,16 @@ get_secrets_cb (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
impl_secret_agent_get_secrets (NMSecretAgent *self,
|
impl_secret_agent_old_get_secrets (NMSecretAgentOld *self,
|
||||||
GDBusMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
GVariant *connection_dict,
|
GVariant *connection_dict,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char * const *hints,
|
const char * const *hints,
|
||||||
guint flags,
|
guint flags,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
NMConnection *connection = NULL;
|
NMConnection *connection = NULL;
|
||||||
GetSecretsInfo *info;
|
GetSecretsInfo *info;
|
||||||
@@ -336,7 +336,7 @@ impl_secret_agent_get_secrets (NMSecretAgent *self,
|
|||||||
info->context = context;
|
info->context = context;
|
||||||
priv->pending_gets = g_slist_append (priv->pending_gets, info);
|
priv->pending_gets = g_slist_append (priv->pending_gets, info);
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->get_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->get_secrets (self,
|
||||||
connection,
|
connection,
|
||||||
connection_path,
|
connection_path,
|
||||||
setting_name,
|
setting_name,
|
||||||
@@ -363,13 +363,13 @@ find_get_secrets_info (GSList *list, const char *path, const char *setting_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
impl_secret_agent_cancel_get_secrets (NMSecretAgent *self,
|
impl_secret_agent_old_cancel_get_secrets (NMSecretAgentOld *self,
|
||||||
GDBusMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GetSecretsInfo *info;
|
GetSecretsInfo *info;
|
||||||
|
|
||||||
@@ -389,14 +389,14 @@ impl_secret_agent_cancel_get_secrets (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Send the cancel request up to the subclass and finalize it */
|
/* Send the cancel request up to the subclass and finalize it */
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->cancel_get_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->cancel_get_secrets (self,
|
||||||
info->path,
|
info->path,
|
||||||
info->setting_name);
|
info->setting_name);
|
||||||
g_dbus_method_invocation_return_value (context, NULL);
|
g_dbus_method_invocation_return_value (context, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_secrets_cb (NMSecretAgent *self,
|
save_secrets_cb (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@@ -410,11 +410,11 @@ save_secrets_cb (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
impl_secret_agent_save_secrets (NMSecretAgent *self,
|
impl_secret_agent_old_save_secrets (NMSecretAgentOld *self,
|
||||||
GDBusMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
GVariant *connection_dict,
|
GVariant *connection_dict,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
NMConnection *connection = NULL;
|
NMConnection *connection = NULL;
|
||||||
@@ -425,7 +425,7 @@ impl_secret_agent_save_secrets (NMSecretAgent *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->save_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->save_secrets (self,
|
||||||
connection,
|
connection,
|
||||||
connection_path,
|
connection_path,
|
||||||
save_secrets_cb,
|
save_secrets_cb,
|
||||||
@@ -434,7 +434,7 @@ impl_secret_agent_save_secrets (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
delete_secrets_cb (NMSecretAgent *self,
|
delete_secrets_cb (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@@ -448,11 +448,11 @@ delete_secrets_cb (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
impl_secret_agent_delete_secrets (NMSecretAgent *self,
|
impl_secret_agent_old_delete_secrets (NMSecretAgentOld *self,
|
||||||
GDBusMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
GVariant *connection_dict,
|
GVariant *connection_dict,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
NMConnection *connection = NULL;
|
NMConnection *connection = NULL;
|
||||||
@@ -463,7 +463,7 @@ impl_secret_agent_delete_secrets (NMSecretAgent *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->delete_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->delete_secrets (self,
|
||||||
connection,
|
connection,
|
||||||
connection_path,
|
connection_path,
|
||||||
delete_secrets_cb,
|
delete_secrets_cb,
|
||||||
@@ -474,9 +474,9 @@ impl_secret_agent_delete_secrets (NMSecretAgent *self,
|
|||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
check_nm_running (NMSecretAgent *self, GError **error)
|
check_nm_running (NMSecretAgentOld *self, GError **error)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
char *owner;
|
char *owner;
|
||||||
|
|
||||||
if (priv->private_bus)
|
if (priv->private_bus)
|
||||||
@@ -495,12 +495,12 @@ check_nm_running (NMSecretAgent *self, GError **error)
|
|||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_register:
|
* nm_secret_agent_old_register:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @cancellable: a #GCancellable, or %NULL
|
* @cancellable: a #GCancellable, or %NULL
|
||||||
* @error: return location for a #GError, or %NULL
|
* @error: return location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Registers the #NMSecretAgent with the NetworkManager secret manager,
|
* Registers the #NMSecretAgentOld with the NetworkManager secret manager,
|
||||||
* indicating to NetworkManager that the agent is able to provide and save
|
* indicating to NetworkManager that the agent is able to provide and save
|
||||||
* secrets for connections on behalf of its user.
|
* secrets for connections on behalf of its user.
|
||||||
*
|
*
|
||||||
@@ -510,16 +510,16 @@ check_nm_running (NMSecretAgent *self, GError **error)
|
|||||||
* Returns: %TRUE if registration was successful, %FALSE on error.
|
* Returns: %TRUE if registration was successful, %FALSE on error.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_secret_agent_register (NMSecretAgent *self,
|
nm_secret_agent_old_register (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentOldPrivate *priv;
|
||||||
NMSecretAgentClass *class;
|
NMSecretAgentOldClass *class;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_SECRET_AGENT (self), FALSE);
|
g_return_val_if_fail (NM_IS_SECRET_AGENT_OLD (self), FALSE);
|
||||||
|
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
g_return_val_if_fail (priv->registered == FALSE, FALSE);
|
g_return_val_if_fail (priv->registered == FALSE, FALSE);
|
||||||
g_return_val_if_fail (priv->registering == FALSE, FALSE);
|
g_return_val_if_fail (priv->registering == FALSE, FALSE);
|
||||||
@@ -527,7 +527,7 @@ nm_secret_agent_register (NMSecretAgent *self,
|
|||||||
g_return_val_if_fail (priv->manager_proxy != NULL, FALSE);
|
g_return_val_if_fail (priv->manager_proxy != NULL, FALSE);
|
||||||
|
|
||||||
/* Also make sure the subclass can actually respond to secrets requests */
|
/* Also make sure the subclass can actually respond to secrets requests */
|
||||||
class = NM_SECRET_AGENT_GET_CLASS (self);
|
class = NM_SECRET_AGENT_OLD_GET_CLASS (self);
|
||||||
g_return_val_if_fail (class->get_secrets != NULL, FALSE);
|
g_return_val_if_fail (class->get_secrets != NULL, FALSE);
|
||||||
g_return_val_if_fail (class->save_secrets != NULL, FALSE);
|
g_return_val_if_fail (class->save_secrets != NULL, FALSE);
|
||||||
g_return_val_if_fail (class->delete_secrets != NULL, FALSE);
|
g_return_val_if_fail (class->delete_secrets != NULL, FALSE);
|
||||||
@@ -567,14 +567,14 @@ nm_secret_agent_register (NMSecretAgent *self,
|
|||||||
success:
|
success:
|
||||||
priv->registering = FALSE;
|
priv->registering = FALSE;
|
||||||
priv->registered = TRUE;
|
priv->registered = TRUE;
|
||||||
g_object_notify (G_OBJECT (self), NM_SECRET_AGENT_REGISTERED);
|
g_object_notify (G_OBJECT (self), NM_SECRET_AGENT_OLD_REGISTERED);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reg_result (NMSecretAgent *self, GSimpleAsyncResult *simple, GError *error)
|
reg_result (NMSecretAgentOld *self, GSimpleAsyncResult *simple, GError *error)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->registering = FALSE;
|
priv->registering = FALSE;
|
||||||
|
|
||||||
@@ -586,7 +586,7 @@ reg_result (NMSecretAgent *self, GSimpleAsyncResult *simple, GError *error)
|
|||||||
_internal_unregister (self);
|
_internal_unregister (self);
|
||||||
} else {
|
} else {
|
||||||
priv->registered = TRUE;
|
priv->registered = TRUE;
|
||||||
g_object_notify (G_OBJECT (self), NM_SECRET_AGENT_REGISTERED);
|
g_object_notify (G_OBJECT (self), NM_SECRET_AGENT_OLD_REGISTERED);
|
||||||
|
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
||||||
g_simple_async_result_complete (simple);
|
g_simple_async_result_complete (simple);
|
||||||
@@ -601,13 +601,13 @@ reg_request_cb (GObject *proxy,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *simple = user_data;
|
GSimpleAsyncResult *simple = user_data;
|
||||||
NMSecretAgent *self;
|
NMSecretAgentOld *self;
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentOldPrivate *priv;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
self = NM_SECRET_AGENT (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
self = NM_SECRET_AGENT_OLD (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
||||||
g_object_unref (self); /* drop extra ref added by get_source_object() */
|
g_object_unref (self); /* drop extra ref added by get_source_object() */
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (!nmdbus_agent_manager_call_register_finish (NMDBUS_AGENT_MANAGER (proxy), result, &error))
|
if (!nmdbus_agent_manager_call_register_finish (NMDBUS_AGENT_MANAGER (proxy), result, &error))
|
||||||
g_dbus_error_strip_remote_error (error);
|
g_dbus_error_strip_remote_error (error);
|
||||||
@@ -621,12 +621,12 @@ reg_with_caps_cb (GObject *proxy,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *simple = user_data;
|
GSimpleAsyncResult *simple = user_data;
|
||||||
NMSecretAgent *self;
|
NMSecretAgentOld *self;
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentOldPrivate *priv;
|
||||||
|
|
||||||
self = NM_SECRET_AGENT (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
self = NM_SECRET_AGENT_OLD (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
||||||
g_object_unref (self); /* drop extra ref added by get_source_object() */
|
g_object_unref (self); /* drop extra ref added by get_source_object() */
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (nmdbus_agent_manager_call_register_with_capabilities_finish (NMDBUS_AGENT_MANAGER (proxy), result, NULL)) {
|
if (nmdbus_agent_manager_call_register_with_capabilities_finish (NMDBUS_AGENT_MANAGER (proxy), result, NULL)) {
|
||||||
reg_result (self, simple, NULL);
|
reg_result (self, simple, NULL);
|
||||||
@@ -642,13 +642,13 @@ reg_with_caps_cb (GObject *proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_register_async:
|
* nm_secret_agent_old_register_async:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @cancellable: a #GCancellable, or %NULL
|
* @cancellable: a #GCancellable, or %NULL
|
||||||
* @callback: callback to call when the agent is registered
|
* @callback: callback to call when the agent is registered
|
||||||
* @user_data: data for @callback
|
* @user_data: data for @callback
|
||||||
*
|
*
|
||||||
* Asynchronously registers the #NMSecretAgent with the NetworkManager secret
|
* Asynchronously registers the #NMSecretAgentOld with the NetworkManager secret
|
||||||
* manager, indicating to NetworkManager that the agent is able to provide and
|
* manager, indicating to NetworkManager that the agent is able to provide and
|
||||||
* save secrets for connections on behalf of its user.
|
* save secrets for connections on behalf of its user.
|
||||||
*
|
*
|
||||||
@@ -656,19 +656,19 @@ reg_with_caps_cb (GObject *proxy,
|
|||||||
* registered, or in the process of registering.
|
* registered, or in the process of registering.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
nm_secret_agent_register_async (NMSecretAgent *self,
|
nm_secret_agent_old_register_async (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentOldPrivate *priv;
|
||||||
NMSecretAgentClass *class;
|
NMSecretAgentOldClass *class;
|
||||||
GSimpleAsyncResult *simple;
|
GSimpleAsyncResult *simple;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
g_return_if_fail (NM_IS_SECRET_AGENT_OLD (self));
|
||||||
|
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
g_return_if_fail (priv->registered == FALSE);
|
g_return_if_fail (priv->registered == FALSE);
|
||||||
g_return_if_fail (priv->registering == FALSE);
|
g_return_if_fail (priv->registering == FALSE);
|
||||||
@@ -676,13 +676,13 @@ nm_secret_agent_register_async (NMSecretAgent *self,
|
|||||||
g_return_if_fail (priv->manager_proxy != NULL);
|
g_return_if_fail (priv->manager_proxy != NULL);
|
||||||
|
|
||||||
/* Also make sure the subclass can actually respond to secrets requests */
|
/* Also make sure the subclass can actually respond to secrets requests */
|
||||||
class = NM_SECRET_AGENT_GET_CLASS (self);
|
class = NM_SECRET_AGENT_OLD_GET_CLASS (self);
|
||||||
g_return_if_fail (class->get_secrets != NULL);
|
g_return_if_fail (class->get_secrets != NULL);
|
||||||
g_return_if_fail (class->save_secrets != NULL);
|
g_return_if_fail (class->save_secrets != NULL);
|
||||||
g_return_if_fail (class->delete_secrets != NULL);
|
g_return_if_fail (class->delete_secrets != NULL);
|
||||||
|
|
||||||
simple = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
|
simple = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
|
||||||
nm_secret_agent_register_async);
|
nm_secret_agent_old_register_async);
|
||||||
|
|
||||||
if (!check_nm_running (self, &error)) {
|
if (!check_nm_running (self, &error)) {
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_simple_async_result_take_error (simple, error);
|
||||||
@@ -713,21 +713,21 @@ nm_secret_agent_register_async (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_register_finish:
|
* nm_secret_agent_old_register_finish:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @result: the result passed to the #GAsyncReadyCallback
|
* @result: the result passed to the #GAsyncReadyCallback
|
||||||
* @error: return location for a #GError, or %NULL
|
* @error: return location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Gets the result of a call to nm_secret_agent_register_async().
|
* Gets the result of a call to nm_secret_agent_old_register_async().
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if registration was successful, %FALSE on error.
|
* Returns: %TRUE if registration was successful, %FALSE on error.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_secret_agent_register_finish (NMSecretAgent *self,
|
nm_secret_agent_old_register_finish (NMSecretAgentOld *self,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), nm_secret_agent_register_async), FALSE);
|
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), nm_secret_agent_old_register_async), FALSE);
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -736,12 +736,12 @@ nm_secret_agent_register_finish (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_unregister:
|
* nm_secret_agent_old_unregister:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @cancellable: a #GCancellable, or %NULL
|
* @cancellable: a #GCancellable, or %NULL
|
||||||
* @error: return location for a #GError, or %NULL
|
* @error: return location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Unregisters the #NMSecretAgent with the NetworkManager secret manager,
|
* Unregisters the #NMSecretAgentOld with the NetworkManager secret manager,
|
||||||
* indicating to NetworkManager that the agent will no longer provide or
|
* indicating to NetworkManager that the agent will no longer provide or
|
||||||
* store secrets on behalf of this user.
|
* store secrets on behalf of this user.
|
||||||
*
|
*
|
||||||
@@ -751,16 +751,16 @@ nm_secret_agent_register_finish (NMSecretAgent *self,
|
|||||||
* Returns: %TRUE if unregistration was successful, %FALSE on error
|
* Returns: %TRUE if unregistration was successful, %FALSE on error
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_secret_agent_unregister (NMSecretAgent *self,
|
nm_secret_agent_old_unregister (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentOldPrivate *priv;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_SECRET_AGENT (self), FALSE);
|
g_return_val_if_fail (NM_IS_SECRET_AGENT_OLD (self), FALSE);
|
||||||
|
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
g_return_val_if_fail (priv->registered == TRUE, FALSE);
|
g_return_val_if_fail (priv->registered == TRUE, FALSE);
|
||||||
g_return_val_if_fail (priv->bus != NULL, FALSE);
|
g_return_val_if_fail (priv->bus != NULL, FALSE);
|
||||||
@@ -780,10 +780,10 @@ static void
|
|||||||
unregister_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
|
unregister_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *simple = user_data;
|
GSimpleAsyncResult *simple = user_data;
|
||||||
NMSecretAgent *self;
|
NMSecretAgentOld *self;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
self = NM_SECRET_AGENT (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
self = NM_SECRET_AGENT_OLD (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
||||||
g_object_unref (self); /* drop extra ref added by get_source_object() */
|
g_object_unref (self); /* drop extra ref added by get_source_object() */
|
||||||
|
|
||||||
_internal_unregister (self);
|
_internal_unregister (self);
|
||||||
@@ -801,13 +801,13 @@ unregister_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_unregister_async:
|
* nm_secret_agent_old_unregister_async:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @cancellable: a #GCancellable, or %NULL
|
* @cancellable: a #GCancellable, or %NULL
|
||||||
* @callback: callback to call when the agent is unregistered
|
* @callback: callback to call when the agent is unregistered
|
||||||
* @user_data: data for @callback
|
* @user_data: data for @callback
|
||||||
*
|
*
|
||||||
* Asynchronously unregisters the #NMSecretAgent with the NetworkManager secret
|
* Asynchronously unregisters the #NMSecretAgentOld with the NetworkManager secret
|
||||||
* manager, indicating to NetworkManager that the agent will no longer provide
|
* manager, indicating to NetworkManager that the agent will no longer provide
|
||||||
* or store secrets on behalf of this user.
|
* or store secrets on behalf of this user.
|
||||||
*
|
*
|
||||||
@@ -815,25 +815,25 @@ unregister_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
|
|||||||
* registered.
|
* registered.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
nm_secret_agent_unregister_async (NMSecretAgent *self,
|
nm_secret_agent_old_unregister_async (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentOldPrivate *priv;
|
||||||
GSimpleAsyncResult *simple;
|
GSimpleAsyncResult *simple;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
g_return_if_fail (NM_IS_SECRET_AGENT_OLD (self));
|
||||||
|
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
g_return_if_fail (priv->registered == TRUE);
|
g_return_if_fail (priv->registered == TRUE);
|
||||||
g_return_if_fail (priv->bus != NULL);
|
g_return_if_fail (priv->bus != NULL);
|
||||||
g_return_if_fail (priv->manager_proxy != NULL);
|
g_return_if_fail (priv->manager_proxy != NULL);
|
||||||
|
|
||||||
simple = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
|
simple = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
|
||||||
nm_secret_agent_unregister_async);
|
nm_secret_agent_old_unregister_async);
|
||||||
|
|
||||||
if (!check_nm_running (self, &error)) {
|
if (!check_nm_running (self, &error)) {
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_simple_async_result_take_error (simple, error);
|
||||||
@@ -849,21 +849,21 @@ nm_secret_agent_unregister_async (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_unregister_finish:
|
* nm_secret_agent_old_unregister_finish:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @result: the result passed to the #GAsyncReadyCallback
|
* @result: the result passed to the #GAsyncReadyCallback
|
||||||
* @error: return location for a #GError, or %NULL
|
* @error: return location for a #GError, or %NULL
|
||||||
*
|
*
|
||||||
* Gets the result of a call to nm_secret_agent_unregister_async().
|
* Gets the result of a call to nm_secret_agent_old_unregister_async().
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if unregistration was successful, %FALSE on error.
|
* Returns: %TRUE if unregistration was successful, %FALSE on error.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_secret_agent_unregister_finish (NMSecretAgent *self,
|
nm_secret_agent_old_unregister_finish (NMSecretAgentOld *self,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), nm_secret_agent_unregister_async), FALSE);
|
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self), nm_secret_agent_old_unregister_async), FALSE);
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -872,24 +872,24 @@ nm_secret_agent_unregister_finish (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_get_registered:
|
* nm_secret_agent_old_get_registered:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
*
|
*
|
||||||
* Returns: a %TRUE if the agent is registered, %FALSE if it is not.
|
* Returns: a %TRUE if the agent is registered, %FALSE if it is not.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_secret_agent_get_registered (NMSecretAgent *self)
|
nm_secret_agent_old_get_registered (NMSecretAgentOld *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_SECRET_AGENT (self), FALSE);
|
g_return_val_if_fail (NM_IS_SECRET_AGENT_OLD (self), FALSE);
|
||||||
|
|
||||||
return NM_SECRET_AGENT_GET_PRIVATE (self)->registered;
|
return NM_SECRET_AGENT_OLD_GET_PRIVATE (self)->registered;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_get_secrets:
|
* nm_secret_agent_old_get_secrets:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @connection: the #NMConnection for which we're asked secrets
|
* @connection: the #NMConnection for which we're asked secrets
|
||||||
* @setting_name: the name of the secret setting
|
* @setting_name: the name of the secret setting
|
||||||
* @hints: (array zero-terminated=1): hints to the agent
|
* @hints: (array zero-terminated=1): hints to the agent
|
||||||
@@ -906,15 +906,15 @@ nm_secret_agent_get_registered (NMSecretAgent *self)
|
|||||||
* Virtual: get_secrets
|
* Virtual: get_secrets
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nm_secret_agent_get_secrets (NMSecretAgent *self,
|
nm_secret_agent_old_get_secrets (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char **hints,
|
const char **hints,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
NMSecretAgentOldGetSecretsFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
g_return_if_fail (NM_IS_SECRET_AGENT_OLD (self));
|
||||||
g_return_if_fail (NM_IS_CONNECTION (connection));
|
g_return_if_fail (NM_IS_CONNECTION (connection));
|
||||||
g_return_if_fail (nm_connection_get_path (connection));
|
g_return_if_fail (nm_connection_get_path (connection));
|
||||||
g_return_if_fail (setting_name != NULL);
|
g_return_if_fail (setting_name != NULL);
|
||||||
@@ -922,7 +922,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||||||
g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM));
|
g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM));
|
||||||
g_return_if_fail (callback != NULL);
|
g_return_if_fail (callback != NULL);
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->get_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->get_secrets (self,
|
||||||
connection,
|
connection,
|
||||||
nm_connection_get_path (connection),
|
nm_connection_get_path (connection),
|
||||||
setting_name,
|
setting_name,
|
||||||
@@ -933,8 +933,8 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_save_secrets:
|
* nm_secret_agent_old_save_secrets:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @connection: a #NMConnection
|
* @connection: a #NMConnection
|
||||||
* @callback: (scope async): a callback, to be invoked when the operation is done
|
* @callback: (scope async): a callback, to be invoked when the operation is done
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||||
@@ -945,16 +945,16 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||||||
* Virtual: save_secrets
|
* Virtual: save_secrets
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nm_secret_agent_save_secrets (NMSecretAgent *self,
|
nm_secret_agent_old_save_secrets (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
NMSecretAgentOldSaveSecretsFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
g_return_if_fail (NM_IS_SECRET_AGENT_OLD (self));
|
||||||
g_return_if_fail (NM_IS_CONNECTION (connection));
|
g_return_if_fail (NM_IS_CONNECTION (connection));
|
||||||
g_return_if_fail (nm_connection_get_path (connection));
|
g_return_if_fail (nm_connection_get_path (connection));
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->save_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->save_secrets (self,
|
||||||
connection,
|
connection,
|
||||||
nm_connection_get_path (connection),
|
nm_connection_get_path (connection),
|
||||||
callback,
|
callback,
|
||||||
@@ -962,8 +962,8 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_secret_agent_delete_secrets:
|
* nm_secret_agent_old_delete_secrets:
|
||||||
* @self: a #NMSecretAgent
|
* @self: a #NMSecretAgentOld
|
||||||
* @connection: a #NMConnection
|
* @connection: a #NMConnection
|
||||||
* @callback: (scope async): a callback, to be invoked when the operation is done
|
* @callback: (scope async): a callback, to be invoked when the operation is done
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
* @user_data: (closure): caller-specific data to be passed to @callback
|
||||||
@@ -974,16 +974,16 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
|
|||||||
* Virtual: delete_secrets
|
* Virtual: delete_secrets
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
nm_secret_agent_old_delete_secrets (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
NMSecretAgentOldDeleteSecretsFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (NM_IS_SECRET_AGENT (self));
|
g_return_if_fail (NM_IS_SECRET_AGENT_OLD (self));
|
||||||
g_return_if_fail (NM_IS_CONNECTION (connection));
|
g_return_if_fail (NM_IS_CONNECTION (connection));
|
||||||
g_return_if_fail (nm_connection_get_path (connection));
|
g_return_if_fail (nm_connection_get_path (connection));
|
||||||
|
|
||||||
NM_SECRET_AGENT_GET_CLASS (self)->delete_secrets (self,
|
NM_SECRET_AGENT_OLD_GET_CLASS (self)->delete_secrets (self,
|
||||||
connection,
|
connection,
|
||||||
nm_connection_get_path (connection),
|
nm_connection_get_path (connection),
|
||||||
callback,
|
callback,
|
||||||
@@ -1019,24 +1019,24 @@ validate_identifier (const char *identifier)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_init (NMSecretAgent *self)
|
nm_secret_agent_old_init (NMSecretAgentOld *self)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->dbus_secret_agent = nmdbus_secret_agent_skeleton_new ();
|
priv->dbus_secret_agent = nmdbus_secret_agent_skeleton_new ();
|
||||||
_nm_dbus_bind_properties (self, priv->dbus_secret_agent);
|
_nm_dbus_bind_properties (self, priv->dbus_secret_agent);
|
||||||
_nm_dbus_bind_methods (self, priv->dbus_secret_agent,
|
_nm_dbus_bind_methods (self, priv->dbus_secret_agent,
|
||||||
"GetSecrets", impl_secret_agent_get_secrets,
|
"GetSecrets", impl_secret_agent_old_get_secrets,
|
||||||
"CancelGetSecrets", impl_secret_agent_cancel_get_secrets,
|
"CancelGetSecrets", impl_secret_agent_old_cancel_get_secrets,
|
||||||
"DeleteSecrets", impl_secret_agent_delete_secrets,
|
"DeleteSecrets", impl_secret_agent_old_delete_secrets,
|
||||||
"SaveSecrets", impl_secret_agent_save_secrets,
|
"SaveSecrets", impl_secret_agent_old_save_secrets,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_common (NMSecretAgent *self)
|
init_common (NMSecretAgentOld *self)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->private_bus = _nm_dbus_is_connection_private (priv->bus);
|
priv->private_bus = _nm_dbus_is_connection_private (priv->bus);
|
||||||
|
|
||||||
@@ -1051,8 +1051,8 @@ init_common (NMSecretAgent *self)
|
|||||||
static gboolean
|
static gboolean
|
||||||
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
NMSecretAgent *self = NM_SECRET_AGENT (initable);
|
NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (initable);
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
|
|
||||||
priv->bus = _nm_dbus_new_connection (cancellable, error);
|
priv->bus = _nm_dbus_new_connection (cancellable, error);
|
||||||
@@ -1070,19 +1070,19 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||||||
init_common (self);
|
init_common (self);
|
||||||
|
|
||||||
if (priv->auto_register)
|
if (priv->auto_register)
|
||||||
return nm_secret_agent_register (self, cancellable, error);
|
return nm_secret_agent_old_register (self, cancellable, error);
|
||||||
else
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMSecretAgent *self;
|
NMSecretAgentOld *self;
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
GSimpleAsyncResult *simple;
|
GSimpleAsyncResult *simple;
|
||||||
} NMSecretAgentInitData;
|
} NMSecretAgentOldInitData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_async_complete (NMSecretAgentInitData *init_data, GError *error)
|
init_async_complete (NMSecretAgentOldInitData *init_data, GError *error)
|
||||||
{
|
{
|
||||||
if (!error)
|
if (!error)
|
||||||
g_simple_async_result_set_op_res_gboolean (init_data->simple, TRUE);
|
g_simple_async_result_set_op_res_gboolean (init_data->simple, TRUE);
|
||||||
@@ -1093,25 +1093,25 @@ init_async_complete (NMSecretAgentInitData *init_data, GError *error)
|
|||||||
|
|
||||||
g_object_unref (init_data->simple);
|
g_object_unref (init_data->simple);
|
||||||
g_clear_object (&init_data->cancellable);
|
g_clear_object (&init_data->cancellable);
|
||||||
g_slice_free (NMSecretAgentInitData, init_data);
|
g_slice_free (NMSecretAgentOldInitData, init_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_async_registered (GObject *object, GAsyncResult *result, gpointer user_data)
|
init_async_registered (GObject *object, GAsyncResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgent *self = NM_SECRET_AGENT (object);
|
NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (object);
|
||||||
NMSecretAgentInitData *init_data = user_data;
|
NMSecretAgentOldInitData *init_data = user_data;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
nm_secret_agent_register_finish (self, result, &error);
|
nm_secret_agent_old_register_finish (self, result, &error);
|
||||||
init_async_complete (init_data, error);
|
init_async_complete (init_data, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data)
|
init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentInitData *init_data = user_data;
|
NMSecretAgentOldInitData *init_data = user_data;
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (init_data->self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self);
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
@@ -1125,7 +1125,7 @@ init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||||||
init_common (init_data->self);
|
init_common (init_data->self);
|
||||||
|
|
||||||
if (priv->auto_register) {
|
if (priv->auto_register) {
|
||||||
nm_secret_agent_register_async (init_data->self, init_data->cancellable,
|
nm_secret_agent_old_register_async (init_data->self, init_data->cancellable,
|
||||||
init_async_registered, init_data);
|
init_async_registered, init_data);
|
||||||
} else
|
} else
|
||||||
init_async_complete (init_data, NULL);
|
init_async_complete (init_data, NULL);
|
||||||
@@ -1134,8 +1134,8 @@ init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||||||
static void
|
static void
|
||||||
init_async_got_bus (GObject *initable, GAsyncResult *result, gpointer user_data)
|
init_async_got_bus (GObject *initable, GAsyncResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentInitData *init_data = user_data;
|
NMSecretAgentOldInitData *init_data = user_data;
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (init_data->self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
priv->bus = _nm_dbus_new_connection_finish (result, &error);
|
priv->bus = _nm_dbus_new_connection_finish (result, &error);
|
||||||
@@ -1156,10 +1156,10 @@ init_async (GAsyncInitable *initable, int io_priority,
|
|||||||
GCancellable *cancellable, GAsyncReadyCallback callback,
|
GCancellable *cancellable, GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSecretAgent *self = NM_SECRET_AGENT (initable);
|
NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (initable);
|
||||||
NMSecretAgentInitData *init_data;
|
NMSecretAgentOldInitData *init_data;
|
||||||
|
|
||||||
init_data = g_slice_new (NMSecretAgentInitData);
|
init_data = g_slice_new (NMSecretAgentOldInitData);
|
||||||
init_data->self = self;
|
init_data->self = self;
|
||||||
init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||||
|
|
||||||
@@ -1186,7 +1186,7 @@ get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_IDENTIFIER:
|
case PROP_IDENTIFIER:
|
||||||
@@ -1213,7 +1213,7 @@ set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (object);
|
||||||
const char *identifier;
|
const char *identifier;
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
@@ -1240,11 +1240,11 @@ set_property (GObject *object,
|
|||||||
static void
|
static void
|
||||||
dispose (GObject *object)
|
dispose (GObject *object)
|
||||||
{
|
{
|
||||||
NMSecretAgent *self = NM_SECRET_AGENT (object);
|
NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (object);
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (priv->registered)
|
if (priv->registered)
|
||||||
nm_secret_agent_unregister_async (self, NULL, NULL, NULL);
|
nm_secret_agent_old_unregister_async (self, NULL, NULL, NULL);
|
||||||
|
|
||||||
g_clear_pointer (&priv->identifier, g_free);
|
g_clear_pointer (&priv->identifier, g_free);
|
||||||
|
|
||||||
@@ -1258,15 +1258,15 @@ dispose (GObject *object)
|
|||||||
g_clear_object (&priv->manager_proxy);
|
g_clear_object (&priv->manager_proxy);
|
||||||
g_clear_object (&priv->bus);
|
g_clear_object (&priv->bus);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_secret_agent_old_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_class_init (NMSecretAgentClass *class)
|
nm_secret_agent_old_class_init (NMSecretAgentOldClass *class)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
|
||||||
g_type_class_add_private (class, sizeof (NMSecretAgentPrivate));
|
g_type_class_add_private (class, sizeof (NMSecretAgentOldPrivate));
|
||||||
|
|
||||||
/* Virtual methods */
|
/* Virtual methods */
|
||||||
object_class->dispose = dispose;
|
object_class->dispose = dispose;
|
||||||
@@ -1274,7 +1274,7 @@ nm_secret_agent_class_init (NMSecretAgentClass *class)
|
|||||||
object_class->set_property = set_property;
|
object_class->set_property = set_property;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgent:identifier:
|
* NMSecretAgentOld:identifier:
|
||||||
*
|
*
|
||||||
* Identifies this agent; only one agent in each user session may use the
|
* Identifies this agent; only one agent in each user session may use the
|
||||||
* same identifier. Identifier formatting follows the same rules as
|
* same identifier. Identifier formatting follows the same rules as
|
||||||
@@ -1286,14 +1286,14 @@ nm_secret_agent_class_init (NMSecretAgentClass *class)
|
|||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_IDENTIFIER,
|
(object_class, PROP_IDENTIFIER,
|
||||||
g_param_spec_string (NM_SECRET_AGENT_IDENTIFIER, "", "",
|
g_param_spec_string (NM_SECRET_AGENT_OLD_IDENTIFIER, "", "",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgent:auto-register:
|
* NMSecretAgentOld:auto-register:
|
||||||
*
|
*
|
||||||
* If %TRUE (the default), the agent will always be registered when
|
* If %TRUE (the default), the agent will always be registered when
|
||||||
* NetworkManager is running; if NetworkManager exits and restarts, the
|
* NetworkManager is running; if NetworkManager exits and restarts, the
|
||||||
@@ -1305,42 +1305,42 @@ nm_secret_agent_class_init (NMSecretAgentClass *class)
|
|||||||
* if the agent is unable to register itself.
|
* if the agent is unable to register itself.
|
||||||
*
|
*
|
||||||
* If the property is %FALSE, the agent will not automatically register with
|
* If the property is %FALSE, the agent will not automatically register with
|
||||||
* NetworkManager, and nm_secret_agent_register() or
|
* NetworkManager, and nm_secret_agent_old_register() or
|
||||||
* nm_secret_agent_register_async() must be called to register it.
|
* nm_secret_agent_old_register_async() must be called to register it.
|
||||||
*
|
*
|
||||||
* Calling nm_secret_agent_unregister() will suppress auto-registration
|
* Calling nm_secret_agent_old_unregister() will suppress auto-registration
|
||||||
* until nm_secret_agent_register() is called, which re-enables
|
* until nm_secret_agent_old_register() is called, which re-enables
|
||||||
* auto-registration. This ensures that the agent remains un-registered when
|
* auto-registration. This ensures that the agent remains un-registered when
|
||||||
* you expect it to be unregistered.
|
* you expect it to be unregistered.
|
||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_AUTO_REGISTER,
|
(object_class, PROP_AUTO_REGISTER,
|
||||||
g_param_spec_boolean (NM_SECRET_AGENT_AUTO_REGISTER, "", "",
|
g_param_spec_boolean (NM_SECRET_AGENT_OLD_AUTO_REGISTER, "", "",
|
||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT |
|
G_PARAM_CONSTRUCT |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgent:registered:
|
* NMSecretAgentOld:registered:
|
||||||
*
|
*
|
||||||
* %TRUE if the agent is registered with NetworkManager, %FALSE if not.
|
* %TRUE if the agent is registered with NetworkManager, %FALSE if not.
|
||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_REGISTERED,
|
(object_class, PROP_REGISTERED,
|
||||||
g_param_spec_boolean (NM_SECRET_AGENT_REGISTERED, "", "",
|
g_param_spec_boolean (NM_SECRET_AGENT_OLD_REGISTERED, "", "",
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READABLE |
|
G_PARAM_READABLE |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgent:capabilities:
|
* NMSecretAgentOld:capabilities:
|
||||||
*
|
*
|
||||||
* A bitfield of %NMSecretAgentCapabilities.
|
* A bitfield of %NMSecretAgentCapabilities.
|
||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_CAPABILITIES,
|
(object_class, PROP_CAPABILITIES,
|
||||||
g_param_spec_flags (NM_SECRET_AGENT_CAPABILITIES, "", "",
|
g_param_spec_flags (NM_SECRET_AGENT_OLD_CAPABILITIES, "", "",
|
||||||
NM_TYPE_SECRET_AGENT_CAPABILITIES,
|
NM_TYPE_SECRET_AGENT_CAPABILITIES,
|
||||||
NM_SECRET_AGENT_CAPABILITY_NONE,
|
NM_SECRET_AGENT_CAPABILITY_NONE,
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
@@ -1352,13 +1352,13 @@ nm_secret_agent_class_init (NMSecretAgentClass *class)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_initable_iface_init (GInitableIface *iface)
|
nm_secret_agent_old_initable_iface_init (GInitableIface *iface)
|
||||||
{
|
{
|
||||||
iface->init = init_sync;
|
iface->init = init_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_secret_agent_async_initable_iface_init (GAsyncInitableIface *iface)
|
nm_secret_agent_old_async_initable_iface_init (GAsyncInitableIface *iface)
|
||||||
{
|
{
|
||||||
iface->init_async = init_async;
|
iface->init_async = init_async;
|
||||||
iface->init_finish = init_finish;
|
iface->init_finish = init_finish;
|
@@ -18,35 +18,31 @@
|
|||||||
* Copyright 2010 - 2011 Red Hat, Inc.
|
* Copyright 2010 - 2011 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __NM_SECRET_AGENT_H__
|
#ifndef __NM_SECRET_AGENT_OLD_H__
|
||||||
#define __NM_SECRET_AGENT_H__
|
#define __NM_SECRET_AGENT_OLD_H__
|
||||||
|
|
||||||
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
|
|
||||||
#error "Only <NetworkManager.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <nm-types.h>
|
#include <nm-types.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ())
|
#define NM_TYPE_SECRET_AGENT_OLD (nm_secret_agent_old_get_type ())
|
||||||
#define NM_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgent))
|
#define NM_SECRET_AGENT_OLD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT_OLD, NMSecretAgentOld))
|
||||||
#define NM_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT, NMSecretAgentClass))
|
#define NM_SECRET_AGENT_OLD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT_OLD, NMSecretAgentOldClass))
|
||||||
#define NM_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SECRET_AGENT))
|
#define NM_IS_SECRET_AGENT_OLD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SECRET_AGENT_OLD))
|
||||||
#define NM_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT))
|
#define NM_IS_SECRET_AGENT_OLD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT_OLD))
|
||||||
#define NM_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgentClass))
|
#define NM_SECRET_AGENT_OLD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT_OLD, NMSecretAgentOldClass))
|
||||||
|
|
||||||
#define NM_SECRET_AGENT_IDENTIFIER "identifier"
|
#define NM_SECRET_AGENT_OLD_IDENTIFIER "identifier"
|
||||||
#define NM_SECRET_AGENT_AUTO_REGISTER "auto-register"
|
#define NM_SECRET_AGENT_OLD_AUTO_REGISTER "auto-register"
|
||||||
#define NM_SECRET_AGENT_REGISTERED "registered"
|
#define NM_SECRET_AGENT_OLD_REGISTERED "registered"
|
||||||
#define NM_SECRET_AGENT_CAPABILITIES "capabilities"
|
#define NM_SECRET_AGENT_OLD_CAPABILITIES "capabilities"
|
||||||
|
|
||||||
struct _NMSecretAgent {
|
typedef struct {
|
||||||
GObject parent;
|
GObject parent;
|
||||||
};
|
} NMSecretAgentOld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgentGetSecretsFunc:
|
* NMSecretAgentOldGetSecretsFunc:
|
||||||
* @agent: the secret agent object
|
* @agent: the secret agent object
|
||||||
* @connection: (transfer none): the connection for which secrets were requested,
|
* @connection: (transfer none): the connection for which secrets were requested,
|
||||||
* note that this object will be unrefed after the callback has returned, use
|
* note that this object will be unrefed after the callback has returned, use
|
||||||
@@ -62,7 +58,7 @@ struct _NMSecretAgent {
|
|||||||
* @user_data: caller-specific data to be passed to the function
|
* @user_data: caller-specific data to be passed to the function
|
||||||
*
|
*
|
||||||
* Called as a result of a request by NM to retrieve secrets. When the
|
* Called as a result of a request by NM to retrieve secrets. When the
|
||||||
* #NMSecretAgent subclass has finished retrieving secrets and is ready to
|
* #NMSecretAgentOld subclass has finished retrieving secrets and is ready to
|
||||||
* return them, or to return an error, this function should be called with
|
* return them, or to return an error, this function should be called with
|
||||||
* those secrets or the error.
|
* those secrets or the error.
|
||||||
*
|
*
|
||||||
@@ -83,21 +79,21 @@ struct _NMSecretAgent {
|
|||||||
* nm_connection_add_setting (secrets, NM_SETTING (s_wsec));
|
* nm_connection_add_setting (secrets, NM_SETTING (s_wsec));
|
||||||
* secrets_dict = nm_connection_to_dbus (secrets, NM_CONNECTION_SERIALIZE_ALL);
|
* secrets_dict = nm_connection_to_dbus (secrets, NM_CONNECTION_SERIALIZE_ALL);
|
||||||
*
|
*
|
||||||
* (call the NMSecretAgentGetSecretsFunc with secrets_dict)
|
* (call the NMSecretAgentOldGetSecretsFunc with secrets_dict)
|
||||||
*
|
*
|
||||||
* g_object_unref (secrets);
|
* g_object_unref (secrets);
|
||||||
* g_variant_unref (secrets_dict);
|
* g_variant_unref (secrets_dict);
|
||||||
* </programlisting>
|
* </programlisting>
|
||||||
* </example>
|
* </example>
|
||||||
*/
|
*/
|
||||||
typedef void (*NMSecretAgentGetSecretsFunc) (NMSecretAgent *agent,
|
typedef void (*NMSecretAgentOldGetSecretsFunc) (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GVariant *secrets,
|
GVariant *secrets,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgentSaveSecretsFunc:
|
* NMSecretAgentOldSaveSecretsFunc:
|
||||||
* @agent: the secret agent object
|
* @agent: the secret agent object
|
||||||
* @connection: (transfer none): the connection for which secrets were to be saved,
|
* @connection: (transfer none): the connection for which secrets were to be saved,
|
||||||
* note that this object will be unrefed after the callback has returned, use
|
* note that this object will be unrefed after the callback has returned, use
|
||||||
@@ -107,16 +103,16 @@ typedef void (*NMSecretAgentGetSecretsFunc) (NMSecretAgent *agent,
|
|||||||
* @user_data: caller-specific data to be passed to the function
|
* @user_data: caller-specific data to be passed to the function
|
||||||
*
|
*
|
||||||
* Called as a result of a request by NM to save secrets. When the
|
* Called as a result of a request by NM to save secrets. When the
|
||||||
* #NMSecretAgent subclass has finished saving the secrets, this function
|
* #NMSecretAgentOld subclass has finished saving the secrets, this function
|
||||||
* should be called.
|
* should be called.
|
||||||
*/
|
*/
|
||||||
typedef void (*NMSecretAgentSaveSecretsFunc) (NMSecretAgent *agent,
|
typedef void (*NMSecretAgentOldSaveSecretsFunc) (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSecretAgentDeleteSecretsFunc:
|
* NMSecretAgentOldDeleteSecretsFunc:
|
||||||
* @agent: the secret agent object
|
* @agent: the secret agent object
|
||||||
* @connection: (transfer none): the connection for which secrets were to be deleted,
|
* @connection: (transfer none): the connection for which secrets were to be deleted,
|
||||||
* note that this object will be unrefed after the callback has returned, use
|
* note that this object will be unrefed after the callback has returned, use
|
||||||
@@ -126,13 +122,13 @@ typedef void (*NMSecretAgentSaveSecretsFunc) (NMSecretAgent *agent,
|
|||||||
* @user_data: caller-specific data to be passed to the function
|
* @user_data: caller-specific data to be passed to the function
|
||||||
*
|
*
|
||||||
* Called as a result of a request by NM to delete secrets. When the
|
* Called as a result of a request by NM to delete secrets. When the
|
||||||
* #NMSecretAgent subclass has finished deleting the secrets, this function
|
* #NMSecretAgentOld subclass has finished deleting the secrets, this function
|
||||||
* should be called.
|
* should be called.
|
||||||
*/
|
*/
|
||||||
typedef void (*NMSecretAgentDeleteSecretsFunc) (NMSecretAgent *agent,
|
typedef void (*NMSecretAgentOldDeleteSecretsFunc) (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GObjectClass parent;
|
GObjectClass parent;
|
||||||
@@ -143,25 +139,25 @@ typedef struct {
|
|||||||
* must copy or reference any arguments it may require after returning from
|
* must copy or reference any arguments it may require after returning from
|
||||||
* this method, as the arguments will freed (except for 'self', 'callback',
|
* this method, as the arguments will freed (except for 'self', 'callback',
|
||||||
* and 'user_data' of course). If the request is canceled, the callback
|
* and 'user_data' of course). If the request is canceled, the callback
|
||||||
* should still be called, but with the NM_SECRET_AGENT_ERROR_AGENT_CANCELED
|
* should still be called, but with the
|
||||||
* error.
|
* NM_SECRET_AGENT_OLD_ERROR_AGENT_CANCELED error.
|
||||||
*/
|
*/
|
||||||
void (*get_secrets) (NMSecretAgent *self,
|
void (*get_secrets) (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char **hints,
|
const char **hints,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
NMSecretAgentOldGetSecretsFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
/* Called when the subclass should cancel an outstanding request to
|
/* Called when the subclass should cancel an outstanding request to
|
||||||
* get secrets for a given connection. Canceling the request MUST
|
* get secrets for a given connection. Canceling the request MUST
|
||||||
* call the callback that was passed along with the initial get_secrets
|
* call the callback that was passed along with the initial get_secrets
|
||||||
* call, sending the NM_SECRET_AGENT_ERROR/NM_SECRET_AGENT_ERROR_AGENT_CANCELED
|
* call, sending the NM_SECRET_AGENT_OLD_ERROR/
|
||||||
* error to that callback.
|
* NM_SECRET_AGENT_OLD_ERROR_AGENT_CANCELED error to that callback.
|
||||||
*/
|
*/
|
||||||
void (*cancel_get_secrets) (NMSecretAgent *self,
|
void (*cancel_get_secrets) (NMSecretAgentOld *self,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
const char *setting_name);
|
const char *setting_name);
|
||||||
|
|
||||||
@@ -171,10 +167,10 @@ typedef struct {
|
|||||||
* arguments will freed (except for 'self', 'callback', and 'user_data'
|
* arguments will freed (except for 'self', 'callback', and 'user_data'
|
||||||
* of course).
|
* of course).
|
||||||
*/
|
*/
|
||||||
void (*save_secrets) (NMSecretAgent *self,
|
void (*save_secrets) (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
NMSecretAgentOldSaveSecretsFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
/* Called when the subclass should delete the secrets contained in the
|
/* Called when the subclass should delete the secrets contained in the
|
||||||
@@ -183,60 +179,60 @@ typedef struct {
|
|||||||
* arguments will freed (except for 'self', 'callback', and 'user_data'
|
* arguments will freed (except for 'self', 'callback', and 'user_data'
|
||||||
* of course).
|
* of course).
|
||||||
*/
|
*/
|
||||||
void (*delete_secrets) (NMSecretAgent *self,
|
void (*delete_secrets) (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
NMSecretAgentOldDeleteSecretsFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer padding[8];
|
gpointer padding[8];
|
||||||
} NMSecretAgentClass;
|
} NMSecretAgentOldClass;
|
||||||
|
|
||||||
GType nm_secret_agent_get_type (void);
|
GType nm_secret_agent_old_get_type (void);
|
||||||
|
|
||||||
gboolean nm_secret_agent_register (NMSecretAgent *self,
|
gboolean nm_secret_agent_old_register (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
void nm_secret_agent_register_async (NMSecretAgent *self,
|
void nm_secret_agent_old_register_async (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gboolean nm_secret_agent_register_finish (NMSecretAgent *self,
|
gboolean nm_secret_agent_old_register_finish (NMSecretAgentOld *self,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean nm_secret_agent_unregister (NMSecretAgent *self,
|
gboolean nm_secret_agent_old_unregister (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
void nm_secret_agent_unregister_async (NMSecretAgent *self,
|
void nm_secret_agent_old_unregister_async (NMSecretAgentOld *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gboolean nm_secret_agent_unregister_finish (NMSecretAgent *self,
|
gboolean nm_secret_agent_old_unregister_finish (NMSecretAgentOld *self,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean nm_secret_agent_get_registered (NMSecretAgent *self);
|
gboolean nm_secret_agent_old_get_registered (NMSecretAgentOld *self);
|
||||||
|
|
||||||
void nm_secret_agent_get_secrets (NMSecretAgent *self,
|
void nm_secret_agent_old_get_secrets (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char **hints,
|
const char **hints,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
NMSecretAgentOldGetSecretsFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void nm_secret_agent_save_secrets (NMSecretAgent *self,
|
void nm_secret_agent_old_save_secrets (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
NMSecretAgentOldSaveSecretsFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
void nm_secret_agent_old_delete_secrets (NMSecretAgentOld *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
NMSecretAgentOldDeleteSecretsFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __NM_SECRET_AGENT_H__ */
|
#endif /* __NM_SECRET_AGENT_OLD_H__ */
|
@@ -47,7 +47,6 @@ typedef struct _NMDhcpConfig NMDhcpConfig;
|
|||||||
typedef struct _NMIPConfig NMIPConfig;
|
typedef struct _NMIPConfig NMIPConfig;
|
||||||
typedef struct _NMObject NMObject;
|
typedef struct _NMObject NMObject;
|
||||||
typedef struct _NMRemoteConnection NMRemoteConnection;
|
typedef struct _NMRemoteConnection NMRemoteConnection;
|
||||||
typedef struct _NMSecretAgent NMSecretAgent;
|
|
||||||
typedef struct _NMVpnConnection NMVpnConnection;
|
typedef struct _NMVpnConnection NMVpnConnection;
|
||||||
typedef struct _NMWimaxNsp NMWimaxNsp;
|
typedef struct _NMWimaxNsp NMWimaxNsp;
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <NetworkManager.h>
|
#include <NetworkManager.h>
|
||||||
|
#include <nm-secret-agent-old.h>
|
||||||
#include "nm-glib-compat.h"
|
#include "nm-glib-compat.h"
|
||||||
#include "nm-test-utils.h"
|
#include "nm-test-utils.h"
|
||||||
|
|
||||||
@@ -41,11 +42,11 @@ enum {
|
|||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
typedef NMSecretAgent TestSecretAgent;
|
typedef NMSecretAgentOld TestSecretAgent;
|
||||||
typedef NMSecretAgentClass TestSecretAgentClass;
|
typedef NMSecretAgentOldClass TestSecretAgentClass;
|
||||||
|
|
||||||
GType test_secret_agent_get_type (void);
|
GType test_secret_agent_get_type (void);
|
||||||
G_DEFINE_TYPE (TestSecretAgent, test_secret_agent, NM_TYPE_SECRET_AGENT)
|
G_DEFINE_TYPE (TestSecretAgent, test_secret_agent, NM_TYPE_SECRET_AGENT_OLD)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_secret_agent_init (TestSecretAgent *agent)
|
test_secret_agent_init (TestSecretAgent *agent)
|
||||||
@@ -53,14 +54,14 @@ test_secret_agent_init (TestSecretAgent *agent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_secret_agent_get_secrets (NMSecretAgent *agent,
|
test_secret_agent_get_secrets (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *connection_path,
|
const char *connection_path,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char **hints,
|
const char **hints,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
NMSecretAgentOldGetSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
NMSettingWirelessSecurity *s_wsec;
|
||||||
GVariant *secrets = NULL;
|
GVariant *secrets = NULL;
|
||||||
@@ -113,29 +114,29 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_secret_agent_cancel_get_secrets (NMSecretAgent *agent,
|
test_secret_agent_cancel_get_secrets (NMSecretAgentOld *agent,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
const gchar *setting_name)
|
const gchar *setting_name)
|
||||||
{
|
{
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_secret_agent_save_secrets (NMSecretAgent *agent,
|
test_secret_agent_save_secrets (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
NMSecretAgentOldSaveSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_secret_agent_delete_secrets (NMSecretAgent *agent,
|
test_secret_agent_delete_secrets (NMSecretAgentOld *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const gchar *connection_path,
|
const gchar *connection_path,
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
NMSecretAgentOldDeleteSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
@@ -144,7 +145,7 @@ static void
|
|||||||
test_secret_agent_class_init (TestSecretAgentClass *klass)
|
test_secret_agent_class_init (TestSecretAgentClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
NMSecretAgentClass *agent_class = NM_SECRET_AGENT_CLASS (klass);
|
NMSecretAgentOldClass *agent_class = NM_SECRET_AGENT_OLD_CLASS (klass);
|
||||||
|
|
||||||
agent_class->get_secrets = test_secret_agent_get_secrets;
|
agent_class->get_secrets = test_secret_agent_get_secrets;
|
||||||
agent_class->cancel_get_secrets = test_secret_agent_cancel_get_secrets;
|
agent_class->cancel_get_secrets = test_secret_agent_cancel_get_secrets;
|
||||||
@@ -164,15 +165,15 @@ test_secret_agent_class_init (TestSecretAgentClass *klass)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMSecretAgent *
|
static NMSecretAgentOld *
|
||||||
test_secret_agent_new (void)
|
test_secret_agent_new (void)
|
||||||
{
|
{
|
||||||
NMSecretAgent *agent;
|
NMSecretAgentOld *agent;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
|
agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
|
||||||
NM_SECRET_AGENT_IDENTIFIER, "test-secret-agent",
|
NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
|
||||||
NM_SECRET_AGENT_AUTO_REGISTER, FALSE,
|
NM_SECRET_AGENT_OLD_AUTO_REGISTER, FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ typedef struct {
|
|||||||
NMTestServiceInfo *sinfo;
|
NMTestServiceInfo *sinfo;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
|
|
||||||
NMSecretAgent *agent;
|
NMSecretAgentOld *agent;
|
||||||
NMDevice *device;
|
NMDevice *device;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
|
|
||||||
@@ -228,9 +229,9 @@ register_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||||||
TestSecretAgentData *sadata = user_data;
|
TestSecretAgentData *sadata = user_data;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
nm_secret_agent_register_finish (sadata->agent, result, &error);
|
nm_secret_agent_old_register_finish (sadata->agent, result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (nm_secret_agent_get_registered (sadata->agent));
|
g_assert (nm_secret_agent_old_get_registered (sadata->agent));
|
||||||
|
|
||||||
g_main_loop_quit (sadata->loop);
|
g_main_loop_quit (sadata->loop);
|
||||||
}
|
}
|
||||||
@@ -297,11 +298,11 @@ test_setup (TestSecretAgentData *sadata, gconstpointer test_data)
|
|||||||
sadata->agent = test_secret_agent_new ();
|
sadata->agent = test_secret_agent_new ();
|
||||||
|
|
||||||
if (!strcmp (agent_notes, "sync")) {
|
if (!strcmp (agent_notes, "sync")) {
|
||||||
nm_secret_agent_register (sadata->agent, NULL, &error);
|
nm_secret_agent_old_register (sadata->agent, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (nm_secret_agent_get_registered (sadata->agent));
|
g_assert (nm_secret_agent_old_get_registered (sadata->agent));
|
||||||
} else {
|
} else {
|
||||||
nm_secret_agent_register_async (sadata->agent, NULL,
|
nm_secret_agent_old_register_async (sadata->agent, NULL,
|
||||||
register_cb, sadata);
|
register_cb, sadata);
|
||||||
g_main_loop_run (sadata->loop);
|
g_main_loop_run (sadata->loop);
|
||||||
}
|
}
|
||||||
@@ -315,8 +316,8 @@ test_cleanup (TestSecretAgentData *sadata, gconstpointer test_data)
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (sadata->agent) {
|
if (sadata->agent) {
|
||||||
if (nm_secret_agent_get_registered (sadata->agent)) {
|
if (nm_secret_agent_old_get_registered (sadata->agent)) {
|
||||||
nm_secret_agent_unregister (sadata->agent, NULL, &error);
|
nm_secret_agent_old_unregister (sadata->agent, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
}
|
}
|
||||||
g_object_unref (sadata->agent);
|
g_object_unref (sadata->agent);
|
||||||
@@ -549,12 +550,12 @@ async_init_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||||||
static void
|
static void
|
||||||
test_secret_agent_nm_not_running (void)
|
test_secret_agent_nm_not_running (void)
|
||||||
{
|
{
|
||||||
NMSecretAgent *agent;
|
NMSecretAgentOld *agent;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
|
agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
|
||||||
NM_SECRET_AGENT_IDENTIFIER, "test-secret-agent",
|
NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
|
||||||
NULL);
|
NULL);
|
||||||
g_assert_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED);
|
g_assert_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED);
|
||||||
g_assert (agent == NULL);
|
g_assert (agent == NULL);
|
||||||
@@ -564,7 +565,7 @@ test_secret_agent_nm_not_running (void)
|
|||||||
g_async_initable_new_async (test_secret_agent_get_type (),
|
g_async_initable_new_async (test_secret_agent_get_type (),
|
||||||
G_PRIORITY_DEFAULT,
|
G_PRIORITY_DEFAULT,
|
||||||
NULL, async_init_cb, loop,
|
NULL, async_init_cb, loop,
|
||||||
NM_SECRET_AGENT_IDENTIFIER, "test-secret-agent",
|
NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
|
||||||
NULL);
|
NULL);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_main_loop_unref (loop);
|
g_main_loop_unref (loop);
|
||||||
@@ -583,7 +584,7 @@ static void
|
|||||||
test_secret_agent_auto_register (void)
|
test_secret_agent_auto_register (void)
|
||||||
{
|
{
|
||||||
NMTestServiceInfo *sinfo;
|
NMTestServiceInfo *sinfo;
|
||||||
NMSecretAgent *agent;
|
NMSecretAgentOld *agent;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
@@ -592,30 +593,30 @@ test_secret_agent_auto_register (void)
|
|||||||
|
|
||||||
agent = test_secret_agent_new ();
|
agent = test_secret_agent_new ();
|
||||||
g_object_set (agent,
|
g_object_set (agent,
|
||||||
NM_SECRET_AGENT_AUTO_REGISTER, TRUE,
|
NM_SECRET_AGENT_OLD_AUTO_REGISTER, TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
g_signal_connect (agent, "notify::" NM_SECRET_AGENT_REGISTERED,
|
g_signal_connect (agent, "notify::" NM_SECRET_AGENT_OLD_REGISTERED,
|
||||||
G_CALLBACK (registered_changed), loop);
|
G_CALLBACK (registered_changed), loop);
|
||||||
|
|
||||||
g_assert (!nm_secret_agent_get_registered (agent));
|
g_assert (!nm_secret_agent_old_get_registered (agent));
|
||||||
nm_secret_agent_register (agent, NULL, &error);
|
nm_secret_agent_old_register (agent, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (nm_secret_agent_get_registered (agent));
|
g_assert (nm_secret_agent_old_get_registered (agent));
|
||||||
|
|
||||||
/* Shut down test service */
|
/* Shut down test service */
|
||||||
nm_test_service_cleanup (sinfo);
|
nm_test_service_cleanup (sinfo);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (!nm_secret_agent_get_registered (agent));
|
g_assert (!nm_secret_agent_old_get_registered (agent));
|
||||||
|
|
||||||
/* Restart test service */
|
/* Restart test service */
|
||||||
sinfo = nm_test_service_init ();
|
sinfo = nm_test_service_init ();
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (nm_secret_agent_get_registered (agent));
|
g_assert (nm_secret_agent_old_get_registered (agent));
|
||||||
|
|
||||||
/* Shut down test service again */
|
/* Shut down test service again */
|
||||||
nm_test_service_cleanup (sinfo);
|
nm_test_service_cleanup (sinfo);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_assert (!nm_secret_agent_get_registered (agent));
|
g_assert (!nm_secret_agent_old_get_registered (agent));
|
||||||
|
|
||||||
g_object_unref (agent);
|
g_object_unref (agent);
|
||||||
g_main_loop_unref (loop);
|
g_main_loop_unref (loop);
|
||||||
|
Reference in New Issue
Block a user