2007-09-11 Dan Williams <dcbw@redhat.com>

* libnm-util/nm-setting.c
	  libnm-util/nm-setting.h
		- (nm_setting_update_secrets): new function; add a virtual function that
			subclasses can implement to update their secrets
		- (setting_wireless_security_update_secrets): implement that function
			for the 802-11-wireless-security subclass

	* libnm-util/nm-connection.c
	  libnm-util/nm-connection.h
		- (nm_connection_update_secrets): update secrets for a Setting and
			emit a signal on success

	* src/nm-manager.c
	  src/nm-manager.h
	  src/nm-marshal.list
		- (connection_get_settings_cb): enable system settings bits
		- (nm_manager_get_connection_secrets, get_secrets_cb): add function
			to request secrets from the settings dbus service and to
			push those secrets to the NMConnection itself

	* src/nm-activation-request.c
	  src/nm-activation-request.h
		- Attach to the 'secrets-updated' signal of the NMConnection that's
			currently being activated, and proxy that signal to other listeners.
			Goes through the activation request because the activation request
			is the thing that manages the lifetime of the NMConnection that's
			being activated.

	* src/nm-device-802-11-wireless.c
		- (real_connection_secrets_updated): implement the connection secrets
			updated notification and restart activation when secrets are
			received
		- (real_act_stage2_config): request secrets from the settings dbus
			service if secrets are needed

	* src/nm-device.c
	  src/nm-device.h
		- (clear_act_request, nm_device_activation_cancel,
		   nm_device_deactivate_quickly, nm_device_dispose): consolidate places
			where the activation request is cleared
		- (nm_device_activate, connection_secrets_updated_cb): attach to the
			updated secrets signal of activation request and add a function
			that subclasses can override to handle it easily



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2782 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2007-09-11 18:02:27 +00:00
parent d52a52421a
commit 937d1add73
13 changed files with 406 additions and 61 deletions

View file

@ -1,3 +1,49 @@
2007-09-11 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.c
libnm-util/nm-setting.h
- (nm_setting_update_secrets): new function; add a virtual function that
subclasses can implement to update their secrets
- (setting_wireless_security_update_secrets): implement that function
for the 802-11-wireless-security subclass
* libnm-util/nm-connection.c
libnm-util/nm-connection.h
- (nm_connection_update_secrets): update secrets for a Setting and
emit a signal on success
* src/nm-manager.c
src/nm-manager.h
src/nm-marshal.list
- (connection_get_settings_cb): enable system settings bits
- (nm_manager_get_connection_secrets, get_secrets_cb): add function
to request secrets from the settings dbus service and to
push those secrets to the NMConnection itself
* src/nm-activation-request.c
src/nm-activation-request.h
- Attach to the 'secrets-updated' signal of the NMConnection that's
currently being activated, and proxy that signal to other listeners.
Goes through the activation request because the activation request
is the thing that manages the lifetime of the NMConnection that's
being activated.
* src/nm-device-802-11-wireless.c
- (real_connection_secrets_updated): implement the connection secrets
updated notification and restart activation when secrets are
received
- (real_act_stage2_config): request secrets from the settings dbus
service if secrets are needed
* src/nm-device.c
src/nm-device.h
- (clear_act_request, nm_device_activation_cancel,
nm_device_deactivate_quickly, nm_device_dispose): consolidate places
where the activation request is cleared
- (nm_device_activate, connection_secrets_updated_cb): attach to the
updated secrets signal of activation request and add a function
that subclasses can override to handle it easily
2007-09-11 Tambet Ingo <tambet@gmail.com>
* src/backends/NetworkManagerSuSE.c: Fix a build issue caused by the

View file

@ -11,6 +11,14 @@ typedef struct {
G_DEFINE_TYPE (NMConnection, nm_connection, G_TYPE_OBJECT)
enum {
SECRETS_UPDATED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static GHashTable *registered_setting_creators = NULL;
static void
@ -163,8 +171,33 @@ no_secrets:
return NULL;
}
void
nm_connection_update_secrets (NMConnection *connection,
const char *setting_name,
GHashTable *secrets)
{
NMSetting *setting;
g_return_if_fail (NM_IS_CONNECTION (connection));
g_return_if_fail (setting_name != NULL);
g_return_if_fail (secrets != NULL);
setting = nm_connection_get_setting (connection, setting_name);
if (!setting) {
g_warning ("Unhandled settings object for secrets update.");
return;
}
if (!nm_setting_update_secrets (setting, secrets)) {
g_warning ("Error updating secrets for setting '%s'", setting_name);
return;
}
g_signal_emit (connection, signals[SECRETS_UPDATED], 0, setting_name);
}
const char *
nm_connection_need_secrets (NMConnection *connection)
nm_connection_need_secrets (NMConnection *connection)
{
NMSettingConnection *s_connection;
@ -436,5 +469,16 @@ nm_connection_class_init (NMConnectionClass *klass)
/* virtual methods */
object_class->finalize = finalize;
/* Signals */
signals[SECRETS_UPDATED] =
g_signal_new ("secrets-updated",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, secrets_updated),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
}

View file

@ -20,6 +20,9 @@ typedef struct {
typedef struct {
GObjectClass parent;
/* Signals */
void (*secrets_updated) (NMConnection *connection, const char * setting);
} NMConnectionClass;
GType nm_connection_get_type (void);
@ -37,6 +40,10 @@ gboolean nm_connection_compare (NMConnection *connection,
const char * nm_connection_need_secrets (NMConnection *connection);
void nm_connection_update_secrets (NMConnection *connection,
const char *setting_name,
GHashTable *secrets);
GHashTable *nm_connection_to_hash (NMConnection *connection);
void nm_connection_dump (NMConnection *connection);

View file

@ -52,6 +52,18 @@ nm_setting_to_hash (NMSetting *setting)
return setting->hash_fn (setting);
}
gboolean
nm_setting_update_secrets (NMSetting *setting,
GHashTable *secrets)
{
g_return_val_if_fail (setting != NULL, FALSE);
g_return_val_if_fail (secrets != NULL, FALSE);
if (setting->update_secrets_fn)
return setting->update_secrets_fn (setting, secrets);
return TRUE;
}
void
nm_setting_destroy (NMSetting *setting)
{
@ -995,6 +1007,79 @@ setting_wireless_security_destroy (NMSetting *setting)
g_slice_free (NMSettingWirelessSecurity, self);
}
static gboolean
setting_wireless_security_update_secrets (NMSetting *setting,
GHashTable *secrets)
{
NMSettingWirelessSecurity *self = (NMSettingWirelessSecurity *) setting;
GValue *value;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (secrets != NULL, FALSE);
value = (GValue *) g_hash_table_lookup (secrets, "wep_key0");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->wep_key0);
self->wep_key0 = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "wep_key1");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->wep_key1);
self->wep_key1 = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "wep_key2");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->wep_key2);
self->wep_key2 = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "wep_key3");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->wep_key3);
self->wep_key3 = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "psk");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->psk);
self->psk = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "password");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->password);
self->password = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "pin");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->pin);
self->pin = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "eappsk");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->eappsk);
self->eappsk = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "private-key-passwd");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->private_key_passwd);
self->private_key_passwd = g_strdup (g_value_get_string (value));
}
value = (GValue *) g_hash_table_lookup (secrets, "phase2-private-key-passwd");
if (value && G_VALUE_HOLDS_STRING (value)) {
g_free (self->phase2_private_key_passwd);
self->phase2_private_key_passwd = g_strdup (g_value_get_string (value));
}
return TRUE;
}
NMSetting *
nm_setting_wireless_security_new (void)
{
@ -1006,6 +1091,7 @@ nm_setting_wireless_security_new (void)
setting->verify_fn = setting_wireless_security_verify;
setting->hash_fn = setting_wireless_security_hash;
setting->destroy_fn = setting_wireless_security_destroy;
setting->update_secrets_fn = setting_wireless_security_update_secrets;
return setting;
}
@ -1114,45 +1200,7 @@ nm_setting_wireless_security_new_from_hash (GHashTable *settings)
if (value && G_VALUE_HOLDS_STRING (value))
self->nai = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "wep_key0");
if (value && G_VALUE_HOLDS_STRING (value))
self->wep_key0 = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "wep_key1");
if (value && G_VALUE_HOLDS_STRING (value))
self->wep_key1 = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "wep_key2");
if (value && G_VALUE_HOLDS_STRING (value))
self->wep_key2 = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "wep_key3");
if (value && G_VALUE_HOLDS_STRING (value))
self->wep_key3 = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "psk");
if (value && G_VALUE_HOLDS_STRING (value))
self->psk = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "password");
if (value && G_VALUE_HOLDS_STRING (value))
self->password = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "pin");
if (value && G_VALUE_HOLDS_STRING (value))
self->pin = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "eappsk");
if (value && G_VALUE_HOLDS_STRING (value))
self->eappsk = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "private-key-passwd");
if (value && G_VALUE_HOLDS_STRING (value))
self->private_key_passwd = g_strdup (g_value_get_string (value));
value = (GValue *) g_hash_table_lookup (settings, "phase2-private-key-passwd");
if (value && G_VALUE_HOLDS_STRING (value))
self->phase2_private_key_passwd = g_strdup (g_value_get_string (value));
setting_wireless_security_update_secrets (setting, settings);
return setting;
}

View file

@ -15,6 +15,9 @@ typedef gboolean (*NMSettingVerifyFn) (NMSetting *setting,
typedef GHashTable *(*NMSettingToHashFn) (NMSetting *setting);
typedef gboolean (*NMSettingUpdateSecretsFn) (NMSetting *setting,
GHashTable *secrets);
typedef void (*NMSettingDestroyFn) (NMSetting *setting);
struct _NMSetting {
@ -22,11 +25,13 @@ struct _NMSetting {
NMSettingVerifyFn verify_fn;
NMSettingToHashFn hash_fn;
NMSettingUpdateSecretsFn update_secrets_fn;
NMSettingDestroyFn destroy_fn;
};
gboolean nm_settings_verify (GHashTable *all_settings);
GHashTable *nm_setting_to_hash (NMSetting *setting);
gboolean nm_setting_update_secrets (NMSetting *setting, GHashTable *secrets);
void nm_setting_destroy (NMSetting *setting);
/* Default, built-in settings */

View file

@ -21,15 +21,31 @@
#include "nm-activation-request.h"
#include "nm-marshal.h"
G_DEFINE_TYPE (NMActRequest, nm_act_request, G_TYPE_OBJECT)
#define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACT_REQUEST, NMActRequestPrivate))
enum {
CONNECTION_SECRETS_UPDATED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void connection_secrets_updated_cb (NMConnection *connection,
const char *setting_name,
NMActRequest *self);
typedef struct {
NMConnection *connection;
char *specific_object;
gboolean user_requested;
gulong secrets_updated_id;
} NMActRequestPrivate;
static void
@ -42,6 +58,8 @@ finalize (GObject *object)
{
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
g_signal_handler_disconnect (priv->connection,
priv->secrets_updated_id);
g_object_unref (priv->connection);
g_free (priv->specific_object);
@ -57,6 +75,17 @@ nm_act_request_class_init (NMActRequestClass *req_class)
g_type_class_add_private (req_class, sizeof (NMActRequestPrivate));
object_class->finalize = finalize;
/* Signals */
signals[CONNECTION_SECRETS_UPDATED] =
g_signal_new ("connection-secrets-updated",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, secrets_updated),
NULL, NULL,
nm_marshal_VOID__OBJECT_STRING,
G_TYPE_NONE, 2,
G_TYPE_OBJECT, G_TYPE_STRING);
}
NMActRequest *
@ -66,6 +95,7 @@ nm_act_request_new (NMConnection *connection,
{
GObject *obj;
NMActRequestPrivate *priv;
gulong id;
g_return_val_if_fail (connection != NULL, NULL);
@ -80,9 +110,26 @@ nm_act_request_new (NMConnection *connection,
if (specific_object)
priv->specific_object = g_strdup (specific_object);
id = g_signal_connect (priv->connection,
"secrets-updated",
G_CALLBACK (connection_secrets_updated_cb),
NM_ACT_REQUEST (obj));
priv->secrets_updated_id = id;
return NM_ACT_REQUEST (obj);
}
static void
connection_secrets_updated_cb (NMConnection *connection,
const char *setting_name,
NMActRequest *self)
{
g_return_if_fail (setting_name != NULL);
g_return_if_fail (self != NULL);
g_signal_emit (connection, signals[CONNECTION_SECRETS_UPDATED], 0, connection, setting_name);
}
NMConnection *
nm_act_request_get_connection (NMActRequest *req)
{

View file

@ -39,6 +39,11 @@ typedef struct {
typedef struct {
GObjectClass parent;
/* Signals */
void (*connection_secrets_updated) (NMActRequest *req,
NMConnection *connection,
const char * setting);
} NMActRequestClass;
GType nm_act_request_get_type (void);

View file

@ -2438,6 +2438,25 @@ real_act_stage1_prepare (NMDevice *dev)
}
static void
real_connection_secrets_updated (NMDevice *dev,
NMConnection *connection,
const char *setting_name)
{
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
NMActRequest *req;
if (nm_device_get_state (dev) != NM_DEVICE_STATE_NEED_AUTH)
return;
req = nm_device_get_act_request (dev);
g_assert (req);
g_return_if_fail (nm_act_request_get_connection (req) != connection);
nm_device_activate_schedule_stage1_device_prepare (dev);
}
static NMActStageReturn
real_act_stage2_config (NMDevice *dev)
{
@ -2449,6 +2468,7 @@ real_act_stage2_config (NMDevice *dev)
NMActRequest * req;
NMConnection * connection;
NMSettingConnection * s_connection;
const char * setting_name;
remove_supplicant_timeouts (self);
@ -2462,13 +2482,16 @@ real_act_stage2_config (NMDevice *dev)
g_assert (s_connection);
/* If we need secrets, get them */
if (nm_connection_need_secrets (connection)) {
setting_name = nm_connection_need_secrets (connection);
if (setting_name) {
NMManager * manager = nm_manager_get ();
nm_info ("Activation (%s/wireless): access point '%s' has security,"
" but secrets are required.",
iface, s_connection->name);
nm_device_state_changed (dev, NM_DEVICE_STATE_NEED_AUTH);
// FIXME: get secrets from info-daemon
nm_manager_get_connection_secrets (manager, connection, setting_name);
return NM_ACT_STAGE_RETURN_POSTPONE;
} else {
nm_info ("Activation (%s/wireless): connection '%s' has security"
@ -2797,6 +2820,7 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass)
parent_class->set_hw_address = real_set_hw_address;
parent_class->check_connection = real_check_connection;
parent_class->get_best_connection = real_get_best_connection;
parent_class->connection_secrets_updated = real_connection_secrets_updated;
parent_class->act_stage1_prepare = real_act_stage1_prepare;
parent_class->act_stage2_config = real_act_stage2_config;

View file

@ -70,6 +70,7 @@ struct _NMDevicePrivate
NMActRequest * act_request;
guint act_source_id;
gulong secrets_updated_id;
/* IP configuration info */
void * system_config_data; /* Distro-specific config data (parsed config file, etc) */
@ -939,6 +940,26 @@ nm_device_activate_schedule_stage5_ip_config_commit (NMDevice *self)
}
static void
clear_act_request (NMDevice *self)
{
NMDevicePrivate * priv;
g_return_if_fail (self != NULL);
priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->act_request)
return;
g_signal_handler_disconnect (priv->act_request,
priv->secrets_updated_id);
priv->secrets_updated_id = 0;
g_object_unref (priv->act_request);
priv->act_request = NULL;
}
static void
real_activation_cancel_handler (NMDevice *self)
{
@ -979,8 +1000,7 @@ nm_device_activation_cancel (NMDevice *self)
if (klass->activation_cancel_handler)
klass->activation_cancel_handler (self);
g_object_unref (self->priv->act_request);
self->priv->act_request = NULL;
clear_act_request (self);
nm_info ("Activation (%s): cancelled.", nm_device_get_iface (self));
}
@ -1006,17 +1026,16 @@ nm_device_deactivate_quickly (NMDevice *self)
if (nm_device_is_activating (self))
nm_device_activation_cancel (self);
/* Stop any ongoing DHCP transaction on this device */
if (nm_device_get_act_request (self) && nm_device_get_use_dhcp (self)) {
nm_dhcp_manager_cancel_transaction (NM_DEVICE_GET_PRIVATE (self)->dhcp_manager,
nm_device_get_iface (self));
}
/* Tear down an existing activation request, which may not have happened
* in nm_device_activation_cancel() above, for various reasons.
*/
if ((act_request = nm_device_get_act_request (self)) &&
nm_device_get_use_dhcp (self)) {
nm_dhcp_manager_cancel_transaction (NM_DEVICE_GET_PRIVATE (self)->dhcp_manager,
nm_device_get_iface (self));
g_object_unref (act_request);
self->priv->act_request = NULL;
}
clear_act_request (self);
/* Call device type-specific deactivation */
if (NM_DEVICE_GET_CLASS (self)->deactivate_quickly)
@ -1064,6 +1083,18 @@ nm_device_deactivate (NMDeviceInterface *device)
nm_device_state_changed (self, NM_DEVICE_STATE_DISCONNECTED);
}
static void
connection_secrets_updated_cb (NMActRequest *req,
NMConnection *connection,
const char *setting_name,
gpointer user_data)
{
NMDevice *self = NM_DEVICE (user_data);
if (NM_DEVICE_GET_CLASS (self)->connection_secrets_updated)
NM_DEVICE_GET_CLASS (self)->connection_secrets_updated (self, connection, setting_name);
}
static void
nm_device_activate (NMDeviceInterface *device,
NMConnection *connection,
@ -1072,6 +1103,7 @@ nm_device_activate (NMDeviceInterface *device,
{
NMDevice *self = NM_DEVICE (device);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
gulong id;
if (!NM_DEVICE_GET_CLASS (self)->check_connection (self, connection))
/* connection is invalid */
@ -1091,6 +1123,12 @@ nm_device_activate (NMDeviceInterface *device,
nm_info ("Activating device %s", nm_device_get_iface (self));
priv->act_request = nm_act_request_new (connection, specific_object, user_requested);
id = g_signal_connect (priv->act_request,
"connection-secrets-updated",
G_CALLBACK (connection_secrets_updated_cb),
self);
priv->secrets_updated_id = id;
nm_device_activate_schedule_stage1_device_prepare (self);
}
@ -1439,11 +1477,7 @@ nm_device_dispose (GObject *object)
nm_system_device_free_system_config (self, self->priv->system_config_data);
nm_device_set_ip4_config (self, NULL);
if (self->priv->act_request)
{
g_object_unref (self->priv->act_request);
self->priv->act_request = NULL;
}
clear_act_request (self);
if (self->priv->act_source_id) {
g_source_remove (self->priv->act_source_id);

View file

@ -93,6 +93,10 @@ struct _NMDeviceClass
NMConnection * (* get_best_connection) (NMDevice *self,
char **specific_object);
void (* connection_secrets_updated) (NMDevice *self,
NMConnection *connection,
const char *setting_name);
gboolean (* check_connection) (NMDevice *self, NMConnection *connection);
NMActStageReturn (* act_stage1_prepare) (NMDevice *self);

View file

@ -290,10 +290,10 @@ connection_get_settings_cb (DBusGProxy *proxy,
g_hash_table_insert (priv->user_connections,
g_strdup (path),
connection);
// } else if (strcmp (bus_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS) == 0) {
// g_hash_table_insert (priv->system_connections,
// g_strdup (path),
// connection);
} else if (strcmp (bus_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS) == 0) {
g_hash_table_insert (priv->system_connections,
g_strdup (path),
connection);
}
} else {
// FIXME: merge settings? or just replace?
@ -956,3 +956,79 @@ nm_manager_update_connections (NMManager *manager,
nm_manager_connections_destroy (manager, type);
}
static void
get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
NMManager *manager = NM_MANAGER (user_data);
GError *err = NULL;
GHashTable *secrets = NULL;
char *setting_name = NULL;
NMConnection *connection;
connection = g_object_get_data (G_OBJECT (call), "connection");
g_assert (connection);
setting_name = g_object_get_data (G_OBJECT (call), "setting-name");
if (!dbus_g_proxy_end_call (proxy, call, &err,
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &secrets,
G_TYPE_INVALID)) {
nm_warning ("Couldn't get connection secrets: %s.", err->message);
g_error_free (err);
// FIXME: do we need to propagate the error back up to the device?
// Otherwise device spins in the NEED_AUTH state until something
// kicks it or it gets a different activation
goto out;
}
nm_connection_update_secrets (connection, setting_name, secrets);
g_hash_table_destroy (secrets);
out:
g_object_unref (connection);
g_free (setting_name);
}
void
nm_manager_get_connection_secrets (NMManager *manager,
NMConnection *connection,
const char * setting_name)
{
DBusGProxy *proxy;
DBusGProxyCall *call;
char * dup_name;
g_return_if_fail (NM_IS_MANAGER (manager));
g_return_if_fail (NM_IS_CONNECTION (connection));
dup_name = g_strdup (setting_name);
if (!dup_name) {
nm_warning ("Not enough memory to get secrets");
return;
}
proxy = g_object_get_data (G_OBJECT (connection), "dbus-proxy");
if (!proxy) {
nm_warning ("Couldn't get dbus proxy for connection.");
goto error;
}
call = dbus_g_proxy_begin_call (proxy, "GetSecrets",
get_secrets_cb,
manager,
NULL,
G_TYPE_STRING, setting_name,
G_TYPE_INVALID);
if (!call) {
goto error;
}
g_object_ref (connection);
g_object_set_data (G_OBJECT (call), "connection", connection);
g_object_set_data (G_OBJECT (call), "setting-name", dup_name);
return;
error:
g_free (dup_name);
}

View file

@ -69,4 +69,8 @@ NMConnection * nm_manager_get_connection_by_object_path (NMManager *manager,
NMConnectionType type,
const char *path);
void nm_manager_get_connection_secrets (NMManager *manager,
NMConnection *connection,
const char * setting_name);
#endif /* NM_MANAGER_H */

View file

@ -1,4 +1,5 @@
VOID:OBJECT
VOID:OBJECT,STRING
VOID:POINTER
VOID:STRING,STRING,STRING
VOID:UINT,UINT