Commit eec907b3 authored by Thomas Haller's avatar Thomas Haller

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.
parent 25906eda
......@@ -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) {
......
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