summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-12-15 12:11:53 +0100
committerThomas Haller <thaller@redhat.com>2018-01-08 14:28:53 +0100
commit7cdf06955f5f68ac4af4bb6ec31428b332bd933a (patch)
tree810e8cac090dcf19bb708ed0dfb9c2d267333407
parent20e79efd7c98794e0fde472d293f92c85d4139b2 (diff)
downloadNetworkManager-7cdf06955f5f68ac4af4bb6ec31428b332bd933a.tar.gz
libnm: verify value for connection.mdns
Also, keep the internal variable of type int. The only way to set the field is via the GObject property setter. At that point, don't yet cast the integer type to enum.
-rw-r--r--libnm-core/nm-setting-connection.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c
index ba5bf8bf55..015aa68648 100644
--- a/libnm-core/nm-setting-connection.c
+++ b/libnm-core/nm-setting-connection.c
@@ -81,7 +81,7 @@ typedef struct {
NMMetered metered;
NMSettingConnectionLldp lldp;
gint auth_retries;
- NMSettingConnectionMdns mdns;
+ int mdns;
} NMSettingConnectionPrivate;
enum {
@@ -1076,6 +1076,17 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
+ if ( priv->mdns < NM_SETTING_CONNECTION_MDNS_UNKNOWN
+ || priv->mdns > NM_SETTING_CONNECTION_MDNS_RESOLVE) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("mdns value %d is not valid"), priv->mdns);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME,
+ NM_SETTING_CONNECTION_MDNS);
+ return FALSE;
+ }
+
/* *** errors above here should be always fatal, below NORMALIZABLE_ERROR *** */
if (!priv->uuid) {