clients: cleanup nm_vpn_get_secret_names() to use NM_IN_STRSET()

This commit is contained in:
Thomas Haller
2020-04-29 15:55:53 +02:00
parent 12a54a44f8
commit 5238b8dde7

View File

@@ -137,28 +137,28 @@ nm_vpn_get_secret_names (const char *service_type)
if (!service_type) if (!service_type)
return NULL; return NULL;
if ( !g_str_has_prefix (service_type, NM_DBUS_INTERFACE) if ( !NM_STR_HAS_PREFIX (service_type, NM_DBUS_INTERFACE)
|| service_type[NM_STRLEN (NM_DBUS_INTERFACE)] != '.') { || service_type[NM_STRLEN (NM_DBUS_INTERFACE)] != '.') {
/* all our well-known, hard-coded vpn-types start with NM_DBUS_INTERFACE. */ /* all our well-known, hard-coded vpn-types start with NM_DBUS_INTERFACE. */
return NULL; return NULL;
} }
type = service_type + (NM_STRLEN (NM_DBUS_INTERFACE) + 1); type = service_type + (NM_STRLEN (NM_DBUS_INTERFACE) + 1);
if ( !g_strcmp0 (type, "pptp") if (NM_IN_STRSET (type, "pptp",
|| !g_strcmp0 (type, "iodine") "iodine",
|| !g_strcmp0 (type, "ssh") "ssh",
|| !g_strcmp0 (type, "l2tp") "l2tp",
|| !g_strcmp0 (type, "fortisslvpn")) "fortisslvpn"))
return generic_vpn_secrets; return generic_vpn_secrets;
else if (!g_strcmp0 (type, "openvpn")) if (NM_IN_STRSET (type, "openvpn"))
return openvpn_secrets; return openvpn_secrets;
else if (!g_strcmp0 (type, "vpnc")) if (NM_IN_STRSET (type, "vpnc"))
return vpnc_secrets; return vpnc_secrets;
else if ( !g_strcmp0 (type, "openswan") if (NM_IN_STRSET (type, "openswan",
|| !g_strcmp0 (type, "libreswan") "libreswan",
|| !g_strcmp0 (type, "strongswan")) "strongswan"))
return swan_secrets; return swan_secrets;
else if (!g_strcmp0 (type, "openconnect")) if (NM_IN_STRSET (type, "openconnect"))
return openconnect_secrets; return openconnect_secrets;
return NULL; return NULL;
} }