Blame SOURCES/0014-lib-fix-crasher-if-accounts-proxy-is-unavailable.patch

baf615
From 4e22d1a68e8ddcdea761fc51ea8c2ced0055fe60 Mon Sep 17 00:00:00 2001
baf615
From: Ray Strode <rstrode@redhat.com>
baf615
Date: Fri, 3 Nov 2017 09:47:04 -0400
baf615
Subject: [PATCH 14/14] lib: fix crasher if accounts proxy is unavailable
baf615
baf615
Right now if the accounts proxy is unavailable act_user_get_real_name
baf615
crashes instead of returning NULL as advertised.
baf615
baf615
This commit makes it return NULL.
baf615
baf615
https://bugs.freedesktop.org/show_bug.cgi?id=103560
baf615
---
baf615
 src/libaccountsservice/act-user.c | 3 +++
baf615
 1 file changed, 3 insertions(+)
baf615
baf615
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
baf615
index 94884a1..a24f25a 100644
baf615
--- a/src/libaccountsservice/act-user.c
baf615
+++ b/src/libaccountsservice/act-user.c
baf615
@@ -520,60 +520,63 @@ set_is_loaded (ActUser  *user,
baf615
  *  freed, or %NULL.
baf615
  **/
baf615
 
baf615
 uid_t
baf615
 act_user_get_uid (ActUser *user)
baf615
 {
baf615
         g_return_val_if_fail (ACT_IS_USER (user), -1);
baf615
 
baf615
         if (user->accounts_proxy == NULL)
baf615
                 return -1;
baf615
 
baf615
         return accounts_user_get_uid (user->accounts_proxy);
baf615
 }
baf615
 
baf615
 /**
baf615
  * act_user_get_real_name:
baf615
  * @user: the user object to examine.
baf615
  *
baf615
  * Retrieves the display name of @user.
baf615
  *
baf615
  * Returns: (transfer none): a pointer to an array of characters which must not be modified or
baf615
  *  freed, or %NULL.
baf615
  **/
baf615
 const char *
baf615
 act_user_get_real_name (ActUser *user)
baf615
 {
baf615
         const char *real_name = NULL;
baf615
 
baf615
         g_return_val_if_fail (ACT_IS_USER (user), NULL);
baf615
 
baf615
+        if (user->accounts_proxy == NULL)
baf615
+                return NULL;
baf615
+
baf615
         real_name = accounts_user_get_real_name (user->accounts_proxy);
baf615
 
baf615
         if (real_name == NULL || real_name[0] == '\0') {
baf615
                 real_name = accounts_user_get_user_name (user->accounts_proxy);
baf615
         }
baf615
 
baf615
         return real_name;
baf615
 }
baf615
 
baf615
 /**
baf615
  * act_user_get_account_type:
baf615
  * @user: the user object to examine.
baf615
  *
baf615
  * Retrieves the account type of @user.
baf615
  *
baf615
  * Returns: a #ActUserAccountType
baf615
  **/
baf615
 ActUserAccountType
baf615
 act_user_get_account_type (ActUser *user)
baf615
 {
baf615
         g_return_val_if_fail (ACT_IS_USER (user), ACT_USER_ACCOUNT_TYPE_STANDARD);
baf615
 
baf615
         if (user->accounts_proxy == NULL)
baf615
                 return ACT_USER_ACCOUNT_TYPE_STANDARD;
baf615
 
baf615
         return accounts_user_get_account_type (user->accounts_proxy);
baf615
 }
baf615
 
baf615
 /**
baf615
  * act_user_get_password_mode:
baf615
-- 
baf615
2.14.2
baf615