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.
This commit is contained in:
Thomas Haller 2019-07-18 15:42:30 +02:00
parent 3a6f651a98
commit b0cb2966ed
2 changed files with 2 additions and 2 deletions

View file

@ -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;
}

View file

@ -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);