vpn: fix 'SpecificObject' path for active VPN connections on D-Bus

Active VPN connections exported their own active path instead of active path of
base connection in 'SpecificObject' property. It's a regression caused by commit
bc6fc7b910 that split VPN connections to
NMVPNConnectionBase and NMVPNConnection.
Previously, specific object used to be obtained from NMActRequest of parent
connection. The NMActRequest object served also for getting secrets. Commits
0e6a5365d4 and 832e64f8bc
removed NMActRequest from VPN connection because it's not necessary any more.
This commit fixes the issue by passing specific object path explicitly.
This commit is contained in:
Jiří Klimeš 2011-09-29 16:09:17 +02:00
parent a38032e96c
commit a4305b3cbe
9 changed files with 29 additions and 8 deletions

View file

@ -1992,6 +1992,7 @@ nm_manager_activate_connection (NMManager *manager,
vpn_connection = nm_vpn_manager_activate_connection (priv->vpn_manager,
connection,
device,
specific_object,
TRUE,
sender_uid,
error);

View file

@ -36,6 +36,7 @@ typedef struct {
NMConnection *connection;
char *ac_path;
char *specific_object;
gboolean is_default;
gboolean is_default6;
NMActiveConnectionState state;
@ -91,9 +92,16 @@ nm_vpn_connection_base_get_ac_path (NMVpnConnectionBase *self)
return NM_VPN_CONNECTION_BASE_GET_PRIVATE (self)->ac_path;
}
const char *
nm_vpn_connection_base_get_specific_object (NMVpnConnectionBase *self)
{
return NM_VPN_CONNECTION_BASE_GET_PRIVATE (self)->specific_object;
}
void
nm_vpn_connection_base_export (NMVpnConnectionBase *self,
NMConnection *connection)
NMConnection *connection,
const char *specific_object)
{
NMVpnConnectionBasePrivate *priv = NM_VPN_CONNECTION_BASE_GET_PRIVATE (self);
NMDBusManager *dbus_mgr;
@ -101,6 +109,7 @@ nm_vpn_connection_base_export (NMVpnConnectionBase *self,
g_return_if_fail (priv->connection == NULL);
priv->connection = g_object_ref (connection);
priv->specific_object = g_strdup (specific_object);
dbus_mgr = nm_dbus_manager_get ();
dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr),
@ -128,6 +137,7 @@ dispose (GObject *object)
priv->disposed = TRUE;
g_free (priv->ac_path);
g_free (priv->specific_object);
g_object_unref (priv->connection);
}
@ -148,7 +158,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_boxed (value, nm_connection_get_uuid (priv->connection));
break;
case PROP_SPECIFIC_OBJECT:
g_value_set_boxed (value, priv->ac_path);
g_value_set_boxed (value, priv->specific_object);
break;
case PROP_DEVICES:
g_value_take_boxed (value, g_ptr_array_new ());

View file

@ -44,8 +44,11 @@ GType nm_vpn_connection_base_get_type (void);
const char *nm_vpn_connection_base_get_ac_path (NMVpnConnectionBase *self);
const char *nm_vpn_connection_base_get_specific_object (NMVpnConnectionBase *self);
void nm_vpn_connection_base_export (NMVpnConnectionBase *self,
NMConnection *connection);
NMConnection *connection,
const char *specific_object);
void nm_vpn_connection_base_set_state (NMVpnConnectionBase *self,
NMVPNConnectionState vpn_state);

View file

@ -221,6 +221,7 @@ device_ip4_config_changed (NMDevice *device,
NMVPNConnection *
nm_vpn_connection_new (NMConnection *connection,
NMDevice *parent_device,
const char *specific_object,
gboolean user_requested,
gulong user_uid)
{
@ -249,7 +250,7 @@ nm_vpn_connection_new (NMConnection *connection,
G_CALLBACK (device_ip4_config_changed),
self);
nm_vpn_connection_base_export (NM_VPN_CONNECTION_BASE (self), connection);
nm_vpn_connection_base_export (NM_VPN_CONNECTION_BASE (self), connection, specific_object);
return self;
}

View file

@ -57,12 +57,14 @@ GType nm_vpn_connection_get_type (void);
NMVPNConnection * nm_vpn_connection_new (NMConnection *connection,
NMDevice *parent_device,
const char *specific_object,
gboolean user_requested,
gulong user_uid);
void nm_vpn_connection_activate (NMVPNConnection *connection);
NMConnection * nm_vpn_connection_get_connection (NMVPNConnection *connection);
const char * nm_vpn_connection_get_active_connection_path (NMVPNConnection *connection);
const char * nm_vpn_connection_get_specific_object_path (NMVPNConnection *connection);
const char * nm_vpn_connection_get_name (NMVPNConnection *connection);
NMVPNConnectionState nm_vpn_connection_get_vpn_state (NMVPNConnection *connection);
const char * nm_vpn_connection_get_banner (NMVPNConnection *connection);

View file

@ -162,6 +162,7 @@ NMVPNConnection *
nm_vpn_manager_activate_connection (NMVPNManager *manager,
NMConnection *connection,
NMDevice *device,
const char *specific_object,
gboolean user_requested,
gulong user_uid,
GError **error)
@ -209,7 +210,7 @@ nm_vpn_manager_activate_connection (NMVPNManager *manager,
return NULL;
}
vpn = nm_vpn_service_activate (service, connection, device, user_requested, user_uid, error);
vpn = nm_vpn_service_activate (service, connection, device, specific_object, user_requested, user_uid, error);
if (vpn) {
g_signal_connect (vpn, "vpn-state-changed",
G_CALLBACK (connection_vpn_state_changed),

View file

@ -69,6 +69,7 @@ NMVPNManager *nm_vpn_manager_get (void);
NMVPNConnection *nm_vpn_manager_activate_connection (NMVPNManager *manager,
NMConnection *connection,
NMDevice *device,
const char *specific_object,
gboolean user_requested,
gulong user_uid,
GError **error);

View file

@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2005 - 2010 Red Hat, Inc.
* Copyright (C) 2005 - 2011 Red Hat, Inc.
* Copyright (C) 2005 - 2008 Novell, Inc.
*/
@ -324,6 +324,7 @@ NMVPNConnection *
nm_vpn_service_activate (NMVPNService *service,
NMConnection *connection,
NMDevice *device,
const char *specific_object,
gboolean user_requested,
gulong user_uid,
GError **error)
@ -341,7 +342,7 @@ nm_vpn_service_activate (NMVPNService *service,
clear_quit_timeout (service);
vpn = nm_vpn_connection_new (connection, device, user_requested, user_uid);
vpn = nm_vpn_connection_new (connection, device, specific_object, user_requested, user_uid);
g_signal_connect (vpn, "vpn-state-changed",
G_CALLBACK (connection_vpn_state_changed),
service);

View file

@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2005 - 2008 Red Hat, Inc.
* Copyright (C) 2005 - 2011 Red Hat, Inc.
* Copyright (C) 2005 - 2008 Novell, Inc.
*/
@ -57,6 +57,7 @@ const char *nm_vpn_service_get_name_file (NMVPNService *service);
NMVPNConnection * nm_vpn_service_activate (NMVPNService *service,
NMConnection *connection,
NMDevice *device,
const char *specific_object,
gboolean user_requested,
gulong user_uid,
GError **error);