mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-06 00:00:47 -04:00
nm: Enforce min. length for PSKs in backend
This commit is contained in:
parent
2b63883dba
commit
9e74a0952e
@ -428,6 +428,16 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
|
|||||||
{
|
{
|
||||||
user = identification_create_from_string((char*)str);
|
user = identification_create_from_string((char*)str);
|
||||||
str = nm_setting_vpn_get_secret(vpn, "password");
|
str = nm_setting_vpn_get_secret(vpn, "password");
|
||||||
|
if (auth_class == AUTH_CLASS_PSK &&
|
||||||
|
strlen(str) < 20)
|
||||||
|
{
|
||||||
|
g_set_error(err, NM_VPN_PLUGIN_ERROR,
|
||||||
|
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
|
||||||
|
"pre-shared key is too short.");
|
||||||
|
gateway->destroy(gateway);
|
||||||
|
user->destroy(user);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
priv->creds->set_username_password(priv->creds, user, (char*)str);
|
priv->creds->set_username_password(priv->creds, user, (char*)str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user