diff options
author | Ray Strode <rstrode@redhat.com> | 2013-05-20 09:15:36 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2013-05-20 19:49:12 -0400 |
commit | fb3273bbcda498663b74cb2fb9bbaa3f18130fd8 (patch) | |
tree | 7697d0776dfc06d3ba7d12d6ce8d04c36412f27f | |
parent | c155a72d4da6afe5ed6846954e6f06086ea91912 (diff) |
user: never treat cached users as system accounts
Right now the check for "is system user" is less than solid.
It depends on checking things like whether or not a password is set,
and whether or not a shell is set. Unfortunately, sometimes a password
is not set for a non-system account, and sometimes a shell is set for
a system account, so the heuristics aren't perfect.
In one particular case, we currently get things wrong: right after a
user is created before they have a password.
This commit attempts to shore up the heuristics by never treating cached
users as system users.
https://bugs.freedesktop.org/show_bug.cgi?id=64769
-rw-r--r-- | src/daemon.c | 3 | ||||
-rw-r--r-- | src/user.c | 13 | ||||
-rw-r--r-- | src/user.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/daemon.c b/src/daemon.c index 872d9ef..d8abe64 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -1180,6 +1180,7 @@ daemon_create_user_authorized_cb (Daemon *daemon, user = daemon_local_find_user_by_name (daemon, cd->user_name); user_update_local_account_property (user, TRUE); + user_update_system_account_property (user, FALSE); cache_user (daemon, user); @@ -1231,6 +1232,8 @@ daemon_cache_user_authorized_cb (Daemon *daemon, return; } + user_update_system_account_property (user, FALSE); + cache_user (daemon, user); accounts_accounts_complete_cache_user (NULL, context, user_get_object_path (user)); @@ -285,6 +285,9 @@ user_update_from_pwent (User *user, g_object_notify (G_OBJECT (user), "password-mode"); } + /* FIXME: this relies on heuristics that don't always come out + * right. + */ user->system_account = daemon_local_user_is_excluded (user->daemon, user->user_name, pwent->pw_shell, @@ -370,6 +373,16 @@ user_update_local_account_property (User *user, g_object_notify (G_OBJECT (user), "local-account"); } +void +user_update_system_account_property (User *user, + gboolean system) +{ + if (system == user->system_account) + return; + user->system_account = system; + g_object_notify (G_OBJECT (user), "system-account"); +} + static void user_save_to_keyfile (User *user, GKeyFile *keyfile) @@ -59,6 +59,8 @@ void user_update_from_keyfile (User *user, GKeyFile *keyfile); void user_update_local_account_property (User *user, gboolean local); +void user_update_system_account_property (User *user, + gboolean system); void user_register (User *user); void user_unregister (User *user); |