diff options
author | Ondrej Holy <oholy@redhat.com> | 2018-01-30 08:58:20 +0100 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2018-01-30 10:03:49 -0500 |
commit | 3e7b8ece27ae9a9738145afefda1378ee95679a0 (patch) | |
tree | 51cb51beb0f7ac13509c09663c5ef0389c4d51a5 | |
parent | c111873f35f29576d655652a95810bfceb1862ef (diff) |
act-user: Prevent segfault if accounts_proxy is not created
act_user_get_locked may segfault if accounts_proxy is not created (e.g.
when run under root). All other functions which rely on accounts_proxy
already contain checks for NULL and valid ActUser. Do the same also in
act_user_get_locked in order to avoid segfaults in certain cases.
https://bugs.freedesktop.org/show_bug.cgi?id=104851
-rw-r--r-- | src/libaccountsservice/act-user.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c index da46bc5..e7ceb24 100644 --- a/src/libaccountsservice/act-user.c +++ b/src/libaccountsservice/act-user.c @@ -887,6 +887,11 @@ act_user_is_logged_in_anywhere (ActUser *user) gboolean act_user_get_locked (ActUser *user) { + g_return_val_if_fail (ACT_IS_USER (user), TRUE); + + if (user->accounts_proxy == NULL) + return TRUE; + return accounts_user_get_locked (user->accounts_proxy); } |