[krb5-auth-dialog] Send a tgt-renewed signal if the ticket lifetime gets extended



commit 92c76a9c50169a5b06129c8b2bba88a5d4853030
Author: Guido Günther <agx sigxcpu org>
Date:   Thu Apr 22 08:18:08 2010 +0200

    Send a tgt-renewed signal if the ticket lifetime gets extended
    
    This way we also send a singal if the user extends the ticket liftetime
    by reentering his password of by running kinit on the console.

 src/krb5-auth-applet.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/krb5-auth-applet.c b/src/krb5-auth-applet.c
index 8598d3b..72b403e 100644
--- a/src/krb5-auth-applet.c
+++ b/src/krb5-auth-applet.c
@@ -510,10 +510,12 @@ ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry)
 	int remaining = expiry - now;
 	static int last_warn = 0;
 	static gboolean expiry_notified = FALSE;
+	static krb5_timestamp old_expiry = 0;
 	gboolean notify = TRUE;
 	const char* tray_icon = ka_applet_select_icon (applet, remaining);
 	char* tooltip_text = ka_applet_tooltip_text (remaining);
 
+
 	if (remaining > 0) {
 		if (expiry_notified) {
 			ka_gconf_get_bool(applet->priv->gconf,
@@ -529,20 +531,26 @@ ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry)
 			}
 			ka_applet_signal_emit (applet, KA_SIGNAL_ACQUIRED_TGT, expiry);
 			expiry_notified = FALSE;
-		} else if (remaining < applet->priv->pw_prompt_secs && (now - last_warn) > NOTIFY_SECONDS &&
-			   !applet->priv->renewable) {
-			ka_gconf_get_bool(applet->priv->gconf,
+		} else {
+			if (remaining < applet->priv->pw_prompt_secs
+			    && (now - last_warn) > NOTIFY_SECONDS
+			    && !applet->priv->renewable) {
+				ka_gconf_get_bool(applet->priv->gconf,
 					  KA_GCONF_KEY_NOTIFY_EXPIRING,
 					  &notify);
-			if (notify) {
-				applet->priv->notify_gconf_key = KA_GCONF_KEY_NOTIFY_EXPIRING;
-				ka_send_event_notification (applet,
+				if (notify) {
+					applet->priv->notify_gconf_key = KA_GCONF_KEY_NOTIFY_EXPIRING;
+					ka_send_event_notification (applet,
 						_("Network credentials expiring"),
 						tooltip_text,
 						"krb-expiring-ticket",
 						"dont-show-again");
+				}
+				last_warn = now;
 			}
-			last_warn = now;
+			/* ticket lifetime got longer e.g. by kinit -R */
+			if (old_expiry && expiry > old_expiry)
+				ka_applet_signal_emit (applet, KA_SIGNAL_RENEWED_TGT, expiry);
 		}
 	} else {
 		if (!expiry_notified) {
@@ -563,6 +571,7 @@ ka_applet_update_status(KaApplet* applet, krb5_timestamp expiry)
 		}
 	}
 
+	old_expiry = expiry;
 	gtk_status_icon_set_from_icon_name (applet->priv->tray_icon, tray_icon);
 	gtk_status_icon_set_tooltip_text (applet->priv->tray_icon, tooltip_text);
 	g_free(tooltip_text);



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