Commit 899b8a40 authored by Dan Williams's avatar Dan Williams

libnm-util: NM_SETTING_SECRET_FLAG_SYSTEM_OWNED -> NM_SETTING_SECRET_FLAG_NONE

Make it a bit clearer that this value is not actually a value that
can be used as a flag, since its 0x00.
parent 382cdfaf
......@@ -1149,7 +1149,7 @@ nm_setting_802_1x_get_password (NMSetting8021x *setting)
NMSettingSecretFlags
nm_setting_802_1x_get_password_flags (NMSetting8021x *setting)
{
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_802_1X_GET_PRIVATE (setting)->password_flags;
}
......@@ -1179,7 +1179,7 @@ nm_setting_802_1x_get_pin (NMSetting8021x *setting)
NMSettingSecretFlags
nm_setting_802_1x_get_pin_flags (NMSetting8021x *setting)
{
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_802_1X_GET_PRIVATE (setting)->pin_flags;
}
......@@ -1434,7 +1434,7 @@ nm_setting_802_1x_get_private_key_password (NMSetting8021x *setting)
NMSettingSecretFlags
nm_setting_802_1x_get_private_key_password_flags (NMSetting8021x *setting)
{
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_802_1X_GET_PRIVATE (setting)->private_key_password_flags;
}
......@@ -1508,7 +1508,7 @@ nm_setting_802_1x_get_phase2_private_key_password (NMSetting8021x *setting)
NMSettingSecretFlags
nm_setting_802_1x_get_phase2_private_key_password_flags (NMSetting8021x *setting)
{
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_802_1X_GET_PRIVATE (setting)->phase2_private_key_password_flags;
}
......@@ -2975,9 +2975,9 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_FLAGS,
"Password Flags",
"Flags indicating how to handle the 802.1x password.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......@@ -3059,9 +3059,9 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
"Private Key Password Flags",
"Flags indicating how to handle the 802.1x private "
"key password.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......@@ -3141,9 +3141,9 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
"Phase2 Private Key Password Flags",
"Flags indicating how to handle the 802.1x phase2 "
"private key password.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......
......@@ -165,7 +165,7 @@ nm_setting_cdma_get_password (NMSettingCdma *setting)
NMSettingSecretFlags
nm_setting_cdma_get_password_flags (NMSettingCdma *setting)
{
g_return_val_if_fail (NM_IS_SETTING_CDMA (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_CDMA (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_CDMA_GET_PRIVATE (setting)->password_flags;
}
......@@ -393,8 +393,8 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class)
g_param_spec_uint (NM_SETTING_CDMA_PASSWORD_FLAGS,
"Password Flags",
"Flags indicating how to handle the CDMA password.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
}
......@@ -152,7 +152,7 @@ nm_setting_gsm_get_password (NMSettingGsm *setting)
NMSettingSecretFlags
nm_setting_gsm_get_password_flags (NMSettingGsm *setting)
{
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_GSM_GET_PRIVATE (setting)->password_flags;
}
......@@ -206,7 +206,7 @@ nm_setting_gsm_get_pin (NMSettingGsm *setting)
NMSettingSecretFlags
nm_setting_gsm_get_pin_flags (NMSettingGsm *setting)
{
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_GSM_GET_PRIVATE (setting)->pin_flags;
}
......@@ -540,9 +540,9 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
g_param_spec_uint (NM_SETTING_GSM_PASSWORD_FLAGS,
"Password Flags",
"Flags indicating how to handle the GSM password.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......@@ -673,9 +673,9 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
g_param_spec_uint (NM_SETTING_GSM_PIN_FLAGS,
"PIN Flags",
"Flags indicating how to handle the GSM SIM PIN.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......
......@@ -124,7 +124,7 @@ nm_setting_pppoe_get_password (NMSettingPPPOE *setting)
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);
g_return_val_if_fail (NM_IS_SETTING_PPPOE (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_PPPOE_GET_PRIVATE (setting)->password_flags;
}
......@@ -304,8 +304,8 @@ nm_setting_pppoe_class_init (NMSettingPPPOEClass *setting_class)
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_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
}
......@@ -22,7 +22,7 @@
#define NM_SETTING_PRIVATE_H
#define NM_SETTING_SECRET_FLAGS_ALL \
(NM_SETTING_SECRET_FLAG_SYSTEM_OWNED | \
(NM_SETTING_SECRET_FLAG_NONE | \
NM_SETTING_SECRET_FLAG_AGENT_OWNED | \
NM_SETTING_SECRET_FLAG_NOT_SAVED)
......
......@@ -18,7 +18,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* (C) Copyright 2007 - 2008 Red Hat, Inc.
* (C) Copyright 2007 - 2011 Red Hat, Inc.
* (C) Copyright 2007 - 2008 Novell, Inc.
*/
......
......@@ -366,7 +366,7 @@ nm_setting_wireless_security_get_psk (NMSettingWirelessSecurity *setting)
NMSettingSecretFlags
nm_setting_wireless_security_get_psk_flags (NMSettingWirelessSecurity *setting)
{
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting)->psk_flags;
}
......@@ -397,7 +397,7 @@ nm_setting_wireless_security_get_leap_password (NMSettingWirelessSecurity *setti
NMSettingSecretFlags
nm_setting_wireless_security_get_leap_password_flags (NMSettingWirelessSecurity *setting)
{
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting)->leap_password_flags;
}
......@@ -480,7 +480,7 @@ nm_setting_wireless_security_get_auth_alg (NMSettingWirelessSecurity *setting)
NMSettingSecretFlags
nm_setting_wireless_security_get_wep_key_flags (NMSettingWirelessSecurity *setting)
{
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), NM_SETTING_SECRET_FLAG_SYSTEM_OWNED);
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), NM_SETTING_SECRET_FLAG_NONE);
return NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting)->wep_key_flags;
}
......@@ -1277,9 +1277,9 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS,
"WEP Key Flags",
"Flags indicating how to handle the WEP keys.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......@@ -1316,9 +1316,9 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS,
"PSK Flags",
"Flags indicating how to handle the WPA PSK key.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......@@ -1345,9 +1345,9 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS,
"LEAP Password Flags",
"Flags indicating how to handle the LEAP password.",
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
NM_SETTING_SECRET_FLAGS_ALL,
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED,
NM_SETTING_SECRET_FLAG_NONE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/**
......
......@@ -602,7 +602,7 @@ get_secret_flags (NMSetting *setting,
GError **error)
{
char *flags_prop;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
if (verify_secret)
g_return_val_if_fail (is_secret_prop (setting, secret_name, error), FALSE);
......@@ -682,7 +682,7 @@ nm_setting_set_secret_flags (NMSetting *setting,
g_return_val_if_fail (setting != NULL, FALSE);
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
g_return_val_if_fail (secret_name != NULL, FALSE);
g_return_val_if_fail (flags & NM_SETTING_SECRET_FLAGS_ALL, FALSE);
g_return_val_if_fail (flags <= NM_SETTING_SECRET_FLAGS_ALL, FALSE);
return NM_SETTING_GET_CLASS (setting)->set_secret_flags (setting, secret_name, TRUE, flags, error);
}
......
......@@ -85,8 +85,8 @@ GQuark nm_setting_error_quark (void);
/**
* NMSettingSecretFlags:
* @NM_SETTING_SECRET_FLAG_SYTSEM_OWNED: the system is responsible for providing
* and storing this secret (default)
* @NM_SETTING_SECRET_FLAG_NONE: the system is responsible for providing and
* storing this secret (default)
* @NM_SETTING_SECRET_FLAG_AGENT_OWNED: a user secret agent is responsible
* for providing and storing this secret; when it is required agents will be
* asked to retrieve it
......@@ -99,7 +99,7 @@ GQuark nm_setting_error_quark (void);
*
**/
typedef enum {
NM_SETTING_SECRET_FLAG_SYSTEM_OWNED = 0x00000000,
NM_SETTING_SECRET_FLAG_NONE = 0x00000000,
NM_SETTING_SECRET_FLAG_AGENT_OWNED = 0x00000001,
NM_SETTING_SECRET_FLAG_NOT_SAVED = 0x00000002
......
......@@ -748,12 +748,12 @@ has_system_secrets (NMSetting *setting,
GParamFlags flags,
gpointer user_data)
{
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
gboolean *has_system = user_data;
if (flags & NM_SETTING_PARAM_SECRET) {
nm_setting_get_secret_flags (setting, key, &secret_flags, NULL);
if (secret_flags == NM_SETTING_SECRET_FLAG_SYSTEM_OWNED)
if (!(secret_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED))
*has_system = TRUE;
}
}
......
......@@ -358,11 +358,11 @@ typedef gboolean (*ForEachSecretFunc) (GHashTableIter *iter,
gpointer user_data);
static gboolean
clear_system_owned_secrets (GHashTableIter *iter,
NMSettingSecretFlags flags,
gpointer user_data)
clear_nonagent_secrets (GHashTableIter *iter,
NMSettingSecretFlags flags,
gpointer user_data)
{
if (flags == NM_SETTING_SECRET_FLAG_SYSTEM_OWNED)
if (flags != NM_SETTING_SECRET_FLAG_AGENT_OWNED)
g_hash_table_iter_remove (iter);
return TRUE;
}
......@@ -374,7 +374,7 @@ has_system_owned_secrets (GHashTableIter *iter,
{
gboolean *has_system_owned = user_data;
if (flags == NM_SETTING_SECRET_FLAG_SYSTEM_OWNED) {
if (!(flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)) {
*has_system_owned = TRUE;
return FALSE;
}
......@@ -403,7 +403,7 @@ for_each_secret (NMConnection *connection,
g_hash_table_iter_init (&setting_iter, setting_hash);
while (g_hash_table_iter_next (&setting_iter, (gpointer *) &secret_name, NULL)) {
NMSetting *setting;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
/* Get the actual NMSetting from the connection so we can get secret flags */
setting = nm_connection_get_setting_by_name (connection, setting_name);
......@@ -499,7 +499,7 @@ agent_secrets_done_cb (NMAgentManager *manager,
call_id,
agent_dbus_owner);
for_each_secret (NM_CONNECTION (self), secrets, clear_system_owned_secrets, NULL);
for_each_secret (NM_CONNECTION (self), secrets, clear_nonagent_secrets, NULL);
} else if (agent_has_modify == FALSE) {
/* Agent didn't successfully authenticate; clear system-owned secrets
* from the secrets the agent returned.
......@@ -509,7 +509,7 @@ agent_secrets_done_cb (NMAgentManager *manager,
setting_name,
call_id);
for_each_secret (NM_CONNECTION (self), secrets, clear_system_owned_secrets, NULL);
for_each_secret (NM_CONNECTION (self), secrets, clear_nonagent_secrets, NULL);
}
}
} else {
......@@ -865,7 +865,7 @@ only_agent_secrets_cb (NMSetting *setting,
gpointer user_data)
{
if (flags & NM_SETTING_PARAM_SECRET) {
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
/* Clear out system-owned or always-ask secrets */
nm_setting_get_secret_flags (setting, key, &secret_flags, NULL);
......
......@@ -69,7 +69,7 @@ set_secret (shvarFile *ifcfg,
svSetValue (keyfile, key, NULL, FALSE);
/* Only write the secret if it's system owned */
if (flags == NM_SETTING_SECRET_FLAG_SYSTEM_OWNED)
if (flags == NM_SETTING_SECRET_FLAG_NONE)
svSetValue (keyfile, key, value, verbatim);
if (svWriteFile (keyfile, 0600)) {
......@@ -349,7 +349,7 @@ write_8021x_certs (NMSetting8021x *s_8021x,
gboolean success = FALSE, is_pkcs12 = FALSE;
const ObjectType *otype = NULL;
const GByteArray *blob = NULL;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
/* CA certificate */
if (phase2)
......@@ -397,7 +397,7 @@ write_8021x_certs (NMSetting8021x *s_8021x,
if (generated_pw) {
password = generated_pw;
flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
flags = NM_SETTING_SECRET_FLAG_NONE;
}
}
......@@ -600,16 +600,16 @@ write_wireless_security_setting (NMConnection *connection,
/* WEP keys */
/* Clear any default key */
set_secret (ifcfg, "KEY", NULL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, FALSE);
set_secret (ifcfg, "KEY", NULL, NM_SETTING_SECRET_FLAG_NONE, FALSE);
/* Clear existing keys */
for (i = 0; i < 4; i++) {
tmp = g_strdup_printf ("KEY_PASSPHRASE%d", i + 1);
set_secret (ifcfg, tmp, NULL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, FALSE);
set_secret (ifcfg, tmp, NULL, NM_SETTING_SECRET_FLAG_NONE, FALSE);
g_free (tmp);
tmp = g_strdup_printf ("KEY%d", i + 1);
set_secret (ifcfg, tmp, NULL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, FALSE);
set_secret (ifcfg, tmp, NULL, NM_SETTING_SECRET_FLAG_NONE, FALSE);
g_free (tmp);
}
......@@ -715,7 +715,7 @@ write_wireless_security_setting (NMConnection *connection,
if (quoted)
g_string_free (quoted, TRUE);
} else
set_secret (ifcfg, "WPA_PSK", NULL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, FALSE);
set_secret (ifcfg, "WPA_PSK", NULL, NM_SETTING_SECRET_FLAG_NONE, FALSE);
return TRUE;
}
......
......@@ -564,7 +564,7 @@ write_setting_value (NMSetting *setting,
GType type = G_VALUE_TYPE (value);
KeyWriter *writer = &key_writers[0];
GParamSpec *pspec;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_SYSTEM_OWNED;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
/* Setting name gets picked up from the keyfile's section name instead */
if (!strcmp (key, NM_SETTING_NAME))
......@@ -591,7 +591,7 @@ write_setting_value (NMSetting *setting,
*/
if ( (pspec->flags & NM_SETTING_PARAM_SECRET)
&& nm_setting_get_secret_flags (setting, key, &flags, NULL)
&& (flags != NM_SETTING_SECRET_FLAG_SYSTEM_OWNED))
&& (flags != NM_SETTING_SECRET_FLAG_NONE))
return;
/* Look through the list of handlers for non-standard format key values */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment