aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--src/krb5-auth-dialog.c26
2 files changed, 30 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 213ad66..c35db48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
2006-02-01 Nalin Dahyabhai <nalin@redhat.com>
+ * src/krb5-auth-dialog.c: keep track of whether or not the user
+ explicitly canceled our last request for information. If she did,
+ then don't ask again while the expiration time remains unchanged.
+ Change recursion inside of renew_credentials() into a loop in its
+ calling function.
+
+2006-02-01 Nalin Dahyabhai <nalin@redhat.com>
* src/krb5-auth-dialog.c(krb5_gtk_prompter): rename to avoid polluting
the krb5 namespace.
* src/krb5-auth-dialog.c: don't use time() to figure out what time it
diff --git a/src/krb5-auth-dialog.c b/src/krb5-auth-dialog.c
index 471c15c..2c2bcfa 100644
--- a/src/krb5-auth-dialog.c
+++ b/src/krb5-auth-dialog.c
@@ -39,6 +39,8 @@ static GladeXML *xml = NULL;
static krb5_context kcontext;
static krb5_principal kprincipal;
static krb5_timestamp creds_expiry;
+static krb5_timestamp canceled_creds_expiry;
+static gboolean canceled;
static gboolean invalid_password;
static gboolean always_run;
@@ -185,6 +187,8 @@ auth_dialog_prompter (krb5_context ctx,
int i;
errcode = KRB5_LIBOS_CANTREADPWD;
+ canceled = FALSE;
+ canceled_creds_expiry = 0;
dialog = glade_xml_get_widget (xml, "krb5_dialog");
@@ -215,6 +219,8 @@ auth_dialog_prompter (krb5_context ctx,
errcode = 0;
break;
case GTK_RESPONSE_CANCEL:
+ canceled = TRUE;
+ break;
case GTK_RESPONSE_DELETE_EVENT:
break;
default:
@@ -293,8 +299,19 @@ credentials_expiring_real (void)
static gboolean
credentials_expiring (gpointer *data)
{
- if (credentials_expiring_real () && is_online)
- renew_credentials ();
+ int retval;
+ gboolean give_up;
+
+ if (credentials_expiring_real () && is_online) {
+ give_up = canceled && (creds_expiry == canceled_creds_expiry);
+ if (!give_up) {
+ do {
+ retval = renew_credentials ();
+ give_up = canceled &&
+ (creds_expiry == canceled_creds_expiry);
+ } while ((retval != 0) && !give_up);
+ }
+ }
return TRUE;
}
@@ -417,6 +434,9 @@ renew_credentials (void)
retval = krb5_get_init_creds_password(kcontext, &my_creds, kprincipal,
NULL, auth_dialog_prompter, NULL,
0, NULL, &opts);
+ if (canceled) {
+ canceled_creds_expiry = creds_expiry;
+ }
if (retval)
{
switch (retval) {
@@ -424,7 +444,7 @@ renew_credentials (void)
case KRB5KRB_AP_ERR_BAD_INTEGRITY:
/* Invalid password, try again. */
invalid_password = TRUE;
- return renew_credentials();
+ return retval;
default:
break;
}