|
|
6f965c |
From 919e8972a6635539499f153a28d92e0c4052b354 Mon Sep 17 00:00:00 2001
|
|
|
6f965c |
From: Ondrej Holy <oholy@redhat.com>
|
|
|
6f965c |
Date: Tue, 30 Jan 2018 08:58:20 +0100
|
|
|
6f965c |
Subject: [PATCH 15/15] act-user: Prevent segfault if accounts_proxy is not
|
|
|
6f965c |
created
|
|
|
6f965c |
|
|
|
6f965c |
act_user_get_locked may segfault if accounts_proxy is not created (e.g.
|
|
|
6f965c |
when run under root). All other functions which rely on accounts_proxy
|
|
|
6f965c |
already contain checks for NULL and valid ActUser. Do the same also in
|
|
|
6f965c |
act_user_get_locked in order to avoid segfaults in certain cases.
|
|
|
6f965c |
|
|
|
6f965c |
https://bugs.freedesktop.org/show_bug.cgi?id=104851
|
|
|
6f965c |
---
|
|
|
6f965c |
src/libaccountsservice/act-user.c | 5 +++++
|
|
|
6f965c |
1 file changed, 5 insertions(+)
|
|
|
6f965c |
|
|
|
6f965c |
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c
|
|
|
6f965c |
index a24f25a..e21c9db 100644
|
|
|
6f965c |
--- a/src/libaccountsservice/act-user.c
|
|
|
6f965c |
+++ b/src/libaccountsservice/act-user.c
|
|
|
6f965c |
@@ -859,60 +859,65 @@ act_user_is_logged_in (ActUser *user)
|
|
|
6f965c |
|
|
|
6f965c |
/**
|
|
|
6f965c |
* act_user_is_logged_in_anywhere:
|
|
|
6f965c |
* @user: a #ActUser
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns whether or not #ActUser is currently logged in in any way
|
|
|
6f965c |
* whatsoever. See also act_user_is_logged_in().
|
|
|
6f965c |
*
|
|
|
6f965c |
* (Currently, this function is only implemented for systemd-logind.
|
|
|
6f965c |
* For ConsoleKit, it is equivalent to act_user_is_logged_in.)
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns: %TRUE or %FALSE
|
|
|
6f965c |
*/
|
|
|
6f965c |
gboolean
|
|
|
6f965c |
act_user_is_logged_in_anywhere (ActUser *user)
|
|
|
6f965c |
{
|
|
|
6f965c |
return user->our_sessions != NULL || user->other_sessions != NULL;
|
|
|
6f965c |
}
|
|
|
6f965c |
|
|
|
6f965c |
/**
|
|
|
6f965c |
* act_user_get_locked:
|
|
|
6f965c |
* @user: a #ActUser
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns whether or not the #ActUser account is locked.
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns: %TRUE or %FALSE
|
|
|
6f965c |
*/
|
|
|
6f965c |
gboolean
|
|
|
6f965c |
act_user_get_locked (ActUser *user)
|
|
|
6f965c |
{
|
|
|
6f965c |
+ g_return_val_if_fail (ACT_IS_USER (user), TRUE);
|
|
|
6f965c |
+
|
|
|
6f965c |
+ if (user->accounts_proxy == NULL)
|
|
|
6f965c |
+ return TRUE;
|
|
|
6f965c |
+
|
|
|
6f965c |
return accounts_user_get_locked (user->accounts_proxy);
|
|
|
6f965c |
}
|
|
|
6f965c |
|
|
|
6f965c |
/**
|
|
|
6f965c |
* act_user_get_automatic_login:
|
|
|
6f965c |
* @user: a #ActUser
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns whether or not #ActUser is automatically logged in at boot time.
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns: %TRUE or %FALSE
|
|
|
6f965c |
*/
|
|
|
6f965c |
gboolean
|
|
|
6f965c |
act_user_get_automatic_login (ActUser *user)
|
|
|
6f965c |
{
|
|
|
6f965c |
g_return_val_if_fail (ACT_IS_USER (user), FALSE);
|
|
|
6f965c |
|
|
|
6f965c |
if (user->accounts_proxy == NULL)
|
|
|
6f965c |
return FALSE;
|
|
|
6f965c |
|
|
|
6f965c |
return accounts_user_get_automatic_login (user->accounts_proxy);
|
|
|
6f965c |
}
|
|
|
6f965c |
|
|
|
6f965c |
/**
|
|
|
6f965c |
* act_user_is_system_account:
|
|
|
6f965c |
* @user: a #ActUser
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns whether or not #ActUser represents a 'system account' like
|
|
|
6f965c |
* 'root' or 'nobody'.
|
|
|
6f965c |
*
|
|
|
6f965c |
* Returns: %TRUE or %FALSE
|
|
|
6f965c |
--
|
|
|
6f965c |
2.14.3
|
|
|
6f965c |
|