diff options
author | Lionel Landwerlin <llandwerlin@gmail.com> | 2013-06-28 14:52:26 +0100 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2013-07-01 09:47:40 -0400 |
commit | 254e959f71c44c95c932f9dd04ad809c32aaee4e (patch) | |
tree | 1d62c8bf46b2bc2c2c22b8f7f3a53d9320ee9017 /src/libaccountsservice/act-user.c | |
parent | 8fc6d65c79a484ef556bb8abad93599e12d93678 (diff) |
ActUserManager: handle nonexistent users
Right now if a nonexistent user is requested from the accounts service,
we don't give the caller any sort of notication that the user doesn't
exist. This cascades into d-bus timeouts and ultimately a broken login
screen.
This commit adds a new "nonexistent" user property to the user object
and sets it to TRUE when a requested user fails to load. It also
makes sure the user objects is-loaded property gets set.
Based on a patch by Lionel Landwerlin <llandwerlin@gmail.com>
https://bugs.freedesktop.org/show_bug.cgi?id=66325
Diffstat (limited to 'src/libaccountsservice/act-user.c')
-rw-r--r-- | src/libaccountsservice/act-user.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c index ca860e3..9de689e 100644 --- a/src/libaccountsservice/act-user.c +++ b/src/libaccountsservice/act-user.c @@ -86,6 +86,7 @@ enum { PROP_LOCKED, PROP_AUTOMATIC_LOGIN, PROP_SYSTEM_ACCOUNT, + PROP_NONEXISTENT, PROP_LOCAL_ACCOUNT, PROP_LOGIN_FREQUENCY, PROP_LOGIN_TIME, @@ -138,6 +139,7 @@ struct _ActUser { guint automatic_login : 1; guint system_account : 1; guint local_account : 1; + guint nonexistent : 1; }; struct _ActUserClass @@ -321,6 +323,9 @@ act_user_get_property (GObject *object, case PROP_LOCAL_ACCOUNT: g_value_set_boolean (value, user->local_account); break; + case PROP_NONEXISTENT: + g_value_set_boolean (value, user->nonexistent); + break; case PROP_IS_LOADED: g_value_set_boolean (value, user->is_loaded); break; @@ -473,6 +478,13 @@ act_user_class_init (ActUserClass *class) FALSE, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, + PROP_NONEXISTENT, + g_param_spec_boolean ("nonexistent", + "Doesn't exist", + "Determines whether or not the user object represents a valid user account.", + FALSE, + G_PARAM_READABLE)); + g_object_class_install_property (gobject_class, PROP_LOCKED, g_param_spec_boolean ("locked", "Locked", @@ -992,6 +1004,22 @@ act_user_is_local_account (ActUser *user) } /** + * act_user_is_nonexistent: + * @user: the user object to examine. + * + * Retrieves whether the user is nonexistent or not. + * + * Returns: (transfer none): %TRUE if the user is nonexistent + **/ +gboolean +act_user_is_nonexistent (ActUser *user) +{ + g_return_val_if_fail (ACT_IS_USER (user), FALSE); + + return user->nonexistent; +} + +/** * act_user_get_icon_file: * @user: a #ActUser * @@ -1349,6 +1377,26 @@ changed_handler (AccountsUser *object, } /** + * _act_user_update_as_nonexistent: + * @user: the user object to update. + * + * Set's the 'non-existent' property of @user to #TRUE + * Can only be called before the user is loaded. + **/ +void +_act_user_update_as_nonexistent (ActUser *user) +{ + g_return_if_fail (ACT_IS_USER (user)); + g_return_if_fail (!act_user_is_loaded (user)); + g_return_if_fail (user->object_path == NULL); + + user->nonexistent = TRUE; + g_object_notify (G_OBJECT (user), "nonexistent"); + + set_is_loaded (user, TRUE); +} + +/** * _act_user_update_from_object_path: * @user: the user object to update. * @object_path: the object path of the user to use. @@ -1506,6 +1554,9 @@ _act_user_load_from_user (ActUser *user, user->password_mode = user_to_copy->password_mode; g_object_notify (G_OBJECT (user), "password-mode"); + user->nonexistent = user_to_copy->nonexistent; + g_object_notify (G_OBJECT (user), "nonexistent"); + set_is_loaded (user, TRUE); } |