[gnome-online-accounts] kerberos: don't crash if keyring credentials disappear
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] kerberos: don't crash if keyring credentials disappear
- Date: Thu, 7 Nov 2013 11:50:12 +0000 (UTC)
commit bc741df3442d5b2da15bbe34a4336b5b417e2a5b
Author: Ray Strode <rstrode redhat com>
Date: Wed Nov 6 16:58:43 2013 -0500
kerberos: don't crash if keyring credentials disappear
It's possible to make gnome-online-accounts crash by:
1) creating a kerberos account in control-center
2) deleting the stored credentials from gnome keyring using seahorse
3) running kdestroy in the terminal to make the sign in button show up
in the control-center panel
4) clicking sign in
This is because the provider makes the assumption that there will always
be stored credentials when signing in interactively, which is incorrect
in the above scenario (because of step 2).
This commit hardens the get_ticket_sync function against credentials
disappearing.
https://bugzilla.gnome.org/show_bug.cgi?id=711572
src/goabackend/goakerberosprovider.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index 07035bc..aff3e36 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -701,7 +701,6 @@ get_ticket_sync (GoaKerberosProvider *self,
GoaAccount *account;
const char *identifier;
const char *password;
- gboolean has_password;
SignInRequest request;
gboolean ret;
@@ -728,16 +727,20 @@ get_ticket_sync (GoaKerberosProvider *self,
_("Could not find saved credentials for principal ‘%s’ in keyring"), identifier);
goto out;
}
-
- has_password = g_variant_lookup (credentials, "password", "&s", &password);
- if (!has_password && !is_interactive)
+ else if (credentials != NULL)
{
- g_set_error (error,
- GOA_ERROR,
- GOA_ERROR_NOT_AUTHORIZED,
- _("Did not find password for principal ‘%s’ in credentials"),
- identifier);
- goto out;
+ gboolean has_password;
+
+ has_password = g_variant_lookup (credentials, "password", "&s", &password);
+ if (!has_password && !is_interactive)
+ {
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_NOT_AUTHORIZED,
+ _("Did not find password for principal ‘%s’ in credentials"),
+ identifier);
+ goto out;
+ }
}
memset (&request, 0, sizeof (SignInRequest));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]