[krb5-auth-dialog] Print the banner returned by Kerberos



commit 75d4a8c6d7265835702931e5f645198db2e16b7e
Author: Guido Günther <agx sigxcpu org>
Date:   Mon Dec 13 20:53:37 2010 +0100

    Print the banner returned by Kerberos
    
    instead of our static message when acquiring a ticket. This makes
    passwort expiration prompts visible.

 src/ka-applet.c |   19 ++++++++++++++++++-
 src/ka-dialog.c |    3 +++
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/ka-applet.c b/src/ka-applet.c
index bbde096..4f05b88 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -82,6 +82,7 @@ struct _KaAppletPrivate {
 #ifdef HAVE_LIBNOTIFY
     NotifyNotification *notification;   /* notification messages */
 #endif                          /* HAVE_LIBNOTIFY */
+    char *krb_msg;              /* Additional banner delivered by Kerberos */
     const char *notify_gconf_key;       /* disable notification gconf key */
     char *principal;            /* the principal to request */
     gboolean renewable;         /* credentials renewable? */
@@ -242,6 +243,7 @@ ka_applet_finalize (GObject *object)
     g_free (applet->priv->principal);
     g_free (applet->priv->pk_userid);
     g_free (applet->priv->pk_anchors);
+    g_free (applet->priv->krb_msg);
     /* no need to free applet->priv */
 
     if (parent_class->finalize != NULL)
@@ -547,18 +549,26 @@ ka_applet_update_status (KaApplet *applet, krb5_timestamp expiry)
 
     if (remaining > 0) {
         if (expiry_notified) {
+            const char* msg;
             ka_gconf_get_bool (applet->priv->gconf,
                                KA_GCONF_KEY_NOTIFY_VALID, &notify);
             if (notify) {
                 applet->priv->notify_gconf_key = KA_GCONF_KEY_NOTIFY_VALID;
+
+                if (applet->priv->krb_msg)
+                    msg = applet->priv->krb_msg;
+                else
+                    msg = _("You've refreshed your Kerberos credentials.");
                 ka_send_event_notification (applet,
                                             _("Network credentials valid"),
-                                            _("You've refreshed your Kerberos credentials."),
+                                            msg,
                                             "krb-valid-ticket",
                                             "dont-show-again", FALSE);
             }
             ka_applet_signal_emit (applet, KA_SIGNAL_ACQUIRED_TGT, expiry);
             expiry_notified = FALSE;
+            g_free (applet->priv->krb_msg);
+            applet->priv->krb_msg = NULL;
         } else {
             if (remaining < applet->priv->pw_prompt_secs
                 && (now - last_warn) > NOTIFY_SECONDS
@@ -883,6 +893,13 @@ ka_applet_get_gconf_client (const KaApplet *self)
 }
 
 void
+ka_applet_set_msg (KaApplet *self, const char *msg)
+{
+    g_free (self->priv->krb_msg);
+    self->priv->krb_msg = g_strdup (msg);
+}
+
+void
 ka_applet_signal_emit (KaApplet *this,
                        KaAppletSignalNumber signum,
                        krb5_timestamp expiry)
diff --git a/src/ka-dialog.c b/src/ka-dialog.c
index 8d5cd46..b51cdd2 100644
--- a/src/ka-dialog.c
+++ b/src/ka-dialog.c
@@ -402,6 +402,9 @@ auth_dialog_prompter (krb5_context ctx G_GNUC_UNUSED,
 	canceled = FALSE;
 	canceled_creds_expiry = 0;
 
+	if (banner && !num_prompts)
+            ka_applet_set_msg (applet, banner);
+
 	for (i = 0; i < num_prompts; i++) {
 		const gchar *password = NULL;
 		int password_len = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]