diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-11-27 18:37:11 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-11-27 18:37:11 +0100 |
commit | e9b49d412b3f226ac4701cb1e9525b77f4693f82 (patch) | |
tree | 0eb3a2d35a999c29dfa9a1aa896eb545c5b54cb0 /src/frontends/gnome/auth-dialog/main.c | |
parent | 228db0433d9e8dd11bb70992e4711e099567ae4d (diff) | |
parent | 0b506edb1901aefd4fca35c51f985e7e93bbaf6e (diff) | |
download | strongswan-e9b49d412b3f226ac4701cb1e9525b77f4693f82.tar.bz2 strongswan-e9b49d412b3f226ac4701cb1e9525b77f4693f82.tar.xz |
Merge branch 'nm-psk'
This adds support for PSK authentication to the NetworkManager frontend.
Diffstat (limited to 'src/frontends/gnome/auth-dialog/main.c')
-rw-r--r-- | src/frontends/gnome/auth-dialog/main.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/frontends/gnome/auth-dialog/main.c b/src/frontends/gnome/auth-dialog/main.c index a22e34d77..b9fd886d5 100644 --- a/src/frontends/gnome/auth-dialog/main.c +++ b/src/frontends/gnome/auth-dialog/main.c @@ -99,7 +99,7 @@ static char* get_connection_type(char *uuid) fprintf (stderr, "Failed to read data and secrets from stdin.\n"); return NULL; } - + method = g_hash_table_lookup (data, "method"); if (method) method = g_strdup(method); @@ -118,7 +118,7 @@ int main (int argc, char *argv[]) gchar *name = NULL, *uuid = NULL, *service = NULL, *keyring = NULL, *pass; GOptionContext *context; char *agent, *type; - guint32 itemid; + guint32 itemid, minlen = 0; GtkWidget *dialog; GOptionEntry entries[] = { { "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL}, @@ -159,7 +159,8 @@ int main (int argc, char *argv[]) fprintf(stderr, "Connection lookup failed\n"); return 1; } - if (!strcmp(type, "eap") || !strcmp(type, "key") || !strcmp(type, "smartcard")) + if (!strcmp(type, "eap") || !strcmp(type, "key") || !strcmp(type, "psk") || + !strcmp(type, "smartcard")) { pass = lookup_password(name, service); if ((!pass || retry) && allow_interaction) @@ -178,6 +179,14 @@ int main (int argc, char *argv[]) NULL, NULL, TRUE); gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE); } + else if (!strcmp(type, "psk")) + { + dialog = gnome_password_dialog_new(_("VPN password required"), + _("Pre-shared key required to establish VPN connection (min. 20 characters):"), + NULL, NULL, TRUE); + gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE); + minlen = 20; + } else /* smartcard */ { dialog = gnome_password_dialog_new(_("VPN password required"), @@ -190,12 +199,18 @@ int main (int argc, char *argv[]) { gnome_password_dialog_set_password(GNOME_PASSWORD_DIALOG(dialog), pass); } + +too_short_retry: if (!gnome_password_dialog_run_and_block(GNOME_PASSWORD_DIALOG(dialog))) { return 1; } pass = gnome_password_dialog_get_password(GNOME_PASSWORD_DIALOG(dialog)); + if (minlen && strlen(pass) < minlen) + { + goto too_short_retry; + } switch (gnome_password_dialog_get_remember(GNOME_PASSWORD_DIALOG(dialog))) { case GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING: @@ -244,4 +259,3 @@ int main (int argc, char *argv[]) wait_for_quit (); return 0; } - |