aboutsummaryrefslogtreecommitdiffstats
path: root/src/frontends
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2016-04-21 17:46:02 +0200
committerTobias Brunner <tobias@strongswan.org>2016-09-05 15:41:15 +0200
commit2b63883dba7ff015ee6a013cf5583ac464509e2c (patch)
tree3c9e588491f3bb2086d5003db8d1c9d26912cde9 /src/frontends
parenta238f534e886a8e6e34b691e244ee6836daaa7e4 (diff)
downloadstrongswan-2b63883dba7ff015ee6a013cf5583ac464509e2c.tar.bz2
strongswan-2b63883dba7ff015ee6a013cf5583ac464509e2c.tar.xz
nm: Add minimum length constraint for PSK passwords in connection editor
We already have this restriction in the auth-dialog.
Diffstat (limited to 'src/frontends')
-rw-r--r--src/frontends/gnome/properties/nm-strongswan.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/frontends/gnome/properties/nm-strongswan.c b/src/frontends/gnome/properties/nm-strongswan.c
index 223dfb32c..b79106826 100644
--- a/src/frontends/gnome/properties/nm-strongswan.c
+++ b/src/frontends/gnome/properties/nm-strongswan.c
@@ -127,6 +127,22 @@ check_validity (StrongswanPluginUiWidget *self, GError **error)
"address");
return FALSE;
}
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo"));
+ switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)))
+ {
+ case 4:
+ {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "passwd-entry"));
+ str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+ if (str && strlen (str) < 20) {
+ g_set_error (error,
+ STRONGSWAN_PLUGIN_UI_ERROR,
+ STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY,
+ "password is too short");
+ return FALSE;
+ }
+ }
+ }
return TRUE;
}