mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 18:24:49 +00:00
libnm-util: fix handling of secrets flags
It's a bitfield, not a single value. Update GObject property max accordingly.
This commit is contained in:
parent
f130089735
commit
562246cb80
|
@ -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 \
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <string.h>
|
||||
#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));
|
||||
}
|
||||
|
|
30
libnm-util/nm-setting-private.h
Normal file
30
libnm-util/nm-setting-private.h
Normal file
|
@ -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 */
|
||||
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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 <string.h>
|
||||
|
||||
#include "nm-setting.h"
|
||||
#include "nm-setting-private.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-utils.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);
|
||||
|
|
Loading…
Reference in a new issue