redirect-manager: Verify type of returned gateway ID

This commit is contained in:
Tobias Brunner
2016-03-04 16:02:58 +01:00
parent 10009b2954
commit fa5cfbdcbf
+12 -1
View File
@@ -75,7 +75,18 @@ static bool should_redirect(private_redirect_manager_t *this, ike_sa_t *ike_sa,
bool (**method)(void*,ike_sa_t*,identification_t**) = provider + offset;
if (*method && (*method)(provider, ike_sa, gateway))
{
redirect = TRUE;
switch (*gateway ? (*gateway)->get_type(*gateway) : 0)
{
case ID_IPV4_ADDR:
case ID_IPV6_ADDR:
case ID_FQDN:
redirect = TRUE;
break;
default:
DBG1(DBG_CFG, "redirect provider returned invalid gateway");
DESTROY_IF(*gateway);
continue;
}
break;
}
}