[krb5-auth-dialog] Don't assume there is a file when listing tickets
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] Don't assume there is a file when listing tickets
- Date: Mon, 17 Jul 2017 06:01:53 +0000 (UTC)
commit 5aaa0459dc05386a7456d6aea2eb90e4ff83e0db
Author: Guido Günther <agx sigxcpu org>
Date: Sun Jul 16 19:16:04 2017 +0200
Don't assume there is a file when listing tickets
Instead of checking for the the existence of an actual file
use the Kerberos error code. This allows us to work for other
cache types too.
src/ka-kerberos.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/src/ka-kerberos.c b/src/ka-kerberos.c
index d17a63e..0cb58cf 100644
--- a/src/ka-kerberos.c
+++ b/src/ka-kerberos.c
@@ -317,23 +317,22 @@ ka_get_service_tickets (GtkListStore * tickets, gboolean hide_conf_tickets)
g_return_val_if_fail (!ret, FALSE);
ret = krb5_cc_start_seq_get (kcontext, ccache, &cursor);
- if (ret) {
+ if (ret == KRB5_FCC_NOFILE) {
ka_log_error_message_at_level (G_LOG_LEVEL_INFO, "krb5_cc_start_seq_get", kcontext, ret);
- /* if the file doesn't exist, it's not an error if we can't
- * parse it */
- if (!g_file_test (ka_ccache_filename (), G_FILE_TEST_EXISTS)) {
- gtk_list_store_append (tickets, &iter);
- gtk_list_store_set (tickets, &iter,
- PRINCIPAL_COLUMN, _("Your ticket cache is currently empty"),
- FORWARDABLE_COLUMN, FALSE,
- RENEWABLE_COLUMN, FALSE,
- PROXIABLE_COLUMN, FALSE, -1);
- retval = TRUE;
- }
+ gtk_list_store_append (tickets, &iter);
+ gtk_list_store_set (tickets, &iter,
+ PRINCIPAL_COLUMN, _("Your ticket cache is currently empty"),
+ FORWARDABLE_COLUMN, FALSE,
+ RENEWABLE_COLUMN, FALSE,
+ PROXIABLE_COLUMN, FALSE, -1);
+ retval = TRUE;
+ goto out;
+ } else if (ret) {
goto out;
}
+
while ((ret = krb5_cc_next_cred (kcontext, ccache, &cursor, &creds)) == 0) {
gboolean renewable, proxiable, forwardable;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]