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