[network-manager-openvpn/jk/bgo731891-gui-password-types: 2/2] properties: add an option for storing the password to a keyring (bgo #731891)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/jk/bgo731891-gui-password-types: 2/2] properties: add an option for storing the password to a keyring (bgo #731891)
- Date: Thu, 24 Jul 2014 10:31:18 +0000 (UTC)
commit bc3ee8bb31edbf017dbcfebd698f9cce7777ef6c
Author: Jiří Klimeš <jklimes redhat com>
Date: Tue Jul 22 18:11:00 2014 +0200
properties: add an option for storing the password to a keyring (bgo #731891)
https://bugzilla.gnome.org/show_bug.cgi?id=731891
properties/auth-helpers.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 0c1499d..80c4568 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -43,9 +43,10 @@
#include "src/nm-openvpn-service.h"
#include "common/utils.h"
-#define PW_TYPE_SAVE 0
-#define PW_TYPE_ASK 1
-#define PW_TYPE_UNUSED 2
+#define PW_TYPE_SAVE 0
+#define PW_TYPE_ASK 1
+#define PW_TYPE_UNUSED 2
+#define PW_TYPE_KEYRING 3
#define BLOCK_HANDLER_ID "block-handler-id"
@@ -206,7 +207,8 @@ init_one_pw_tls_combo (GtkBuilder *builder,
gtk_list_store_set (store, &iter, 0, _("Saved"), -1);
if ( (active < 0)
&& !(pw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
- && !(pw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) {
+ && !(pw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
+ && !(pw_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)) {
active = PW_TYPE_SAVE;
}
@@ -220,6 +222,11 @@ init_one_pw_tls_combo (GtkBuilder *builder,
if ((active < 0) && (pw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED))
active = PW_TYPE_UNUSED;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, _("Keyring"), -1);
+ if ((active < 0) && (pw_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED))
+ active = PW_TYPE_KEYRING;
+
tmp = g_strdup_printf ("%s_%s",
prefix, pw_only? "pass_type_combo" : "private_key_pass_type_combo");
widget = GTK_WIDGET (gtk_builder_get_object (builder, tmp));
@@ -694,7 +701,9 @@ _update_password_flags (GtkBuilder *builder,
char *tmp;
pw_flags = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (pw_widget), "flags"));
- pw_flags &= ~(NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED);
+ pw_flags &= ~( NM_SETTING_SECRET_FLAG_NOT_SAVED
+ | NM_SETTING_SECRET_FLAG_NOT_REQUIRED
+ | NM_SETTING_SECRET_FLAG_AGENT_OWNED);
if (strcmp (pw_key, NM_OPENVPN_KEY_PASSWORD) == 0)
tmp = g_strdup_printf ("%s_pass_type_combo", prefix);
@@ -706,6 +715,9 @@ _update_password_flags (GtkBuilder *builder,
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_widget))) {
case PW_TYPE_SAVE:
break;
+ case PW_TYPE_KEYRING:
+ pw_flags |= NM_SETTING_SECRET_FLAG_AGENT_OWNED;
+ break;
case PW_TYPE_UNUSED:
pw_flags |= NM_SETTING_SECRET_FLAG_NOT_REQUIRED;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]