summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-07-18 15:42:30 +0200
committerThomas Haller <thaller@redhat.com>2019-07-25 10:48:40 +0200
commitb0cb2966ed949ee21859194c695aa971f0002ddf (patch)
treea9fff563b9041c32550b24c6ba19ff954afb1e02
parent3a6f651a98992001047aea11f356cb7223cf1656 (diff)
downloadNetworkManager-b0cb2966ed949ee21859194c695aa971f0002ddf.tar.gz
ifcfg-rh: don't allow globbing for unhandled device specs
With plain "interface-name:$IFNAME" globbing is enabled. So this behaves wrong if there are special characters like '*' or '?'. Also, it behaves wrong if the first character of the interface name happens to be '='. Make an explicit match.
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index cf0994c323..900a3fc1de 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -5644,7 +5644,7 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg,
nm_clear_g_free (&value);
v = svGetValueStr (ifcfg, "DEVICE", &value);
if (v) {
- *out_spec = g_strdup_printf ("%s:"NM_MATCH_SPEC_INTERFACE_NAME_TAG"%s", type, v);
+ *out_spec = g_strdup_printf ("%s:"NM_MATCH_SPEC_INTERFACE_NAME_TAG"=%s", type, v);
return connection;
}
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 9792e20ecd..45e90b919c 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -721,7 +721,7 @@ test_read_unmanaged_unrecognized (void)
connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-nm-controlled-unrecognized",
NULL, NULL,
&unhandled_spec);
- g_assert_cmpstr (unhandled_spec, ==, "unmanaged:interface-name:ipoac0");
+ g_assert_cmpstr (unhandled_spec, ==, "unmanaged:interface-name:=ipoac0");
/* ===== CONNECTION SETTING ===== */
s_con = nm_connection_get_setting_connection (connection);