From 0b9e630dde78cb83d6a0f93be538b6f7fac860f2 Mon Sep 17 00:00:00 2001 From: nalin Date: Thu, 2 Feb 2006 02:51:12 +0000 Subject: * 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. git-svn-id: http://svn.gnome.org/svn/krb5-auth-dialog/trunk@61 517b70f8-ed25-0410-8bf6-f5db08f7b76e --- ChangeLog | 7 +++++++ src/krb5-auth-dialog.c | 26 +++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 213ad66..c35db48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-01 Nalin Dahyabhai + * 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 * src/krb5-auth-dialog.c(krb5_gtk_prompter): rename to avoid polluting the krb5 namespace. 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; } -- cgit v1.2.3