diff options
author | Dan Williams <dcbw@redhat.com> | 2011-01-29 13:34:24 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-01-29 13:34:24 -0600 |
commit | 5a7cf39a62442df3747dda304fb41df3b9587837 (patch) | |
tree | b1ce90d236b5b37fe2c3341d55bc21f9843a32be /libnm-util/nm-setting-pppoe.c | |
parent | 12908c8a1a71b0fde1bd8aed160244c01b979865 (diff) | |
download | NetworkManager-5a7cf39a62442df3747dda304fb41df3b9587837.tar.gz |
libnm-util: add secret flags for each secret describing how the secret is stored
This allows the necessary flexibility when handling secrets; otherwise
it wouldn't be known when NM should save secrets returned from agents
to backing storage, or when the agents should store the secrets. We
can't simply use lack of a secret in persistent storage as the indicator
of this, as (for example) when creating a new connection without
secrets the storage method would be abmiguous.
At the same time, fold in "always ask" functionality for OTP tokens
so user agents don't have to store that attribute themselves out-of-band.
Diffstat (limited to 'libnm-util/nm-setting-pppoe.c')
-rw-r--r-- | libnm-util/nm-setting-pppoe.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/libnm-util/nm-setting-pppoe.c b/libnm-util/nm-setting-pppoe.c index d1aba43d30..e03f00c04e 100644 --- a/libnm-util/nm-setting-pppoe.c +++ b/libnm-util/nm-setting-pppoe.c @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * (C) Copyright 2007 - 2011 Red Hat, Inc. * (C) Copyright 2007 - 2008 Novell, Inc. */ @@ -71,6 +71,7 @@ typedef struct { char *service; char *username; char *password; + NMSettingSecretFlags password_flags; } NMSettingPPPOEPrivate; enum { @@ -78,6 +79,7 @@ enum { PROP_SERVICE, PROP_USERNAME, PROP_PASSWORD, + PROP_PASSWORD_FLAGS, LAST_PROP }; @@ -112,6 +114,20 @@ nm_setting_pppoe_get_password (NMSettingPPPOE *setting) return NM_SETTING_PPPOE_GET_PRIVATE (setting)->password; } +/** + * nm_setting_pppoe_get_password_flags: + * @setting: the #NMSettingPPPOE + * + * Returns: the #NMSettingSecretFlags pertaining to the #NMSettingPPPOE:password + **/ +NMSettingSecretFlags +nm_setting_pppoe_get_password_flags (NMSettingPPPOE *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_PPPOE (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED); + + return NM_SETTING_PPPOE_GET_PRIVATE (setting)->password_flags; +} + static gboolean verify (NMSetting *setting, GSList *all_settings, GError **error) { @@ -182,6 +198,9 @@ set_property (GObject *object, guint prop_id, g_free (priv->password); priv->password = g_value_dup_string (value); break; + case PROP_PASSWORD_FLAGS: + priv->password_flags = g_value_get_uint (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -204,6 +223,9 @@ get_property (GObject *object, guint prop_id, case PROP_PASSWORD: g_value_set_string (value, nm_setting_pppoe_get_password (setting)); break; + case PROP_PASSWORD_FLAGS: + g_value_set_uint (value, nm_setting_pppoe_get_password_flags (setting)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -271,4 +293,18 @@ nm_setting_pppoe_class_init (NMSettingPPPOEClass *setting_class) "Password used to authenticate with the PPPoE service.", NULL, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE | NM_SETTING_PARAM_SECRET)); + + /** + * NMSettingPPPOE:password-flags: + * + * Flags indicating how to handle #NMSettingPPPOE:password:. + **/ + g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_PPPOE_PASSWORD_FLAGS, + "Password Flags", + "Flags indicating how to handle the PPPoE password.", + NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, + NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); } |