summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-08-13 01:46:53 +0200
committerThomas Haller <thaller@redhat.com>2014-08-19 00:13:11 +0200
commit25aa0a0705b2acb01c24d974a66c507cdad91720 (patch)
tree122410ec15659e2e3d3fc3f5b5913019b8c4a224
parent645ab39bb65eabf3d75871e4f86c240a29363199 (diff)
downloadNetworkManager-25aa0a0705b2acb01c24d974a66c507cdad91720.tar.gz
libnm-core: fix crash in NMSettingAdsl:verify()
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--libnm-core/nm-setting-adsl.c14
-rw-r--r--libnm-util/nm-setting-adsl.c14
-rw-r--r--src/devices/adsl/nm-device-adsl.c2
-rw-r--r--src/ppp-manager/nm-ppp-manager.c2
4 files changed, 18 insertions, 14 deletions
diff --git a/libnm-core/nm-setting-adsl.c b/libnm-core/nm-setting-adsl.c
index 65bece0277..f6f11e0c54 100644
--- a/libnm-core/nm-setting-adsl.c
+++ b/libnm-core/nm-setting-adsl.c
@@ -225,20 +225,22 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
return FALSE;
}
- if (strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) &&
- strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) &&
- strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM)) {
+ if ( !priv->protocol
+ || ( strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA)
+ && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE)
+ && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM))){
g_set_error (error,
NM_SETTING_ADSL_ERROR,
NM_SETTING_ADSL_ERROR_INVALID_PROPERTY,
_("'%s' is not a valid value for the property"),
- priv->protocol);
+ priv->protocol ? priv->protocol : "(null)");
g_prefix_error (error, "%s.%s: ", NM_SETTING_ADSL_SETTING_NAME, NM_SETTING_ADSL_PROTOCOL);
return FALSE;
}
- if (strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) &&
- strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) ) {
+ if ( priv->encapsulation
+ && ( strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX)
+ && strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) )) {
g_set_error (error,
NM_SETTING_ADSL_ERROR,
NM_SETTING_ADSL_ERROR_INVALID_PROPERTY,
diff --git a/libnm-util/nm-setting-adsl.c b/libnm-util/nm-setting-adsl.c
index 0a8eba7c0d..76fa63b910 100644
--- a/libnm-util/nm-setting-adsl.c
+++ b/libnm-util/nm-setting-adsl.c
@@ -226,20 +226,22 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
return FALSE;
}
- if (strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) &&
- strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) &&
- strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM)) {
+ if ( !priv->protocol
+ || ( strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA)
+ && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE)
+ && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM))){
g_set_error (error,
NM_SETTING_ADSL_ERROR,
NM_SETTING_ADSL_ERROR_INVALID_PROPERTY,
_("'%s' is not a valid value for the property"),
- priv->protocol);
+ priv->protocol ? priv->protocol : "(null)");
g_prefix_error (error, "%s.%s: ", NM_SETTING_ADSL_SETTING_NAME, NM_SETTING_ADSL_PROTOCOL);
return FALSE;
}
- if (strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) &&
- strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) ) {
+ if ( priv->encapsulation
+ && ( strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX)
+ && strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) )) {
g_set_error (error,
NM_SETTING_ADSL_ERROR,
NM_SETTING_ADSL_ERROR_INVALID_PROPERTY,
diff --git a/src/devices/adsl/nm-device-adsl.c b/src/devices/adsl/nm-device-adsl.c
index 6fc51e61c4..d9f9006e78 100644
--- a/src/devices/adsl/nm-device-adsl.c
+++ b/src/devices/adsl/nm-device-adsl.c
@@ -257,7 +257,7 @@ br2684_assign_vcc (NMDeviceAdsl *self, NMSettingAdsl *s_adsl)
_LOGD (LOGD_ADSL, "assigning address %d.%d.%d encapsulation %s",
priv->atm_index, addr.sap_addr.vpi, addr.sap_addr.vci,
- encapsulation);
+ encapsulation ? encapsulation : "(none)");
err = connect (priv->brfd, (struct sockaddr*) &addr, sizeof (addr));
if (err != 0) {
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 55f9b41769..2c9d1c3d04 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -992,7 +992,7 @@ create_pppd_cmd_line (NMPPPManager *self,
if (g_strcmp0 (encaps, NM_SETTING_ADSL_ENCAPSULATION_LLC) == 0)
nm_cmd_line_add_string (cmd, "llc-encaps");
- else if (g_strcmp0 (encaps, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) == 0)
+ else /*if (g_strcmp0 (encaps, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) == 0)*/
nm_cmd_line_add_string (cmd, "vc-encaps");
} else if (!strcmp (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE)) {