diff options
author | Thomas Haller <thaller@redhat.com> | 2016-06-20 19:02:40 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-06-20 19:02:40 +0200 |
commit | 7e0660bf073671f2eb9d86338c41019572800044 (patch) | |
tree | cdf11a8db7fb8dc321e5e081406f03ff649de432 | |
parent | 59269b6925e9947b4c11f1548ba1593dd4aa5371 (diff) | |
download | NetworkManager-7e0660bf073671f2eb9d86338c41019572800044.tar.gz |
clients,vpn: only accept full service-types in nm_vpn_get_secret_names()
nm_vpn_get_secret_names() has only one caller, which passes
nm_setting_vpn_get_service_type() as @vpn_type argument. That
argument is not a short-name or abbreviation, it must be the
full service-type.
For our well-known, hard-coded list of service-types, all must
start with the same prefix.
-rw-r--r-- | clients/common/nm-vpn-helpers.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c index f2e6f4a662..142a106dca 100644 --- a/clients/common/nm-vpn-helpers.c +++ b/clients/common/nm-vpn-helpers.c @@ -135,11 +135,13 @@ nm_vpn_get_secret_names (const char *vpn_type) if (!vpn_type) return NULL; - if (g_str_has_prefix (vpn_type, NM_DBUS_INTERFACE)) - type = vpn_type + strlen (NM_DBUS_INTERFACE) + 1; - else - type = vpn_type; + if ( !g_str_has_prefix (vpn_type, NM_DBUS_INTERFACE) + || vpn_type[NM_STRLEN (NM_DBUS_INTERFACE)] != '.') { + /* all our well-known, hard-coded vpn-types start with NM_DBUS_INTERFACE. */ + return NULL; + } + type = vpn_type + (NM_STRLEN (NM_DBUS_INTERFACE) + 1); if ( !g_strcmp0 (type, "pptp") || !g_strcmp0 (type, "iodine") || !g_strcmp0 (type, "ssh") |