Codebase list krb5-auth-dialog / 9d5cdf2
Imported Upstream version 0.9+0gitec60300 Guido Günther 15 years ago
9 changed file(s) with 267 addition(s) and 292 deletion(s). Raw diff Collapse all Expand all
11 Jonathan Blandford <jrb@redhat.com>
22 Colin Walters <walters@verbum.org>
33 Guido Günther <agx@sigxcpu.org>
4
5 Patches have been contributed by:
6 Matthias Clasen <mclasen@redhat.com>
0 Fri Apr 24 10:48:30 CEST 2009 Guido Günther <agx@sigxcpu.org>
1
2 * src/krb5-auth-pwdialog.c: query current invisiable char from
3 GtkEntry and set it for GtkSecureEntry too. Patch by Matthias Clasen.
4 (BZ: #538339)
5
6 Fri Apr 24 10:46:20 CEST 2009 Guido Günther <agx@sigxcpu.org>
7
8 * gtksecentry/gtksecentry.c: don't install "gtk-entry-select-on-focus"
9 settings property since it clashes with the one from GtkEntry. Allows
10 to have GtkEntry and GtkSecureEntry in the same process.
11 (https://bugs.g10code.com/gnupg/issue1029).
12
13 Fri Apr 24 09:39:16 CEST 2009 Guido Günther <agx@sigxcpu.org>
14
15 * AUTHORS: add Matthias Clasen
16
17 Fri Apr 24 09:35:59 CEST 2009 Guido Günther <agx@sigxcpu.org>
18
19 * src/krb5-auth-applet.c: Don't show notification before the applet is
20 embedded in the panel (based on a patch for 0.8 by Matthias Clasen)
21
22 Do Apr 23 18:35:32 CEST 2009 Guido Günther <agx@sigxcpu.org>
23
24 * configure.ac: release 0.9
25
26 Do Apr 23 11:19:46 CEST 2009 Guido Günther <agx@sigxcpu.org>
27
28 * Update NEWS
29
30 Thu Apr 23 11:17:28 CEST 2009 Guido Günther <agx@sigxcpu.org>
31
32 Always reparse the principal name in grab_credentials. When
33 acquireing credentials interacively we want to be sure we use the
34 current principal name from gconf.
35 * src/krb5-auth-dialog.c (ka_parse_name): Always parse principal
36 property.
37 (grab_credentials): Call ka_parse_name unconditionally.
38
39 Thu Apr 23 11:14:37 CEST 2009 Guido Günther <agx@sigxcpu.org>
40
41 drop "Password:" label from dialog. It's in the kerberos prompt and
42 confusing if prompted for a PIN.
43 * src/krb5-auth-dialog.glade: drop password label
44 * src/krb5-auth-dialog.c (ka_pwdialog_setup): colon terminate prompts
45
046 Sat Apr 18 00:19:02 CEST 2009 Guido Günther <agx@sigxcpu.org>
147
248 * src/krb5-auth-gconf.c (ka_gconf_set_principal): handle length zero
0 ===========
1 Version 0.9
2 ===========
3 * add DBus service so applications can make krb5-auth-dialog check if the user
4 has a valid Kerberos ticket and if not let krb5-auth-dialog get one
5 (prompting for the password if necessary).
6 * grab the keyboard when the dialog is open, avoids typing the password
7 accidentally into other apps
8 * watch the credentials cache via a file monitor. Speeds up notifications when
9 the ticket cache gets modified by other applications
10 * add a preferences capplet
11 * make ticket flags like renewable, forwardable, proxiable configurable
12 * make pkinit anchors configurable
13 * bug fixes and cleanups
14
015 ===========
116 Version 0.8
217 ===========
0 AC_INIT([krb5-auth-dialog], [0.8])
0 AC_INIT([krb5-auth-dialog], [0.9])
11 AC_CONFIG_SRCDIR(src/krb5-auth-dialog.c)
22 dnl Make automake keep quiet about wildcards & other GNUmake-isms
33 AM_INIT_AUTOMAKE([-Wno-portability])
682682 GDK_CONTROL_MASK, "delete_from_cursor", 2,
683683 G_TYPE_ENUM, GTK_DELETE_WORD_ENDS,
684684 G_TYPE_INT, -1);
685
686 gtk_settings_install_property(g_param_spec_boolean
687 ("gtk-entry-select-on-focus",
688 _("Select on focus"),
689 _
690 ("Whether to select the contents of an entry when it is focused"),
691 TRUE, G_PARAM_READWRITE));
692685 }
693686
694687 static void
13681361 static void
13691362 gtk_secure_entry_grab_focus(GtkWidget * widget)
13701363 {
1364 GtkWidget *tmp;
13711365 GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget);
13721366 gboolean select_on_focus;
13731367
13741368 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
13751369 GTK_WIDGET_CLASS(parent_class)->grab_focus(widget);
13761370
1377 g_object_get(gtk_widget_get_settings(widget),
1371 /* read current select on focus setting from GtkEntry */
1372 tmp = gtk_entry_new ();
1373 g_object_get(gtk_widget_get_settings(tmp),
13781374 "gtk-entry-select-on-focus", &select_on_focus, NULL);
1375 gtk_widget_destroy (tmp);
13791376
13801377 if (select_on_focus && !entry->in_click)
13811378 gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
370370 }
371371
372372
373 #ifdef HAVE_LIBNOTIFY
374 static gboolean
375 show_notification (KaApplet *applet)
376 {
377 /* wait for the panel to be settled before showing a bubble */
378 if (gtk_status_icon_is_embedded (applet->priv->tray_icon)) {
379 notify_notification_show (applet->priv->notification, NULL);
380 } else {
381 g_timeout_add_seconds (5, (GSourceFunc)show_notification, applet);
382 }
383 return FALSE;
384 }
385
386
387 static void
388 ka_send_event_notification (KaApplet *applet,
389 const char *summary,
390 const char *message,
391 const char *icon)
392 {
393 const char *notify_icon;
394
395 g_return_if_fail (applet != NULL);
396 g_return_if_fail (summary != NULL);
397 g_return_if_fail (message != NULL);
398
399 if (!notify_is_initted ())
400 notify_init (PACKAGE);
401
402 if (applet->priv->notification != NULL) {
403 notify_notification_close (applet->priv->notification, NULL);
404 g_object_unref (applet->priv->notification);
405 }
406
407 notify_icon = icon ? icon : "gtk-dialog-authentication";
408
409 applet->priv->notification = \
410 notify_notification_new_with_status_icon(summary, message, notify_icon, applet->priv->tray_icon);
411
412 notify_notification_set_urgency (applet->priv->notification, NOTIFY_URGENCY_NORMAL);
413 show_notification (applet);
414 }
415 #else
373416 static void
374417 ka_send_event_notification (KaApplet *applet G_GNUC_UNUSED,
375418 const char *summary G_GNUC_UNUSED,
376419 const char *message G_GNUC_UNUSED,
377420 const char *icon G_GNUC_UNUSED)
378421 {
379 #ifdef HAVE_LIBNOTIFY
380 const char *notify_icon;
381
382 g_return_if_fail (applet != NULL);
383 g_return_if_fail (summary != NULL);
384 g_return_if_fail (message != NULL);
385
386 if (!notify_is_initted ())
387 notify_init (PACKAGE);
388
389 if (applet->priv->notification != NULL) {
390 notify_notification_close (applet->priv->notification, NULL);
391 g_object_unref (applet->priv->notification);
392 }
393
394 notify_icon = icon ? icon : "gtk-dialog-authentication";
395
396 applet->priv->notification = \
397 notify_notification_new_with_status_icon(summary, message, notify_icon, applet->priv->tray_icon);
398
399 notify_notification_set_urgency (applet->priv->notification, NOTIFY_URGENCY_NORMAL);
400 notify_notification_show (applet->priv->notification, NULL);
401 #endif /* HAVE_LIBNOTIFY */
402 }
422 }
423 #endif /* ! HAVE_LIBNOTIFY */
403424
404425
405426 /* update the tray icon's tooltip and icon */
177177 goto out;
178178 }
179179
180 /* copy principal from cache if any */
180181 if (krb5_principal_compare (kcontext, my_creds.client, kprincipal)) {
181182 krb5_free_principal(kcontext, kprincipal);
182183 krb5_copy_principal(kcontext, my_creds.client, &kprincipal);
528529 krb5_error_code ret;
529530 gchar *principal = NULL;
530531
532 if (*kprinc != NULL)
533 krb5_free_principal(krbcontext, *kprinc);
534
531535 g_object_get(applet, "principal", &principal, NULL);
532 ret = krb5_parse_name(krbcontext, principal,
533 kprinc);
536 ret = krb5_parse_name(krbcontext, principal, kprinc);
534537
535538 g_free(principal);
536539 return ret;
610613
611614 memset(&my_creds, 0, sizeof(my_creds));
612615
613 if (kprincipal == NULL) {
614 retval = ka_parse_name(applet, kcontext, &kprincipal);
615 if (retval)
616 goto out2;
617 }
616 retval = ka_parse_name(applet, kcontext, &kprincipal);
617 if (retval)
618 goto out2;
618619
619620 retval = krb5_cc_default (kcontext, &ccache);
620621 if (retval)
779780 krb5_copy_principal(kcontext, creds.client, &kprincipal);
780781 krb5_free_cred_contents (kcontext, &creds);
781782 }
782
783783 return have_tgt;
784784 }
785785
0 <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
1 <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
2
0 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
2 <!--*- mode: xml -*-->
33 <glade-interface>
4 <requires lib="gnome"/>
5
6 <widget class="GtkDialog" id="krb5_dialog">
7 <property name="border_width">6</property>
8 <property name="visible">False</property>
9 <property name="title" translatable="yes">Network Authentication</property>
10 <property name="type">GTK_WINDOW_TOPLEVEL</property>
11 <property name="window_position">GTK_WIN_POS_CENTER</property>
12 <property name="modal">False</property>
13 <property name="resizable">False</property>
14 <property name="destroy_with_parent">False</property>
15 <property name="decorated">True</property>
16 <property name="skip_taskbar_hint">False</property>
17 <property name="skip_pager_hint">False</property>
18 <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
19 <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
20 <property name="has_separator">False</property>
21
22 <child internal-child="vbox">
23 <widget class="GtkVBox" id="dialog-vbox2">
24 <property name="visible">True</property>
25 <property name="homogeneous">False</property>
26 <property name="spacing">0</property>
27
28 <child internal-child="action_area">
29 <widget class="GtkHButtonBox" id="dialog-action_area2">
30 <property name="visible">True</property>
31 <property name="layout_style">GTK_BUTTONBOX_END</property>
32
33 <child>
34 <widget class="GtkButton" id="cancelbutton1">
35 <property name="visible">True</property>
36 <property name="can_default">True</property>
37 <property name="can_focus">True</property>
38 <property name="label">gtk-cancel</property>
39 <property name="use_stock">True</property>
40 <property name="relief">GTK_RELIEF_NORMAL</property>
41 <property name="focus_on_click">True</property>
42 <property name="response_id">-6</property>
43 </widget>
44 </child>
45
46 <child>
47 <widget class="GtkButton" id="krb5_renew_button">
48 <property name="visible">True</property>
49 <property name="can_default">True</property>
50 <property name="has_default">True</property>
51 <property name="can_focus">True</property>
52 <property name="label" translatable="yes">_Renew Ticket</property>
53 <property name="use_underline">True</property>
54 <property name="relief">GTK_RELIEF_NORMAL</property>
55 <property name="focus_on_click">True</property>
56 <property name="response_id">-5</property>
57 </widget>
58 </child>
59 </widget>
60 <packing>
61 <property name="padding">0</property>
62 <property name="expand">False</property>
63 <property name="fill">True</property>
64 <property name="pack_type">GTK_PACK_END</property>
65 </packing>
66 </child>
67
68 <child>
69 <widget class="GtkHBox" id="hbox1">
70 <property name="border_width">6</property>
71 <property name="visible">True</property>
72 <property name="homogeneous">False</property>
73 <property name="spacing">12</property>
74
75 <child>
76 <widget class="GtkImage" id="image1">
77 <property name="visible">True</property>
78 <property name="stock">gtk-dialog-authentication</property>
79 <property name="icon_size">6</property>
80 <property name="xalign">0.5</property>
81 <property name="yalign">0</property>
82 <property name="xpad">0</property>
83 <property name="ypad">0</property>
84 </widget>
85 <packing>
86 <property name="padding">0</property>
87 <property name="expand">False</property>
88 <property name="fill">True</property>
89 </packing>
90 </child>
91
92 <child>
93 <widget class="GtkAlignment" id="alignment4">
94 <property name="visible">True</property>
95 <property name="xalign">0.5</property>
96 <property name="yalign">0.5</property>
97 <property name="xscale">1</property>
98 <property name="yscale">1</property>
99 <property name="top_padding">0</property>
100 <property name="bottom_padding">10</property>
101 <property name="left_padding">0</property>
102 <property name="right_padding">0</property>
103
104 <child>
105 <widget class="GtkVBox" id="vbox2">
106 <property name="visible">True</property>
107 <property name="homogeneous">False</property>
108 <property name="spacing">12</property>
109
110 <child>
111 <widget class="GtkVBox" id="vbox1">
112 <property name="visible">True</property>
113 <property name="homogeneous">False</property>
114 <property name="spacing">0</property>
115
116 <child>
117 <widget class="GtkLabel" id="krb5_message_label">
118 <property name="visible">True</property>
119 <property name="label" translatable="no"></property>
120 <property name="use_underline">False</property>
121 <property name="use_markup">True</property>
122 <property name="justify">GTK_JUSTIFY_LEFT</property>
123 <property name="wrap">False</property>
124 <property name="selectable">False</property>
125 <property name="xalign">0</property>
126 <property name="yalign">0.5</property>
127 <property name="xpad">0</property>
128 <property name="ypad">0</property>
129 </widget>
130 <packing>
131 <property name="padding">0</property>
132 <property name="expand">False</property>
133 <property name="fill">False</property>
134 </packing>
135 </child>
136 </widget>
137 <packing>
138 <property name="padding">0</property>
139 <property name="expand">True</property>
140 <property name="fill">True</property>
141 </packing>
142 </child>
143
144 <child>
145 <widget class="GtkVBox" id="vbox3">
146 <property name="visible">True</property>
147 <property name="homogeneous">False</property>
148 <property name="spacing">3</property>
149
150 <child>
151 <widget class="GtkHBox" id="hbox5">
152 <property name="visible">True</property>
153 <property name="homogeneous">False</property>
154 <property name="spacing">3</property>
155
156 <child>
157 <widget class="GtkLabel" id="label5">
158 <property name="visible">True</property>
159 <property name="label" translatable="yes">_Password:</property>
160 <property name="use_underline">True</property>
161 <property name="use_markup">False</property>
162 <property name="justify">GTK_JUSTIFY_LEFT</property>
163 <property name="wrap">False</property>
164 <property name="selectable">False</property>
165 <property name="xalign">0.5</property>
166 <property name="yalign">0.5</property>
167 <property name="xpad">0</property>
168 <property name="ypad">0</property>
169 <property name="mnemonic_widget">krb5_entry</property>
170 </widget>
171 <packing>
172 <property name="padding">0</property>
173 <property name="expand">False</property>
174 <property name="fill">False</property>
175 </packing>
176 </child>
177
178 <child>
179 <widget class="Custom" id="krb5_entry">
180 <property name="visible">True</property>
181 <property name="can_focus">True</property>
182 <property name="editable">True</property>
183 <property name="visibility">False</property>
184 <property name="max_length">0</property>
185 <property name="text" translatable="no"></property>
186 <property name="has_frame">True</property>
187 <property name="activates_default">True</property>
188 </widget>
189 <packing>
190 <property name="padding">0</property>
191 <property name="expand">True</property>
192 <property name="fill">True</property>
193 </packing>
194 </child>
195 </widget>
196 <packing>
197 <property name="padding">0</property>
198 <property name="expand">True</property>
199 <property name="fill">True</property>
200 </packing>
201 </child>
202
203 <child>
204 <widget class="GtkLabel" id="krb5_status_label">
205 <property name="visible">True</property>
206 <property name="label" translatable="no">&lt;span size=&quot;smaller&quot;&gt; &lt;/span&gt;</property>
207 <property name="use_underline">False</property>
208 <property name="use_markup">True</property>
209 <property name="justify">GTK_JUSTIFY_LEFT</property>
210 <property name="wrap">False</property>
211 <property name="selectable">False</property>
212 <property name="xalign">1</property>
213 <property name="yalign">0.5</property>
214 <property name="xpad">0</property>
215 <property name="ypad">0</property>
216 </widget>
217 <packing>
218 <property name="padding">0</property>
219 <property name="expand">False</property>
220 <property name="fill">False</property>
221 </packing>
222 </child>
223 </widget>
224 <packing>
225 <property name="padding">0</property>
226 <property name="expand">True</property>
227 <property name="fill">True</property>
228 </packing>
229 </child>
230 </widget>
231 </child>
232 </widget>
233 <packing>
234 <property name="padding">0</property>
235 <property name="expand">True</property>
236 <property name="fill">True</property>
237 </packing>
238 </child>
239 </widget>
240 <packing>
241 <property name="padding">0</property>
242 <property name="expand">True</property>
243 <property name="fill">True</property>
244 </packing>
245 </child>
246 </widget>
247 </child>
248 </widget>
249
4 <widget class="GtkDialog" id="krb5_dialog">
5 <property name="border_width">6</property>
6 <property name="title" translatable="yes">Network Authentication</property>
7 <property name="resizable">False</property>
8 <property name="window_position">GTK_WIN_POS_CENTER</property>
9 <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
10 <property name="has_separator">False</property>
11 <child internal-child="vbox">
12 <widget class="GtkVBox" id="dialog-vbox2">
13 <property name="visible">True</property>
14 <child>
15 <widget class="GtkHBox" id="hbox1">
16 <property name="visible">True</property>
17 <property name="border_width">6</property>
18 <property name="spacing">12</property>
19 <child>
20 <widget class="GtkImage" id="image1">
21 <property name="visible">True</property>
22 <property name="yalign">0</property>
23 <property name="stock">gtk-dialog-authentication</property>
24 <property name="icon_size">6</property>
25 </widget>
26 <packing>
27 <property name="expand">False</property>
28 </packing>
29 </child>
30 <child>
31 <widget class="GtkAlignment" id="alignment4">
32 <property name="visible">True</property>
33 <property name="bottom_padding">10</property>
34 <child>
35 <widget class="GtkVBox" id="vbox2">
36 <property name="visible">True</property>
37 <property name="spacing">12</property>
38 <child>
39 <widget class="GtkVBox" id="vbox1">
40 <property name="visible">True</property>
41 <child>
42 <widget class="GtkLabel" id="krb5_message_label">
43 <property name="visible">True</property>
44 <property name="xalign">0</property>
45 <property name="use_markup">True</property>
46 </widget>
47 <packing>
48 <property name="expand">False</property>
49 <property name="fill">False</property>
50 </packing>
51 </child>
52 </widget>
53 </child>
54 <child>
55 <widget class="GtkVBox" id="vbox3">
56 <property name="visible">True</property>
57 <property name="spacing">3</property>
58 <child>
59 <widget class="GtkHBox" id="hbox5">
60 <property name="visible">True</property>
61 <property name="spacing">3</property>
62 <child>
63 <widget class="Custom" id="krb5_entry">
64 <property name="visible">True</property>
65 <property name="can_focus">True</property>
66 </widget>
67 </child>
68 </widget>
69 </child>
70 <child>
71 <widget class="GtkLabel" id="krb5_status_label">
72 <property name="visible">True</property>
73 <property name="xalign">1</property>
74 <property name="label">&lt;span size="smaller"&gt; &lt;/span&gt;</property>
75 <property name="use_markup">True</property>
76 </widget>
77 <packing>
78 <property name="expand">False</property>
79 <property name="fill">False</property>
80 <property name="position">1</property>
81 </packing>
82 </child>
83 </widget>
84 <packing>
85 <property name="position">1</property>
86 </packing>
87 </child>
88 </widget>
89 </child>
90 </widget>
91 <packing>
92 <property name="position">1</property>
93 </packing>
94 </child>
95 </widget>
96 <packing>
97 <property name="position">1</property>
98 </packing>
99 </child>
100 <child internal-child="action_area">
101 <widget class="GtkHButtonBox" id="dialog-action_area2">
102 <property name="visible">True</property>
103 <property name="layout_style">GTK_BUTTONBOX_END</property>
104 <child>
105 <widget class="GtkButton" id="cancelbutton1">
106 <property name="visible">True</property>
107 <property name="can_focus">True</property>
108 <property name="can_default">True</property>
109 <property name="label">gtk-cancel</property>
110 <property name="use_stock">True</property>
111 <property name="response_id">-6</property>
112 </widget>
113 </child>
114 <child>
115 <widget class="GtkButton" id="krb5_renew_button">
116 <property name="visible">True</property>
117 <property name="can_focus">True</property>
118 <property name="can_default">True</property>
119 <property name="has_default">True</property>
120 <property name="label" translatable="yes">_Renew Ticket</property>
121 <property name="use_underline">True</property>
122 <property name="response_id">-5</property>
123 </widget>
124 <packing>
125 <property name="position">1</property>
126 </packing>
127 </child>
128 </widget>
129 <packing>
130 <property name="expand">False</property>
131 <property name="pack_type">GTK_PACK_END</property>
132 </packing>
133 </child>
134 </widget>
135 </child>
136 </widget>
250137 </glade-interface>
190190 {
191191 KaPwDialogPrivate *priv = pwdialog->priv;
192192 gchar *wrong_markup = NULL;
193 GtkWidget *e;
193194 gchar *prompt;
194195 int pw4len;
195196
196197 if (krb5prompt == NULL) {
197 prompt = g_strdup (_("Please enter your Kerberos password."));
198 prompt = g_strdup (_("Please enter your Kerberos password:"));
198199 } else {
199200 /* Kerberos's prompts are a mess, and basically impossible to
200201 * translate. There's basically no way short of doing a lot of
205206 pw4len = strlen ("Password for ");
206207 if (strncmp (krb5prompt, "Password for ", pw4len) == 0) {
207208 gchar *uid = (gchar *) (krb5prompt + pw4len);
208 prompt = g_strdup_printf (_("Please enter the password for '%s'"), uid);
209 prompt = g_strdup_printf (_("Please enter the password for '%s':"), uid);
209210 } else {
210211 prompt = g_strdup (krb5prompt);
211212 }
212213 }
214
215 e = gtk_entry_new ();
216 gtk_secure_entry_set_invisible_char (GTK_SECURE_ENTRY (priv->pw_entry),
217 gtk_entry_get_invisible_char (GTK_ENTRY (e)));
218 gtk_widget_destroy (e);
213219
214220 /* Clear the password entry field */
215221 gtk_secure_entry_set_text (GTK_SECURE_ENTRY (priv->pw_entry), "");