summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2023-03-27 15:10:00 -0400
committerRay Strode <rstrode@redhat.com>2023-03-27 15:27:39 -0400
commit57e491f5e6f3da2d5a949f4f8747c8f4e8ed799d (patch)
tree8413823e46e13c64ec0b873795a4e5a234962f9c
parentff58f16bd5c75bea47939fed41716845cd427208 (diff)
user-manager: Track non-existent users23.13.9
Right now if a user is non-existent we dispose of it. This is wrong, because callers may rely on it and they don't own it. This commit keeps a list of non-existent users on the user manager object.
-rw-r--r--src/libaccountsservice/act-user-manager.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index ac59729..61b4da5 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -170,6 +170,7 @@ typedef struct
GSList *new_users; /* (element-type ActUser) (owned) */
GSList *new_users_inhibiting_load; /* (element-type ActUser) (unowned) */
GSList *dopplegangers;
+ GSList *nonexistent_users;
GSList *fetch_user_requests;
GSList *exclude_usernames;
@@ -1791,6 +1792,8 @@ static void
give_up (ActUserManager *manager,
ActUserManagerFetchUserRequest *request)
{
+ ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
+
if (request->type == ACT_USER_MANAGER_FETCH_USER_FROM_USERNAME_REQUEST)
g_debug ("ActUserManager: failed to load user %s", request->username);
else
@@ -1798,8 +1801,10 @@ give_up (ActUserManager *manager,
request->state = ACT_USER_MANAGER_GET_USER_STATE_UNFETCHED;
- if (request->user)
+ if (request->user != NULL) {
+ priv->nonexistent_users = g_slist_prepend (priv->nonexistent_users, g_object_ref (request->user));
_act_user_update_as_nonexistent (request->user);
+ }
g_cancellable_cancel (request->cancellable);
}
@@ -2625,6 +2630,10 @@ act_user_manager_finalize (GObject *object)
(GFunc) free_fetch_user_request, NULL);
g_slist_free (priv->fetch_user_requests);
+ g_slist_foreach (priv->nonexistent_users,
+ (GFunc) g_object_unref, NULL);
+ g_slist_free (priv->nonexistent_users);
+
g_slist_foreach (priv->dopplegangers,
(GFunc) g_object_unref, NULL);
g_slist_free (priv->dopplegangers);