diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index 15cf6126cc..395775213a 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -34,7 +34,8 @@ libnm_util_include_HEADERS = \ libnm_util_la_private_headers = \ crypto.h \ nm-param-spec-specialized.h \ - nm-utils-private.h + nm-utils-private.h \ + nm-setting-private.h libnm_util_la_csources = \ crypto.c \ diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c index f290104940..341b60a534 100644 --- a/libnm-util/nm-setting-8021x.c +++ b/libnm-util/nm-setting-8021x.c @@ -32,6 +32,7 @@ #include "nm-dbus-glib-types.h" #include "crypto.h" #include "nm-utils-private.h" +#include "nm-setting-private.h" /** * SECTION:nm-setting-8021x @@ -2955,7 +2956,7 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) "Password Flags", "Flags indicating how to handle the 802.1x password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); @@ -3039,7 +3040,7 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) "Flags indicating how to handle the 802.1x private " "key password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); @@ -3121,7 +3122,7 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) "Flags indicating how to handle the 802.1x phase2 " "private key password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); diff --git a/libnm-util/nm-setting-cdma.c b/libnm-util/nm-setting-cdma.c index bcd78ec2f7..1fd800d8b2 100644 --- a/libnm-util/nm-setting-cdma.c +++ b/libnm-util/nm-setting-cdma.c @@ -25,6 +25,7 @@ #include "nm-setting-cdma.h" #include "nm-setting-serial.h" #include "nm-utils.h" +#include "nm-setting-private.h" /** * SECTION:nm-setting-cdma @@ -393,7 +394,7 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class) "Password Flags", "Flags indicating how to handle the CDMA password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); } diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c index 7cb3c790a7..f0bdfee83a 100644 --- a/libnm-util/nm-setting-gsm.c +++ b/libnm-util/nm-setting-gsm.c @@ -28,6 +28,7 @@ #include "nm-setting-gsm.h" #include "nm-setting-serial.h" #include "nm-utils.h" +#include "nm-setting-private.h" GQuark nm_setting_gsm_error_quark (void) @@ -540,7 +541,7 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) "Password Flags", "Flags indicating how to handle the GSM password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); @@ -673,7 +674,7 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) "PIN Flags", "Flags indicating how to handle the GSM SIM PIN.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); diff --git a/libnm-util/nm-setting-pppoe.c b/libnm-util/nm-setting-pppoe.c index e03f00c04e..ee82d8e507 100644 --- a/libnm-util/nm-setting-pppoe.c +++ b/libnm-util/nm-setting-pppoe.c @@ -26,6 +26,7 @@ #include #include "nm-setting-pppoe.h" #include "nm-setting-ppp.h" +#include "nm-setting-private.h" GQuark nm_setting_pppoe_error_quark (void) @@ -304,7 +305,7 @@ nm_setting_pppoe_class_init (NMSettingPPPOEClass *setting_class) "Password Flags", "Flags indicating how to handle the PPPoE password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); } diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h new file mode 100644 index 0000000000..0c1b0e7a08 --- /dev/null +++ b/libnm-util/nm-setting-private.h @@ -0,0 +1,30 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * (C) Copyright 2011 Red Hat, Inc. + */ + +#ifndef NM_SETTING_PRIVATE_H +#define NM_SETTING_PRIVATE_H + +#define NM_SETTING_SECRET_FLAGS_ALL \ + (NM_SETTING_SECRET_FLAG_SYSTEM_OWNED | \ + NM_SETTING_SECRET_FLAG_AGENT_OWNED | \ + NM_SETTING_SECRET_FLAG_NOT_SAVED) + +#endif /* NM_SETTING_PRIVATE_H */ + diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c index fb3e58b448..87e58182ff 100644 --- a/libnm-util/nm-setting-vpn.c +++ b/libnm-util/nm-setting-vpn.c @@ -30,6 +30,7 @@ #include "nm-param-spec-specialized.h" #include "nm-utils.h" #include "nm-dbus-glib-types.h" +#include "nm-setting-private.h" GQuark nm_setting_vpn_error_quark (void) @@ -263,7 +264,7 @@ nm_setting_vpn_get_secret_flags (NMSettingVPN *setting, &val)) { errno = 0; tmp = strtoul ((const char *) val, NULL, 10); - if ((errno == 0) && (tmp <= NM_SETTING_SECRET_FLAG_LAST)) { + if ((errno == 0) && (tmp <= NM_SETTING_SECRET_FLAGS_ALL)) { success = TRUE; *out_flags = (guint32) tmp; } @@ -482,7 +483,7 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) * * D-Bus service name of the VPN plugin that this setting uses to connect * to its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc - * plugin. + * plugin. **/ g_object_class_install_property (object_class, PROP_SERVICE_TYPE, diff --git a/libnm-util/nm-setting-wireless-security.c b/libnm-util/nm-setting-wireless-security.c index 9165226469..b31f85ad5f 100644 --- a/libnm-util/nm-setting-wireless-security.c +++ b/libnm-util/nm-setting-wireless-security.c @@ -33,6 +33,7 @@ #include "nm-utils.h" #include "nm-dbus-glib-types.h" #include "nm-utils-private.h" +#include "nm-setting-private.h" GQuark nm_setting_wireless_security_error_quark (void) @@ -1223,7 +1224,7 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting "WEP Key Flags", "Flags indicating how to handle the WEP keys.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); @@ -1262,7 +1263,7 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting "PSK Flags", "Flags indicating how to handle the WPA PSK key.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); @@ -1291,7 +1292,7 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting "LEAP Password Flags", "Flags indicating how to handle the LEAP password.", NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, - NM_SETTING_SECRET_FLAG_LAST, + NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_SYSTEM_OWNED, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index e274504828..8d4b295fa4 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -19,13 +19,14 @@ * 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. */ #include #include "nm-setting.h" +#include "nm-setting-private.h" #include "nm-setting-connection.h" #include "nm-utils.h" diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h index 9079213585..2790d8b5aa 100644 --- a/libnm-util/nm-setting.h +++ b/libnm-util/nm-setting.h @@ -204,10 +204,9 @@ char *nm_setting_to_string (NMSetting *setting); typedef enum { NM_SETTING_SECRET_FLAG_SYSTEM_OWNED = 0x00000000, NM_SETTING_SECRET_FLAG_AGENT_OWNED = 0x00000001, - NM_SETTING_SECRET_FLAG_NOT_SAVED = 0x00000002, + NM_SETTING_SECRET_FLAG_NOT_SAVED = 0x00000002 - /* Placeholder for bounds checking */ - NM_SETTING_SECRET_FLAG_LAST = NM_SETTING_SECRET_FLAG_NOT_SAVED, + /* NOTE: if adding flags, update nm-setting-private.h as well */ } NMSettingSecretFlags; void nm_setting_clear_secrets (NMSetting *setting);