From 1ce0b75788c8703556f81b421067d108472472d2 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Mon, 20 May 2013 14:53:22 -0400 Subject: [PATCH 7/8] daemon:Trust SystemAccount key from keyfile over heuristics We use some less than perfect heuristics for determining whether or not a user is a "system account". This commit defers to what's in the key file when the key file explicitly says. https://bugs.freedesktop.org/show_bug.cgi?id=64769 --- src/user.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/user.c b/src/user.c index e45c8c5..2f2acea 100644 --- a/src/user.c +++ b/src/user.c @@ -320,60 +320,70 @@ user_update_from_keyfile (User *user, } s = g_key_file_get_string (keyfile, "User", "Email", NULL); if (s != NULL) { g_free (user->email); user->email = s; g_object_notify (G_OBJECT (user), "email"); } s = g_key_file_get_string (keyfile, "User", "Location", NULL); if (s != NULL) { g_free (user->location); user->location = s; g_object_notify (G_OBJECT (user), "location"); } s = g_key_file_get_string (keyfile, "User", "PasswordHint", NULL); if (s != NULL) { g_free (user->password_hint); user->password_hint = s; g_object_notify (G_OBJECT (user), "password-hint"); } s = g_key_file_get_string (keyfile, "User", "Icon", NULL); if (s != NULL) { g_free (user->icon_file); user->icon_file = s; g_object_notify (G_OBJECT (user), "icon-file"); } + if (g_key_file_has_key (keyfile, "User", "SystemAccount", NULL)) { + gboolean system_account; + + system_account = g_key_file_get_boolean (keyfile, "User", "SystemAccount", NULL); + if (system_account != user->system_account) { + user->system_account = system_account; + g_object_notify (G_OBJECT (user), "system-account"); + } + } + g_object_thaw_notify (G_OBJECT (user)); } void user_update_local_account_property (User *user, gboolean local) { if (local == user->local_account) return; user->local_account = local; g_object_notify (G_OBJECT (user), "local-account"); } static void user_save_to_keyfile (User *user, GKeyFile *keyfile) { if (user->email) g_key_file_set_string (keyfile, "User", "Email", user->email); if (user->language) g_key_file_set_string (keyfile, "User", "Language", user->language); if (user->x_session) g_key_file_set_string (keyfile, "User", "XSession", user->x_session); if (user->location) g_key_file_set_string (keyfile, "User", "Location", user->location); if (user->password_hint) -- 1.8.2.1