From d6eee4e647348875912d9c6853a8de0a7d6069ad Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 18 Apr 2009 00:24:56 +0200 Subject: Imported Upstream version 0.9~rc1 --- preferences/krb5-auth-dialog-preferences.c | 74 +++++++++++++++++++++++++- preferences/krb5-auth-dialog-preferences.glade | 49 ++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-) (limited to 'preferences') diff --git a/preferences/krb5-auth-dialog-preferences.c b/preferences/krb5-auth-dialog-preferences.c index caf9ed9..ab463a0 100644 --- a/preferences/krb5-auth-dialog-preferences.c +++ b/preferences/krb5-auth-dialog-preferences.c @@ -36,7 +36,7 @@ #include "krb5-auth-gconf-tools.h" -#define N_LISTENERS 7 +#define N_LISTENERS 8 typedef struct { GladeXML *xml; @@ -45,6 +45,7 @@ typedef struct { GtkWidget *dialog; GtkWidget *principal_entry; GtkWidget *pkuserid_entry; + GtkWidget *pkanchors_entry; GtkWidget *forwardable_toggle; GtkWidget *proxiable_toggle; GtkWidget *renewable_toggle; @@ -197,6 +198,76 @@ ka_preferences_dialog_setup_pkuserid_entry (KaPreferencesDialog *dialog) } +static void +ka_preferences_pkanchors_notify (GConfClient *client G_GNUC_UNUSED, + guint cnx_id G_GNUC_UNUSED, + GConfEntry *entry, + KaPreferencesDialog *dialog) +{ + const char *pkanchors; + + if (!entry->value || entry->value->type != GCONF_VALUE_STRING) + return; + + pkanchors = gconf_value_get_string (entry->value); + + if (!pkanchors || !strlen(pkanchors)) + gtk_entry_set_text (GTK_ENTRY (dialog->pkanchors_entry), ""); + else { + const char *old_pkanchors; + + old_pkanchors = gtk_entry_get_text (GTK_ENTRY (dialog->pkanchors_entry)); + if (!old_pkanchors || (old_pkanchors && strcmp (old_pkanchors, pkanchors))) + gtk_entry_set_text (GTK_ENTRY (dialog->pkanchors_entry), pkanchors); + } +} + + +static void +ka_preferences_dialog_pkanchors_changed (GtkEntry *entry, + KaPreferencesDialog *dialog) +{ + const char *pkanchors; + + pkanchors = gtk_entry_get_text (entry); + + if (!pkanchors || !strlen(pkanchors)) + gconf_client_unset (dialog->client, KA_GCONF_KEY_PK_ANCHORS, NULL); + else + gconf_client_set_string (dialog->client, KA_GCONF_KEY_PK_ANCHORS, pkanchors, NULL); +} + + +static void +ka_preferences_dialog_setup_pkanchors_entry (KaPreferencesDialog *dialog) +{ + char *pkanchors = NULL; + + dialog->pkanchors_entry = glade_xml_get_widget (dialog->xml, "pkanchors_entry"); + g_assert (dialog->pkanchors_entry != NULL); + + if (!ka_gconf_get_string (dialog->client, KA_GCONF_KEY_PK_ANCHORS, &pkanchors)) + g_warning ("Getting pkanchors failed"); + + if (pkanchors && strlen(pkanchors)) + gtk_entry_set_text (GTK_ENTRY (dialog->pkanchors_entry), pkanchors); + if (pkanchors) + g_free (pkanchors); + + g_signal_connect (dialog->pkanchors_entry, "changed", + G_CALLBACK (ka_preferences_dialog_pkanchors_changed), dialog); + if (!gconf_client_key_is_writable (dialog->client, KA_GCONF_KEY_PK_ANCHORS, NULL)) { + gtk_widget_set_sensitive (dialog->pkanchors_entry, FALSE); + } + + dialog->listeners [dialog->n_listeners] = gconf_client_notify_add (dialog->client, + KA_GCONF_KEY_PK_ANCHORS, + (GConfClientNotifyFunc) ka_preferences_pkanchors_notify, + dialog, NULL, NULL); + dialog->n_listeners++; +} + + static void ka_preferences_dialog_forwardable_toggled (GtkToggleButton *toggle, KaPreferencesDialog *dialog) @@ -552,6 +623,7 @@ ka_preferences_dialog_init(KaPreferencesDialog* dialog) ka_preferences_dialog_setup_principal_entry (dialog); ka_preferences_dialog_setup_pkuserid_entry (dialog); + ka_preferences_dialog_setup_pkanchors_entry(dialog); ka_preferences_dialog_setup_forwardable_toggle (dialog); ka_preferences_dialog_setup_proxiable_toggle (dialog); ka_preferences_dialog_setup_renewable_toggle (dialog); diff --git a/preferences/krb5-auth-dialog-preferences.glade b/preferences/krb5-auth-dialog-preferences.glade index b4e5cd5..8e23b2f 100644 --- a/preferences/krb5-auth-dialog-preferences.glade +++ b/preferences/krb5-auth-dialog-preferences.glade @@ -1,6 +1,6 @@ - + 5 @@ -87,6 +87,7 @@ True True + True 1 @@ -128,6 +129,7 @@ True True The principal's public/private/certificate identifier. Leave empty if not using PKINIT. + True 1 @@ -138,6 +140,48 @@ 3 + + + True + 0 + PKINT anchors: + + + False + False + 4 + + + + + True + 6 + + + True + + + + False + False + + + + + True + True + Path to CA certificates used as trust anchors for PKINIT + True + + + 1 + + + + + 5 + + 1 @@ -392,6 +436,7 @@ True True Send notification about ticket expiry that many minutes before it finally expires. + True 0 0 100 1 10 10 @@ -552,6 +597,8 @@ True True + True + True True gtk-close True -- cgit