Blob Blame History Raw
From 9731022ab1e229efb48b32b29fa96885f95f2391 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 13 Oct 2015 09:05:30 -0400
Subject: [PATCH] kerberos: Fail early on ticket request when ticketing
 disabled

Right now, it's possible to crash gnome-online-account if you
turn of the kerberos slider at just the right moment when it's
doing a refresh.

This is because it will try to get a ticket when ticketing has
already been disabled (and the ticketing interface is unset).

This commit adds a check for that.

https://bugzilla.gnome.org/show_bug.cgi?id=756498
---
 src/goabackend/goakerberosprovider.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index f51f56a0a34a..32e9ab257ae6 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -300,7 +300,16 @@ get_ticket_sync (GoaKerberosProvider *self,
   account = goa_object_peek_account (object);
   identifier = goa_account_get_identity (account);
 
-  ticketing = goa_object_get_ticketing (GOA_OBJECT (object));
+  ticketing = goa_object_get_ticketing (object);
+  if (ticketing == NULL)
+    {
+      g_set_error (error,
+                   GOA_ERROR,
+                   GOA_ERROR_NOT_SUPPORTED,
+                   _("Ticketing is disabled for account"));
+      return FALSE;
+    }
+
   details = goa_ticketing_get_details (ticketing);
 
   preauth_source = NULL;
-- 
2.5.5