diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2014-12-11 11:15:01 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2014-12-11 11:18:23 +0100 |
commit | d9806a9cae11354014126d577f2dab9d9894e6ef (patch) | |
tree | 121cd344194a963481b29c49a07a9e92c3a7e97e | |
parent | 5849c97c0368d51ea35590736aaf40ee522fed0d (diff) | |
parent | 9a3cc60d9b7bf3dac8137d0b379246f5287c891e (diff) | |
download | NetworkManager-d9806a9cae11354014126d577f2dab9d9894e6ef.tar.gz |
core,cli,agent-mangager: merge branch 'lr/vpn-fixes'
Various VPN-related fixes.
https://bugzilla.gnome.org/show_bug.cgi?id=740525
-rw-r--r-- | clients/cli/settings.c | 14 | ||||
-rw-r--r-- | libnm-core/nm-dbus-interface.h | 5 | ||||
-rw-r--r-- | libnm/nm-secret-agent-old.c | 1 | ||||
-rw-r--r-- | src/settings/nm-agent-manager.c | 8 | ||||
-rw-r--r-- | src/settings/nm-secret-agent.c | 3 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.c | 9 |
6 files changed, 35 insertions, 5 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 4153e40428..7d2a46c8c9 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -497,13 +497,15 @@ NmcOutputField nmc_fields_setting_vpn[] = { SETTING_FIELD (NM_SETTING_VPN_USER_NAME, 12), /* 2 */ SETTING_FIELD (NM_SETTING_VPN_DATA, 30), /* 3 */ SETTING_FIELD (NM_SETTING_VPN_SECRETS, 15), /* 4 */ + SETTING_FIELD (NM_SETTING_VPN_PERSISTENT, 15), /* 5 */ {NULL, NULL, 0, NULL, FALSE, FALSE, 0} }; #define NMC_FIELDS_SETTING_VPN_ALL "name"","\ NM_SETTING_VPN_SERVICE_TYPE","\ NM_SETTING_VPN_USER_NAME","\ NM_SETTING_VPN_DATA","\ - NM_SETTING_VPN_SECRETS + NM_SETTING_VPN_SECRETS","\ + NM_SETTING_VPN_PERSISTENT #define NMC_FIELDS_SETTING_VPN_COMMON NMC_FIELDS_SETTING_VPN_ALL /* Available fields for NM_SETTING_WIMAX_SETTING_NAME */ @@ -1450,6 +1452,8 @@ nmc_property_vpn_get_secrets (NMSetting *setting) return g_string_free (secret_str, FALSE); } +DEFINE_GETTER (nmc_property_vpn_get_persistent, NM_SETTING_VPN_PERSISTENT) + /* --- NM_SETTING_WIMAX_SETTING_NAME property get functions --- */ DEFINE_GETTER (nmc_property_wimax_get_network_name, NM_SETTING_WIMAX_NETWORK_NAME) DEFINE_GETTER (nmc_property_wimax_get_mac_address, NM_SETTING_WIMAX_MAC_ADDRESS) @@ -5930,6 +5934,13 @@ nmc_properties_init (void) NULL, NULL, NULL); + nmc_add_prop_funcs (GLUE (VPN, PERSISTENT), + nmc_property_vpn_get_persistent, + nmc_property_set_bool, + NULL, + NULL, + NULL, + NULL); /* Add editable properties for NM_SETTING_WIMAX_SETTING_NAME */ nmc_add_prop_funcs (GLUE (WIMAX, NETWORK_NAME), @@ -7076,6 +7087,7 @@ setting_vpn_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboo set_val_str (arr, 2, nmc_property_vpn_get_user_name (setting)); set_val_str (arr, 3, nmc_property_vpn_get_data (setting)); set_val_str (arr, 4, GET_SECRET (secrets, setting, nmc_property_vpn_get_secrets)); + set_val_str (arr, 5, nmc_property_vpn_get_persistent (setting)); g_ptr_array_add (nmc->output_data, arr); print_data (nmc); /* Print all data */ diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h index ccf21ee14a..dd2b70a0dc 100644 --- a/libnm-core/nm-dbus-interface.h +++ b/libnm-core/nm-dbus-interface.h @@ -571,6 +571,8 @@ typedef enum { * results or carrier changes. * @NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM: Internal flag, not part of * the D-Bus API. + * @NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS: Internal flag, not part of + * the D-Bus API. * * #NMSecretAgentGetSecretsFlags values modify the behavior of a GetSecrets request. * @@ -583,7 +585,8 @@ typedef enum { /*< flags >*/ NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED = 0x4, /* Internal to NM; not part of the D-Bus API */ - NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM = 0x80000000 + NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM = 0x80000000, + NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS = 0x40000000, } NMSecretAgentGetSecretsFlags; /** diff --git a/libnm/nm-secret-agent-old.c b/libnm/nm-secret-agent-old.c index 9e116501b9..606c40999d 100644 --- a/libnm/nm-secret-agent-old.c +++ b/libnm/nm-secret-agent-old.c @@ -920,6 +920,7 @@ nm_secret_agent_old_get_secrets (NMSecretAgentOld *self, g_return_if_fail (setting_name != NULL); g_return_if_fail (strlen (setting_name) > 0); g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM)); + g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS)); g_return_if_fail (callback != NULL); NM_SECRET_AGENT_OLD_GET_CLASS (self)->get_secrets (self, diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 117fb2150a..cc4b1943ca 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -1107,7 +1107,13 @@ get_start (gpointer user_data) req, parent->detail, req->setting_name); /* We don't, so ask some agents for additional secrets */ - request_next_agent (parent); + if ( req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS + && !parent->pending) { + /* The request initiated from GetSecrets() via DBus, + * don't error out if any secrets are missing. */ + req_complete_success (parent, req->existing_secrets, NULL, NULL); + } else + request_next_agent (parent); } } g_variant_unref (secrets_dict); diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index 054e07a8c7..69a5cea226 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -299,8 +299,9 @@ nm_secret_agent_get_secrets (NMSecretAgent *self, hash = nm_utils_connection_dict_to_hash (dict); g_variant_unref (dict); - /* Mask off the private ONLY_SYSTEM flag if present */ + /* Mask off the private flags if present */ flags &= ~NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM; + flags &= ~NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS; r = request_new (self, nm_connection_get_path (connection), setting_name, callback, callback_data); r->call = dbus_g_proxy_begin_call_with_timeout (priv->proxy, diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 78a830bad6..529f4d8f4b 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -1229,6 +1229,12 @@ has_some_secrets_cb (NMSetting *setting, { GParamSpec *pspec; + if (NM_IS_SETTING_VPN (setting)) { + if (nm_setting_vpn_get_num_secrets (NM_SETTING_VPN(setting))) + *((gboolean *) user_data) = TRUE; + return; + } + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), key); if (pspec) { if ( (flags & NM_SETTING_PARAM_SECRET) @@ -1604,7 +1610,8 @@ dbus_get_secrets_auth_cb (NMSettingsConnection *self, call_id = nm_settings_connection_get_secrets (self, subject, setting_name, - NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED, + NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED + | NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS, NULL, dbus_get_agent_secrets_cb, context, |